-
-
Notifications
You must be signed in to change notification settings - Fork 17
feat(apps/playground): add modular online collaborative editor #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhyd1997
wants to merge
20
commits into
next
Choose a base branch
from
feat/online-collab-editor-1767156268
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 1c1809f
fix(apps/playground): remove any types from collab-editor module
zhyd1997 49e1f54
fix(apps/playground): secure ID generation in collab editor
zhyd1997 6c2d5b2
fix(apps/playground): ensure async operations maintain correct order …
zhyd1997 89faa89
docs: add critical rule against using --no-verify flag
zhyd1997 b714cca
docs(apps/playground): add CLAUDE.md and AGENTS.md with Biome recipes
zhyd1997 17a8723
test(apps/playground): fix room-manager test race conditions
zhyd1997 ec1811e
fix(apps/playground): properly handle IDBRequest async operations
zhyd1997 f288730
test(apps/playground): fix storage tests for proper async initializat…
zhyd1997 7b6171a
fix(apps/playground): handle clipboard API promise rejection properly
zhyd1997 e745964
docs: add shadcn UI component installation instructions
zhyd1997 c3301a0
chore(apps/playground): add package path aliases to tsconfig
zhyd1997 e35add4
feat(apps/playground): replace alert with toast notifications
zhyd1997 39c3fab
refactor(apps/playground): migrate storage layer to Dexie.js
zhyd1997 3f7e209
fix(apps/playground): fix test failures with proper configuration app…
zhyd1997 25a9c60
fix(apps/playground): resolve Dexie primary key error in storage schema
zhyd1997 bbbb028
test(apps/playground): fix e2e tests for new online collaborative editor
zhyd1997 586ac0e
chore(apps/playground): expand biome coverage to include e2e directory
zhyd1997 5cea3f9
fix(apps/playground): add missing lastModified field to Document type
zhyd1997 5dfd459
fix(apps/playground): resolve Dexie primary key error with new database
zhyd1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` | ||
|
|
||
| ## 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
69-69: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents