Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c5963b5
feat(apps/playground): add modular online collaborative editor
zhyd1997 Dec 31, 2025
1c1809f
fix(apps/playground): remove any types from collab-editor module
zhyd1997 Dec 31, 2025
49e1f54
fix(apps/playground): secure ID generation in collab editor
zhyd1997 Dec 31, 2025
6c2d5b2
fix(apps/playground): ensure async operations maintain correct order …
zhyd1997 Jan 4, 2026
89faa89
docs: add critical rule against using --no-verify flag
zhyd1997 Jan 4, 2026
b714cca
docs(apps/playground): add CLAUDE.md and AGENTS.md with Biome recipes
zhyd1997 Jan 4, 2026
17a8723
test(apps/playground): fix room-manager test race conditions
zhyd1997 Jan 4, 2026
ec1811e
fix(apps/playground): properly handle IDBRequest async operations
zhyd1997 Jan 4, 2026
f288730
test(apps/playground): fix storage tests for proper async initializat…
zhyd1997 Jan 4, 2026
7b6171a
fix(apps/playground): handle clipboard API promise rejection properly
zhyd1997 Jan 4, 2026
e745964
docs: add shadcn UI component installation instructions
zhyd1997 Jan 4, 2026
c3301a0
chore(apps/playground): add package path aliases to tsconfig
zhyd1997 Jan 4, 2026
e35add4
feat(apps/playground): replace alert with toast notifications
zhyd1997 Jan 4, 2026
39c3fab
refactor(apps/playground): migrate storage layer to Dexie.js
zhyd1997 Jan 4, 2026
3f7e209
fix(apps/playground): fix test failures with proper configuration app…
zhyd1997 Jan 4, 2026
25a9c60
fix(apps/playground): resolve Dexie primary key error in storage schema
zhyd1997 Jan 4, 2026
bbbb028
test(apps/playground): fix e2e tests for new online collaborative editor
zhyd1997 Jan 4, 2026
586ac0e
chore(apps/playground): expand biome coverage to include e2e directory
zhyd1997 Jan 4, 2026
5cea3f9
fix(apps/playground): add missing lastModified field to Document type
zhyd1997 Jan 4, 2026
5dfd459
fix(apps/playground): resolve Dexie primary key error with new database
zhyd1997 Jan 4, 2026
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
16 changes: 15 additions & 1 deletion .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This file contains specific instructions for Claude AI when working on the Softmaple codebase.

## CRITICAL RULES - NEVER VIOLATE

1. **NEVER use `--no-verify` flag when committing** - Pre-commit hooks are essential for code quality. If hooks fail, fix the issues and retry without bypassing.
2. **NEVER commit directly to `next` branch** - Always create a feature branch first.
3. **ALWAYS request user approval before commits/pushes** - No exceptions.

## Project Overview

Softmaple is a Turborepo monorepo containing:
Expand Down Expand Up @@ -246,7 +252,15 @@ docs: update functional programming guidelines
2. Run tests: \`pnpm --filter <package> test\`
3. Run linter: \`pnpm lint\`
4. Format code: \`pnpm format\`
5. **Request user approval before pushing**
5. **NEVER use `--no-verify` flag** - Pre-commit hooks ensure code quality and must not be bypassed
6. **Request user approval before pushing**

### Adding shadcn UI Components

To add shadcn UI components in the turbo repo, run the `add` command in the path of the app:
```bash
pnpm dlx shadcn@latest add [COMPONENT]
```

## Package-Specific Guidelines

Expand Down
22 changes: 22 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ const withLogging =
- Run tests before merging
- Regenerate Prisma after schema changes

## Pre-commit Hooks and Code Quality

**CRITICAL: Never use `--no-verify` flag when committing code.** Pre-commit hooks run essential quality checks including:
- Code formatting with Prettier/Biome
- Linting with ESLint
- Type checking

If pre-commit hooks fail, you must:
1. Fix the issues (run `pnpm format` or `npx biome check --write`)
2. Stage the fixes
3. Retry the commit WITHOUT `--no-verify`

Bypassing these checks undermines code quality safeguards and is unacceptable.

## Adding shadcn UI Components

To add shadcn UI components in the turbo repo, run the `add` command in the path of the app:
```bash
pnpm dlx shadcn@latest add [COMPONENT]
```

## Commit & Pull Request Guidelines

**Commits:** `type(scope): summary`
Expand All @@ -94,6 +115,7 @@ const withLogging =
- **Branch naming:** `feature-name-$(date +%s)`
- **IMPORTANT: Never commit directly to the `next` branch.** Always create a new feature branch before making changes if you are on the default `next` branch.
- **When switching back to `next` from a feature branch:** Always run `git pull` and `pnpm i` to sync with remote and update dependencies
- **NEVER use `--no-verify` flag when committing** - Pre-commit hooks are critical for code quality and must not be bypassed. Work through any formatting or linting issues instead.
- **Always request user approval before commits/pushes**

**PRs:** Include summary, test commands, screenshots for UI changes
Expand Down
140 changes: 140 additions & 0 deletions apps/playground/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Playground App Development Guidelines

This file contains instructions for AI agents and developers working on the Playground application.

## Code Formatting and Linting

This app uses **Biome** for code formatting and linting. Use these commands to maintain code quality:

### Biome Command Reference

```bash
# Format all files
pnpm exec biome format --write

# Format specific files
pnpm exec biome format --write <files>

# Lint and apply safe fixes to all files
pnpm exec biome lint --write

# Lint files and apply safe fixes to specific files
pnpm exec biome lint --write <files>

# Format, lint, and organize imports of all files
pnpm exec biome check --write

# Format, lint, and organize imports of specific files
pnpm exec biome check --write <files>
```

### Usage Guidelines

#### When to use `biome format`
- Fixing indentation and spacing issues
- Correcting quote styles (single vs double)
- Fixing line endings and trailing commas

#### When to use `biome lint`
- Fixing code quality issues
- Applying best practices
- Removing unused imports
- Fixing potential bugs

#### When to use `biome check`
- Before committing (comprehensive check)
- After refactoring
- When you want to fix everything at once

## Pre-commit Hook Troubleshooting

If pre-commit hooks fail:

```bash
# 1. Check what files have issues
git status

# 2. Fix all staged files
pnpm exec biome check --write $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|js|jsx)$')

# 3. Stage the fixes
git add -u

# 4. Retry commit (NEVER use --no-verify)
git commit -m "your message"
```

## Project Structure

```
apps/playground/
├── src/
│ ├── components/ # Reusable UI components
│ ├── hooks/ # Custom React hooks
│ ├── modules/ # Feature modules (keep small, <200 lines)
│ ├── routes/ # TanStack Router pages
│ ├── lib/ # Utility functions
│ └── test/ # Unit tests
├── e2e/ # Playwright E2E tests
└── public/ # Static assets
```
Comment on lines +69 to +80
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Specify language for fenced code block.

The project structure code block at line 69 is missing a language identifier. While the content is plaintext, adding a language identifier improves markdown compliance and rendering consistency.

🔎 Proposed fix
 ## Project Structure
 
-```
+```txt
 apps/playground/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
apps/playground/
├── src/
│ ├── components/ # Reusable UI components
│ ├── hooks/ # Custom React hooks
│ ├── modules/ # Feature modules (keep small, <200 lines)
│ ├── routes/ # TanStack Router pages
│ ├── lib/ # Utility functions
│ └── test/ # Unit tests
├── e2e/ # Playwright E2E tests
└── public/ # Static assets
```
## Project Structure
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

69-69: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In apps/playground/AGENTS.md around lines 69 to 80, the fenced code block for
the project structure is missing a language identifier; update the opening fence
to include a language (e.g., ```txt or ```text) so the block is
Markdown-compliant and renders consistently, leaving the content and closing
fence unchanged.


## Development Commands

```bash
# Development
pnpm --filter playground dev # Start dev server
pnpm --filter playground build # Build for production
pnpm --filter playground preview # Preview production build

# Testing
pnpm --filter playground test # Run unit tests
pnpm --filter playground test:coverage # Run tests with coverage
pnpm --filter playground test:e2e # Run E2E tests

# Type checking
pnpm --filter playground typecheck
```

## Code Style Guidelines

1. **Functional Programming**: Prefer pure functions, immutability, and function composition
2. **TypeScript**: No `any` types, use proper type definitions
3. **Async Operations**: Always handle promises properly with async/await
4. **ID Generation**: Use `crypto.randomUUID()` for secure IDs
5. **Module Size**: Keep files under 200 lines, split large modules
6. **Imports**: Use direct imports, avoid barrel exports (index.ts)

## Common Issues and Solutions

### Biome Formatting Issues
```bash
# Quick fix for all formatting issues
pnpm exec biome format --write src/
```

### Biome Linting Issues
```bash
# Apply safe auto-fixes
pnpm exec biome lint --write src/
```

### Import Organization Issues
```bash
# Organize imports automatically
pnpm exec biome check --write src/
```

### TypeScript Errors
```bash
# Check for type errors
pnpm --filter playground typecheck
```

## Important Notes

- **NEVER use `--no-verify` flag** when committing - always fix issues properly
- **DO NOT use `pnpm dev`** directly - use `pnpm --filter playground dev`
- Biome configuration is in `biome.json` at the project root
- Pre-commit hooks will run Biome automatically on staged files
- If Biome and Prettier conflict, Biome takes precedence in this project
99 changes: 99 additions & 0 deletions apps/playground/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Claude AI Guidelines for Playground App

This file contains specific instructions for Claude AI when working on the Playground application.

## Overview

The Playground app is a Vite + React application for demonstrating various features and experiments. It uses:
- **Vite** for building and development
- **React** with TypeScript
- **TanStack Router** for routing
- **Biome** for formatting and linting
- **Vitest** for unit testing
- **Playwright** for E2E testing

## Code Formatting and Linting

The Playground app uses **Biome** for code formatting and linting. Always use these commands instead of global pnpm commands:

### Biome Commands

```bash
# Format all files
pnpm exec biome format --write

# Format specific files
pnpm exec biome format --write <files>

# Lint and apply safe fixes to all files
pnpm exec biome lint --write

# Lint files and apply safe fixes to specific files
pnpm exec biome lint --write <files>

# Format, lint, and organize imports of all files
pnpm exec biome check --write

# Format, lint, and organize imports of specific files
pnpm exec biome check --write <files>
```

### When to Use Each Command

- **`biome format`**: When you only need to fix formatting issues (indentation, spacing, etc.)
- **`biome lint`**: When you need to fix linting issues (code quality, best practices)
- **`biome check`**: When you want to do everything at once (format + lint + organize imports)

## Pre-commit Hook Issues

If pre-commit hooks fail with Biome errors:

1. Run `pnpm exec biome check --write` on the staged files
2. Stage the fixed files: `git add <fixed-files>`
3. Retry the commit **WITHOUT using `--no-verify`**

## Module Organization

- Keep modules under `src/modules/` for feature-specific code
- Keep components under `src/components/` for reusable UI
- Keep hooks under `src/hooks/` for custom React hooks
- Avoid large files (>200 lines) - split into smaller modules
- Prefer direct imports over barrel exports (index.ts files)

## Testing

```bash
# Run unit tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Run E2E tests
pnpm test:e2e

# Type checking
pnpm typecheck
```

## Development

```bash
# Start dev server
pnpm dev

# Build for production
pnpm build

# Preview production build
pnpm preview
```

## Important Rules

1. **NEVER use `--no-verify` flag** when committing
2. Always fix Biome issues before committing
3. Keep functional programming patterns where possible
4. Avoid `any` types - use proper TypeScript types
5. Test async operations thoroughly
6. Use `crypto.randomUUID()` for ID generation, not `Math.random()`
2 changes: 2 additions & 0 deletions apps/playground/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"ignoreUnknown": false,
"includes": [
"**/src/**/*",
"**/e2e/**/*",
"**/.vscode/**/*",
"**/index.html",
"**/vite.config.js",
"**/package.json",
"**/tsconfig.json",
"!**/src/routeTree.gen.ts",
"!**/src/styles.css"
]
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/e2e/collaborative-editor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from "@playwright/test";
import { expect, test } from "@playwright/test";

test.describe("Collaborative Text Editor", () => {
test.beforeEach(async ({ page }) => {
Expand Down
29 changes: 26 additions & 3 deletions apps/playground/e2e/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from "@playwright/test";
import { expect, test } from "@playwright/test";

test.describe("Home Page", () => {
test("should load home page successfully", async ({ page }) => {
Expand All @@ -21,8 +21,13 @@ test.describe("Home Page", () => {
// Check for Two-Panel Editor Demo card - it's not a heading, it's a generic element
await expect(page.getByText("Two-Panel Editor Demo")).toBeVisible();

// Check for Collaborative Editor card - also not a heading
await expect(page.getByText("Collaborative Editor")).toBeVisible();
// Check for Collaborative Editor card - use exact match to avoid ambiguity with Online Collaborative Editor
await expect(
page.getByText("Collaborative Editor", { exact: true }),
).toBeVisible();

// Check for Online Collaborative Editor card
await expect(page.getByText("Online Collaborative Editor")).toBeVisible();
});

test("should navigate to two-panel editor", async ({ page }) => {
Expand Down Expand Up @@ -56,4 +61,22 @@ test.describe("Home Page", () => {
page.getByRole("heading", { name: /Collaborative Text Editor/i }),
).toBeVisible();
});

test("should navigate to online collaborative editor", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");

// Click on Online Collaborative Editor card
await page
.getByRole("link", {
name: /Online Collaborative Editor/i,
})
.click();

// Verify navigation
await expect(page).toHaveURL(/\/demo\/online-collab-editor/);
await expect(
page.getByRole("heading", { name: /Online Collaborative Editor/i }),
).toBeVisible();
});
});
2 changes: 1 addition & 1 deletion apps/playground/e2e/two-panel-editor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from "@playwright/test";
import { expect, test } from "@playwright/test";

test.describe("Two-Panel Text Editor", () => {
test.beforeEach(async ({ page }) => {
Expand Down
Loading