Manifest fixes: - Updated all icon references from .png to .svg files - Changed MIME types from image/png to image/svg+xml - Removed missing screenshots section - Fixed HTML favicon references to use SVG files New reference linter (lint-references.py): - Validates all file references in HTML and manifest files - Checks that referenced files actually exist - Prevents broken links and missing assets - Integrated into justfile as 'validate-references' - Added to check-all command for comprehensive validation Justfile enhancements: - Added validate-references command - Updated check-all to include reference validation - Enhanced validate command with reference checking Documentation updates: - Updated CLAUDE.md with reference validation info - Added file reference checking to code quality standards This prevents issues where manifest/HTML reference non-existent files, improving PWA reliability and catching asset mismatches early. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5.7 KiB
5.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
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
Project Structure
zalgo/
├── app/ # Main application (served as document root in production)
│ ├── index.html # Main HTML page
│ ├── 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
├── .eslintrc.json # ESLint configuration
├── .prettierrc # Prettier code formatting config
└── .gitignore # Git ignore patterns
Quick Start
# Clone and enter directory
cd zalgo
# Install dependencies (using Bun)
bun install
# Start development server
python3 server.py
# Server runs on http://localhost:8000/ (IPv4) and http://[::1]:8000/ (IPv6)
Development Commands
Server & Testing
python3 server.py # Start dev server with dual-stack support
bun run serve # Alternative: start server via npm script
Code Quality
# 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
# File References
just validate-references # Check HTML/manifest file references exist
Icon Generation
# Method 1: Node.js script (requires canvas package)
bun add canvas # Install canvas dependency
node app/create-icons.js # Generate PNG icons
# Method 2: Browser-based
# Open app/generate-icons.html in browser
# Right-click and save each icon manually
Architecture
Core Components
zalgo.js - Text Corruption Engine
- Class:
ZalgoGenerator - Methods:
generate(text, intensity)- Corrupts text with Unicode combining marksclean(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
- Service worker registration
sw.js - Service Worker
- Cache-first strategy for offline support
- Caches all essential files on install
- Automatic cache cleanup on update
- 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
- Serve
app/directory as document root - Enable HTTPS (required for PWA features)
- Configure proper MIME types for manifest.json
- 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
-
Text Corruption
- Various Unicode characters (emoji, special chars)
- Empty input handling
- Very long text performance
-
User Interface
- Intensity slider (1-10 range)
- Copy notification visibility
- Clear button functionality
- Keyboard shortcuts
-
PWA Features
- Installation prompt
- Offline mode
- Icon display
- App name in launcher
-
Cross-platform
- Mobile responsiveness
- Touch interactions
- Desktop browsers
- Print styles
Code Quality
- ESLint: No errors, no warnings
- Prettier: All files formatted
- Black: Python code formatted
- Pylint: Score 10/10
- File References: All HTML/manifest references exist
Common Tasks
Adding New Features
- Update
app.jsfor UI logic - Modify
zalgo.jsfor corruption algorithms - Update
styles.cssfor visual changes - Increment cache version in
sw.js - Run linting and formatting
- Test offline functionality
Updating Dependencies
bun update # Update all dependencies
bun add [package] # Add new dependency
bun remove [package] # Remove dependency
Debugging
- Check browser console for errors
- Verify service worker registration
- Use Chrome DevTools Application tab for PWA debugging
- Test with
python3 -m http.serveras fallback server