2025-08-18 20:00:58 +02:00
|
|
|
# CLAUDE.md
|
|
|
|
|
|
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
|
|
|
|
|
|
## Project Overview
|
|
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
**GlitchCraft** is a Progressive Web App (PWA) that generates zalgo text - corrupted/glitched text using Unicode combining characters.
|
|
|
|
|
|
|
|
|
|
**Tagline:** "Artisanal text corruption, served fresh!"
|
|
|
|
|
|
|
|
|
|
### Key Features
|
|
|
|
|
- Real-time text corruption with adjustable intensity (1-10 scale)
|
|
|
|
|
- Click-to-copy functionality with visual feedback
|
|
|
|
|
- Progressive Web App with offline support
|
|
|
|
|
- Responsive design for all devices
|
|
|
|
|
- Dark theme with glitch aesthetics
|
2025-08-18 20:00:58 +02:00
|
|
|
|
|
|
|
|
## Project Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
zalgo/
|
2025-08-18 20:04:53 +02:00
|
|
|
├── app/ # Main application (served as document root in production)
|
2025-08-18 20:00:58 +02:00
|
|
|
│ ├── index.html # Main HTML page
|
2025-08-18 20:04:53 +02:00
|
|
|
│ ├── zalgo.js # Zalgo text generation engine
|
|
|
|
|
│ ├── app.js # Application logic and PWA registration
|
|
|
|
|
│ ├── styles.css # Application styles (dark theme)
|
|
|
|
|
│ ├── sw.js # Service worker for offline support
|
|
|
|
|
│ ├── manifest.json # PWA manifest configuration
|
|
|
|
|
│ └── icons/ # PWA icons (currently SVG placeholders)
|
|
|
|
|
├── server.py # Development server (dual-stack IPv4/IPv6)
|
|
|
|
|
├── package.json # Node.js dependencies and scripts
|
|
|
|
|
├── bun.lockb # Bun package manager lockfile
|
2025-08-18 20:00:58 +02:00
|
|
|
├── .eslintrc.json # ESLint configuration
|
2025-08-18 20:04:53 +02:00
|
|
|
├── .prettierrc # Prettier code formatting config
|
|
|
|
|
└── .gitignore # Git ignore patterns
|
2025-08-18 20:00:58 +02:00
|
|
|
```
|
|
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
## Quick Start
|
2025-08-18 20:00:58 +02:00
|
|
|
|
|
|
|
|
```bash
|
2025-08-18 20:04:53 +02:00
|
|
|
# Clone and enter directory
|
|
|
|
|
cd zalgo
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
# Install dependencies (using Bun)
|
|
|
|
|
bun install
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
# Start development server
|
|
|
|
|
python3 server.py
|
|
|
|
|
# Server runs on http://localhost:8000/ (IPv4) and http://[::1]:8000/ (IPv6)
|
|
|
|
|
```
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
## Development Commands
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
### Server & Testing
|
|
|
|
|
```bash
|
|
|
|
|
python3 server.py # Start dev server with dual-stack support
|
|
|
|
|
bun run serve # Alternative: start server via npm script
|
2025-08-18 20:00:58 +02:00
|
|
|
```
|
|
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
### Code Quality
|
2025-08-18 20:00:58 +02:00
|
|
|
```bash
|
2025-08-18 20:04:53 +02:00
|
|
|
# JavaScript
|
|
|
|
|
bun run lint:js # Check JavaScript with ESLint
|
|
|
|
|
bun run lint:js:fix # Auto-fix JavaScript issues
|
|
|
|
|
bun run format # Format all files with Prettier
|
|
|
|
|
bun run check # Check formatting without modifying
|
|
|
|
|
|
|
|
|
|
# Python
|
|
|
|
|
black server.py # Format Python code
|
|
|
|
|
pylint server.py # Lint Python code
|
2025-08-18 20:18:51 +02:00
|
|
|
|
|
|
|
|
# File References
|
|
|
|
|
just validate-references # Check HTML/manifest file references exist
|
2025-08-18 20:00:58 +02:00
|
|
|
```
|
|
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
### Icon Generation
|
|
|
|
|
```bash
|
|
|
|
|
# Method 1: Node.js script (requires canvas package)
|
|
|
|
|
bun add canvas # Install canvas dependency
|
|
|
|
|
node app/create-icons.js # Generate PNG icons
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
# Method 2: Browser-based
|
|
|
|
|
# Open app/generate-icons.html in browser
|
|
|
|
|
# Right-click and save each icon manually
|
|
|
|
|
```
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
## Architecture
|
|
|
|
|
|
|
|
|
|
### Core Components
|
|
|
|
|
|
|
|
|
|
#### `zalgo.js` - Text Corruption Engine
|
|
|
|
|
- **Class:** `ZalgoGenerator`
|
|
|
|
|
- **Methods:**
|
|
|
|
|
- `generate(text, intensity)` - Corrupts text with Unicode combining marks
|
|
|
|
|
- `clean(text)` - Removes corruption from text
|
|
|
|
|
- **Character Sets:**
|
|
|
|
|
- Above: Diacritical marks that appear above letters
|
|
|
|
|
- Middle: Marks that overlay characters
|
|
|
|
|
- Below: Marks that appear below letters
|
|
|
|
|
|
|
|
|
|
#### `app.js` - Application Controller
|
|
|
|
|
- Manages user interactions
|
|
|
|
|
- Real-time corruption on input
|
|
|
|
|
- Clipboard operations with visual feedback
|
|
|
|
|
- Keyboard shortcuts (Ctrl/Cmd+K to clear)
|
|
|
|
|
- PWA installation prompt handling
|
2025-08-18 20:00:58 +02:00
|
|
|
- Service worker registration
|
|
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
#### `sw.js` - Service Worker
|
|
|
|
|
- Cache-first strategy for offline support
|
|
|
|
|
- Caches all essential files on install
|
2025-08-18 20:00:58 +02:00
|
|
|
- Automatic cache cleanup on update
|
2025-08-18 20:04:53 +02:00
|
|
|
- Handles offline fallback
|
|
|
|
|
|
|
|
|
|
#### `server.py` - Development Server
|
|
|
|
|
- Dual-stack server (IPv4 and IPv6)
|
|
|
|
|
- Serves `app/` directory as document root
|
|
|
|
|
- Adds required PWA headers
|
|
|
|
|
- No external dependencies (uses Python stdlib)
|
|
|
|
|
|
|
|
|
|
### Styling & Design
|
|
|
|
|
- Dark theme (#0f0f14 background)
|
|
|
|
|
- Glitch-inspired animations
|
|
|
|
|
- Accent color: #00ff88 (bright green)
|
|
|
|
|
- Responsive breakpoint: 600px
|
|
|
|
|
- Monospace font for text areas
|
|
|
|
|
|
|
|
|
|
## Deployment Guidelines
|
|
|
|
|
|
|
|
|
|
### Production Setup
|
|
|
|
|
1. Serve `app/` directory as document root
|
|
|
|
|
2. Enable HTTPS (required for PWA features)
|
|
|
|
|
3. Configure proper MIME types for manifest.json
|
|
|
|
|
4. Set appropriate cache headers
|
|
|
|
|
|
|
|
|
|
### Pre-deployment Checklist
|
|
|
|
|
- [ ] Generate PNG icons (replace SVG placeholders)
|
|
|
|
|
- [ ] Test PWA installation on mobile devices
|
|
|
|
|
- [ ] Verify offline functionality
|
|
|
|
|
- [ ] Check HTTPS certificate
|
|
|
|
|
- [ ] Test on multiple browsers (Chrome, Firefox, Safari, Edge)
|
|
|
|
|
|
|
|
|
|
## Testing Requirements
|
|
|
|
|
|
|
|
|
|
### Functional Tests
|
|
|
|
|
1. **Text Corruption**
|
|
|
|
|
- Various Unicode characters (emoji, special chars)
|
|
|
|
|
- Empty input handling
|
|
|
|
|
- Very long text performance
|
|
|
|
|
|
|
|
|
|
2. **User Interface**
|
|
|
|
|
- Intensity slider (1-10 range)
|
|
|
|
|
- Copy notification visibility
|
|
|
|
|
- Clear button functionality
|
|
|
|
|
- Keyboard shortcuts
|
|
|
|
|
|
|
|
|
|
3. **PWA Features**
|
|
|
|
|
- Installation prompt
|
|
|
|
|
- Offline mode
|
|
|
|
|
- Icon display
|
|
|
|
|
- App name in launcher
|
|
|
|
|
|
|
|
|
|
4. **Cross-platform**
|
|
|
|
|
- Mobile responsiveness
|
|
|
|
|
- Touch interactions
|
|
|
|
|
- Desktop browsers
|
|
|
|
|
- Print styles
|
|
|
|
|
|
|
|
|
|
### Code Quality
|
2025-08-18 20:18:51 +02:00
|
|
|
- ESLint: No errors, no warnings
|
2025-08-18 20:04:53 +02:00
|
|
|
- Prettier: All files formatted
|
|
|
|
|
- Black: Python code formatted
|
|
|
|
|
- Pylint: Score 10/10
|
2025-08-18 20:18:51 +02:00
|
|
|
- File References: All HTML/manifest references exist
|
2025-08-18 20:04:53 +02:00
|
|
|
|
|
|
|
|
## Common Tasks
|
|
|
|
|
|
|
|
|
|
### Adding New Features
|
|
|
|
|
1. Update `app.js` for UI logic
|
|
|
|
|
2. Modify `zalgo.js` for corruption algorithms
|
|
|
|
|
3. Update `styles.css` for visual changes
|
|
|
|
|
4. Increment cache version in `sw.js`
|
|
|
|
|
5. Run linting and formatting
|
|
|
|
|
6. Test offline functionality
|
|
|
|
|
|
|
|
|
|
### Updating Dependencies
|
|
|
|
|
```bash
|
|
|
|
|
bun update # Update all dependencies
|
|
|
|
|
bun add [package] # Add new dependency
|
|
|
|
|
bun remove [package] # Remove dependency
|
|
|
|
|
```
|
2025-08-18 20:00:58 +02:00
|
|
|
|
2025-08-18 20:04:53 +02:00
|
|
|
### Debugging
|
|
|
|
|
- Check browser console for errors
|
|
|
|
|
- Verify service worker registration
|
|
|
|
|
- Use Chrome DevTools Application tab for PWA debugging
|
|
|
|
|
- Test with `python3 -m http.server` as fallback server
|