Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .serena/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/cache
/project.local.yml
48 changes: 48 additions & 0 deletions .serena/memories/project_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Storybook - Project Overview

## Purpose
Storybook is an open-source UI development tool for building, testing, and documenting UI components in isolation.
It supports multiple frontend frameworks (React, Vue, Angular, Svelte, Web Components, Preact, Ember, HTML, etc.)
and integrates with various build tools (Vite, Webpack5).

## Version
Current version: 10.2.x (as of March 2026)

## Tech Stack
- **Language**: TypeScript (strict mode), targeting ES2020
- **Package Manager**: Yarn 4.10.3 (with workspaces)
- **Node.js**: 22.21.1 (specified in `.nvmrc`)
- **Monorepo Tool**: NX (with `--no-cloud` flag required to avoid NX Cloud login issues)
- **Test Runner**: Vitest (primary), Playwright (E2E)
- **Linting**: ESLint 8
- **Formatting**: Prettier 3.7+
- **Bundlers**: Vite 7, Webpack 5, esbuild
- **UI Libraries**: React 18, react-aria (use specific submodules, not root imports)
- **Build System**: Custom build via `jiti ./scripts/build/build-package.ts`

## Repository Structure
```
storybook/
├── code/ # Main codebase
│ ├── core/ # Core package (UI, API, manager, preview, server, etc.)
│ ├── addons/ # Official addons (docs, controls, a11y, interactions, vitest, etc.)
│ ├── builders/ # Build integrations (vite, webpack5, manager)
│ ├── frameworks/ # Framework integrations (react-vite, nextjs, angular, vue3-vite, etc.)
│ ├── renderers/ # Framework renderers (react, vue3, svelte, html, etc.)
│ ├── lib/ # Shared libraries (cli, codemod, csf-tools, etc.)
│ ├── presets/ # Preset packages
│ ├── e2e-tests/ # Playwright E2E tests
│ └── .storybook/ # Internal Storybook config (dogfooding)
├── scripts/ # Build/CI/task scripts
├── docs/ # Documentation
├── sandbox/ # Generated sandbox environments for testing
└── test-storybooks/ # Test storybook configurations
```

## Key Packages
- `@storybook/core` - Core functionality (UI, API, server, preview, channels, etc.)
- `@storybook/react`, `@storybook/vue3`, etc. - Framework renderers
- `@storybook/react-vite`, `@storybook/nextjs`, etc. - Framework integrations
- `@storybook/addon-docs`, `@storybook/addon-a11y`, etc. - Official addons
- `storybook` - CLI package
- `create-storybook` - Project scaffolding
53 changes: 53 additions & 0 deletions .serena/memories/style_and_conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Code Style & Conventions

## TypeScript
- **Strict mode** enabled (`strict: true` in tsconfig)
- Target: ES2020, Module: Preserve, ModuleResolution: bundler
- `noImplicitAny: true`
- JSX: preserve
- No emit (handled by build tools, not tsc)

## Prettier Configuration
- Print width: 100
- Tab width: 2
- Single quotes: yes
- Trailing commas: es5
- Arrow parens: always
- Brace style: 1tbs (one true brace style)
- Import order (via @trivago/prettier-plugin-sort-imports):
1. `node:` builtins
2. `vitest`, `@testing-library`
3. `react`, `react-dom`
4. `storybook/internal`
5. `@storybook/[non-addon]`
6. `@storybook/addon-*`
7. Third-party modules
8. Relative imports (`./`, `../`)
- Import order separation: yes (blank lines between groups)
- Import specifiers sorted: yes

## ESLint Rules (Notable)
- `react-aria` and `react-stately`: must import from specific submodules (e.g., `@react-aria/overlays`), NOT root
- `react-aria-components`: must use `react-aria-components/patched-dist/ComponentX` entrypoints for tree-shaking
- `es-toolkit`: must use sub-exports (e.g., `es-toolkit/array`), NOT root import
- `import-x/no-extraneous-dependencies`: off
- `react/react-in-jsx-scope`: off
- TypeScript `dot-notation` with `allowIndexSignaturePropertyAccess`
- Custom local rules: `no-uncategorized-errors`, `storybook-monorepo-imports`, `no-duplicated-error-codes`

## Naming Conventions
- Files: kebab-case for most files (e.g., `my-component.ts`)
- Components: PascalCase for React components
- Types/Interfaces: PascalCase
- Variables/functions: camelCase
- Constants: UPPER_SNAKE_CASE for true constants, camelCase otherwise

## Test Files
- Pattern: `*.test.ts`, `*.test.tsx`, `*.spec.ts`, `*.spec.tsx`
- Stories: `*.stories.ts`, `*.stories.tsx`
- Test fixtures in `__testfixtures__/` directories
- Tests in `__tests__/` directories or alongside source files

## Monorepo Import Rules
- Internal packages use `workspace:*` for dependencies
- Custom ESLint rule `storybook-monorepo-imports` enforces correct import patterns within the monorepo
101 changes: 101 additions & 0 deletions .serena/memories/suggested_commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Suggested Commands

## Installation
```bash
yarn install # Install all dependencies (from repo root)
```

## Building
```bash
# Compile a single package (always use --no-cloud to avoid NX Cloud issues)
yarn nx compile core --no-cloud
yarn nx compile @storybook/react --no-cloud

# Compile all packages
yarn nx run-many -t compile --no-cloud

# Production build of a package
cd code && yarn build
```

## Testing
```bash
# Run all unit tests (from repo root or code/)
cd code && yarn test
# or from root:
yarn test

# Run tests in watch mode
cd code && yarn test:watch

# Run specific test file
cd code && yarn test:watch -- --project <project> <test-pattern>

# E2E tests (Playwright)
cd code && npx playwright test
```

## Linting & Formatting
```bash
# Run all linting
cd code && yarn lint

# Lint JS/TS only
cd code && yarn lint:js

# Format with Prettier
cd code && yarn lint:prettier '**/*.{css,html,json,md,yml}'

# Run knip (unused code detection)
cd code && yarn knip
```

## Running the Internal Dev Storybook
```bash
# Must compile core first!
yarn nx compile core --no-cloud

# Then start the dev server (from code/ dir)
cd code && yarn storybook:ui

# Or with --ci flag (no interactive):
cd code && yarn storybook:ui --ci

# Build static storybook
cd code && yarn storybook:ui:build
```

## Sandbox / Task System
```bash
# Start a sandbox with a specific template
yarn start # defaults to react-vite/default-ts

# Run a task with a specific template
yarn task --task dev --template react-vite/default-ts --start-from=install
```

## NX Commands
```bash
# Always use --no-cloud flag!
yarn nx compile <package> --no-cloud
yarn nx run-many -t compile --no-cloud
yarn nx show projects --affected
```

## Git
```bash
git status
git diff
git log --oneline -10
git checkout next # main branch is "next"
```

## System Utilities (macOS/Darwin)
```bash
ls, cd, pwd, cat, head, tail
grep, find, xargs
curl, wget
python3, node
open <file> # open in default app
pbcopy, pbpaste # clipboard
```
39 changes: 39 additions & 0 deletions .serena/memories/task_completion_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Task Completion Checklist

After completing a coding task, run through these steps:

## 1. TypeScript Compilation
Ensure the modified package(s) compile without errors:
```bash
yarn nx compile <package-name> --no-cloud
```

## 2. Linting
Run lint on the changed files or the whole codebase:
```bash
cd code && yarn lint:js
```

## 3. Formatting
Ensure code is properly formatted:
```bash
cd code && yarn lint:prettier '<changed-files>'
```

## 4. Unit Tests
Run relevant tests:
```bash
cd code && yarn test <test-pattern>
```
Comment on lines +23 to +27
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Require a full test pass before marking the task done.

For a completion checklist, “Run relevant tests” is too weak. The repo guidance says to finish with yarn test or yarn vitest run before committing.

Based on learnings: Ensure all tests pass with yarn test or yarn vitest run before committing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.serena/memories/task_completion_checklist.md around lines 23 - 27, Update
the "## 4. Unit Tests" checklist item to require a full test pass before marking
the task done: replace "Run relevant tests" with an explicit instruction to run
the full test suite (e.g., `yarn test` or `yarn vitest run`) and confirm all
tests pass; reference the "## 4. Unit Tests" heading so reviewers know where to
change the checklist.


## 5. Pre-commit Checks
The project uses husky + lint-staged for pre-commit hooks:
- JS/TS files: ESLint with `--fix`
- EJS files: ejslint
- CSS/HTML/JSON/MD/YML: Prettier
- package.json: lint:package

## Notes
- The main branch is `next` (not `main` or `master`)
- Always use `--no-cloud` with NX commands
- Before starting the dev server, ensure core is compiled: `yarn nx compile core --no-cloud`
17 changes: 17 additions & 0 deletions .serena/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project_name: "storybook"

languages:
- typescript

encoding: "utf-8"

ignore_all_files_in_gitignore: true
ignored_paths: []

read_only: false

excluded_tools: []
included_optional_tools: []
fixed_tools: []

read_only_memory_patterns: []
Loading