Skip to content

Commit ad3c013

Browse files
Merge pull request #58 from justinpearson/name-stamps
feat(stamps): show stamp names beneath stamps in toolbar
2 parents f04b068 + 72c5d0a commit ad3c013

24 files changed

+14550
-51
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
1. Download the `kidpix-${{ github.ref_name }}.tar.gz` file below
5656
2. Extract the archive to a folder
5757
3. Run a local web server in the extracted folder (e.g., `python -m http.server` or `npx serve .`)
58-
4. Open the served URL in your browser, eg, http://localhost:8080/
58+
4. Open the served URL in your browser ( http://localhost:8000/ )
5959
5. Start drawing!
6060
6161
Enjoy creating digital masterpieces! 🎨

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ node_modules
1313
dist
1414
dist-gh
1515
dist-ssr
16+
dist-gh/
1617
*.local
1718

1819
# Editor directories and files

CLAUDE.md

Lines changed: 204 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,41 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5+
## Quick Reference
6+
7+
- **Live App**: https://justinpearson.github.io/kidpix/
8+
- **Docs**: https://justinpearson.github.io/kidpix/docs/
9+
- **Main Branch**: `main`
10+
- **Current Branch**: `name-stamps` (as of October 2025)
11+
- **Tech Stack**: Vanilla JS (~16,300 lines) + Vite 6.4.1 + Vitest + Playwright
12+
- **No Linting**: ESLint/Prettier removed - AI writes correct code without them
13+
- **Dev Server**: `yarn dev-app`http://localhost:5173/
14+
- **Feature Requests**: See `prompts-TODO/current.txt`
15+
516
## Project Overview
617

718
This is a modular JavaScript implementation of the classic 1989 Kid Pix drawing application, based on Vikrum's HTML/JavaScript implementation (kidpix.app). The current focus is on maintaining and improving the modular JavaScript codebase as a foundation for future migration to React/TypeScript.
819

20+
### Recent Improvements (September-October 2025)
21+
22+
- Multi-level undo/redo that persists across page reloads
23+
- Expanded stamp collection with organized naming system
24+
- Enhanced color picker tool
25+
- Improved image organization (moved to logical folders)
26+
- GitHub releases support for offline distribution
27+
- Comprehensive documentation for users and maintainers
28+
- Browser error monitoring integration for AI-assisted development
29+
- Removed ESLint/Prettier to reduce development friction (AI writes correct code without them)
30+
931
## Technology Stack
1032

1133
- **Runtime**: Modular JavaScript (ES5/ES6) loaded via script tags
12-
- **Build Tool**: Vite 6.3.5 for development server and asset serving
34+
- **Build Tool**: Vite 6.4.1 for development server and asset serving
1335
- **Package Manager**: Yarn 1.22.22
14-
- **Linting**: ESLint 9 (currently configured for TypeScript, needs update for JS)
15-
- **Testing**: Vitest and Playwright configured but not yet used for JS files
16-
- **Error Monitoring**: vite-plugin-terminal for browser console errors in Claude Code development
36+
- **Node.js**: v24.9.0
37+
- **Linting**: None (ESLint and Prettier removed in commit 3f1155b - September 2025)
38+
- **Testing**: Vitest 3.2.3 and Playwright 1.56.1 configured for JavaScript files
39+
- **Error Monitoring**: vite-plugin-terminal 1.3.0 for browser console errors in Claude Code development
1740

1841
## CRITICAL COMMIT WORKFLOW
1942

@@ -59,45 +82,137 @@ git commit -m "feat(tooling): set up entire tech stack"
5982

6083
- After finishing a feature and moving its feature-request file to prompts-DONE, offer to create a pull request (PR)
6184

85+
## CI/CD and Deployment
86+
87+
### GitHub Actions Workflows
88+
89+
The project uses GitHub Actions for continuous integration and deployment:
90+
91+
1. **build-and-deploy-all.yml** (PRIMARY - Active)
92+
- Triggers: Push to main, manual workflow_dispatch
93+
- Builds app with Vite (to `dist/`)
94+
- Builds docs with MkDocs (to `dist/docs/`)
95+
- Deploys to GitHub Pages at https://justinpearson.github.io/kidpix/
96+
- Sets base URL to `/kidpix/` for GitHub Pages
97+
98+
2. **release.yml** (Active)
99+
- Triggers: Tag push matching `v*` pattern
100+
- Builds application for production
101+
- Creates tarball of `dist/` directory
102+
- Publishes GitHub Release with downloadable archive
103+
- Usage: `git tag v1.0.0 && git push --tags`
104+
105+
3. **test.yml** (Currently disabled)
106+
- Would run unit tests with coverage
107+
- Would run Playwright E2E tests
108+
- Upload test results and coverage to Codecov
109+
110+
4. **deploy.yml** (Currently disabled)
111+
- Alternative deployment workflow
112+
- Runs tests before deploying
113+
114+
5. **docs.yml** (Superseded by build-and-deploy-all.yml)
115+
- Previously built docs separately
116+
117+
### Release Process
118+
119+
To create a new release:
120+
121+
```bash
122+
# Using npm version command (increments package.json version)
123+
yarn release:patch # v1.0.0 -> v1.0.1
124+
yarn release:minor # v1.0.0 -> v1.1.0
125+
yarn release:major # v1.0.0 -> v2.0.0
126+
127+
# Or manually create and push a tag
128+
git tag v1.0.0
129+
git push origin --tags
130+
```
131+
132+
The release workflow automatically:
133+
- Builds the application
134+
- Creates a tarball (e.g., `kidpix-v1.0.0.tar.gz`)
135+
- Publishes a GitHub Release with the tarball
136+
- Users can download and run locally with `python -m http.server`
137+
138+
### Deployment URLs
139+
140+
- **Live App**: https://justinpearson.github.io/kidpix/
141+
- **Documentation**: https://justinpearson.github.io/kidpix/docs/
142+
- **Releases**: https://github.com/justinpearson/kidpix/releases
143+
62144
## Development Commands
63145

64146
### Development Server
65147

66148
```bash
67-
yarn dev
68-
# Opens development server at http://localhost:5173/
69-
# Access points:
70-
# - http://localhost:5173/ - Modular JavaScript version (main entry point)
149+
yarn dev-app # Start dev server (opens at http://localhost:5173/)
150+
yarn dev-app-stop # Stop the background dev server
71151
```
72152

153+
**Dev Server Notes:**
154+
- Opens automatically at http://localhost:5173/
155+
- Hot module reloading for instant updates
156+
- Browser errors displayed in terminal via vite-plugin-terminal
157+
- Process ID saved to `.vite.pid` for cleanup
158+
73159
### Build
74160

75161
```bash
76-
yarn build
77-
# Runs Vite build for production deployment
162+
yarn build # Build app and docs for both local (dist/) and GitHub Pages (dist-gh/)
78163
```
79164

80-
### Linting
165+
**Build Notes:**
166+
- Creates `dist/` directory for local deployment (base URL: `/`)
167+
- Creates `dist-gh/` directory for GitHub Pages deployment (base URL: `/kidpix/`)
168+
- Both builds include app + docs (MkDocs output in `docs/` subdirectory)
169+
170+
### Testing
81171

82172
```bash
83-
yarn lint
84-
# Runs ESLint (currently only on TypeScript files, needs update for JS files)
173+
yarn test # Run unit tests once
174+
yarn test:unit # Run unit tests in watch mode
175+
yarn test:coverage # Run unit tests with coverage report
176+
yarn test:e2e # Run Playwright end-to-end tests (headless)
177+
yarn test:e2e:headed # Run Playwright tests with visible browser
85178
```
86179

180+
### Documentation
181+
182+
```bash
183+
yarn dev-docs # Start MkDocs dev server at http://127.0.0.1:8000/
184+
```
185+
186+
**Documentation Notes:**
187+
- Docs are built as part of `yarn build` (no separate docs:build command)
188+
- MkDocs outputs to `dist/docs/` and `dist-gh/docs/`
189+
87190
### Preview Built App
88191

89192
```bash
90-
yarn preview
91-
# Preview the built application locally
193+
yarn preview-release # Preview local build at http://localhost:8080/ (dist/)
194+
yarn preview-github-pages # Preview GitHub Pages build at http://localhost:8080/kidpix/ (dist-gh/)
195+
```
196+
197+
**Preview Notes:**
198+
- Uses Python's built-in HTTP server (`python3 -m http.server`)
199+
- Must run `yarn build` first to generate the build directories
200+
201+
### Utilities
202+
203+
```bash
204+
yarn screenshot # Capture screenshots of the app (uses scripts/screenshot-capture.js)
92205
```
93206

207+
**Note:** There is no `type-check` script in this project
208+
94209
## Claude Code Development Workflow
95210

96211
### Browser Error Monitoring Setup
97212

98-
To facilitate development with Claude Code, this project is configured with `vite-plugin-terminal` to display browser runtime errors directly in the Vite dev server terminal; this makes browser console errors visible to Claude Code when it runs `yarn dev` in its own sub-shell.
213+
To facilitate development with Claude Code, this project is configured with `vite-plugin-terminal` to display browser runtime errors directly in the Vite dev server terminal; this makes browser console errors visible to Claude Code when it runs `yarn dev-app` in its own sub-shell.
99214

100-
- **NOTE FOR CLAUDE CODE**: If claude code is running the local dev server in a sub-shell (ie, `yarn dev`), claude code should remember to frequently check its stdout / stderr for browser console errors, and compare the errors' timestamps with the current time to ensure it doesn't get confused by reading old errors.
215+
- **NOTE FOR CLAUDE CODE**: If claude code is running the local dev server in a sub-shell (ie, `yarn dev-app`), claude code should remember to frequently check its stdout / stderr for browser console errors, and compare the errors' timestamps with the current time to ensure it doesn't get confused by reading old errors.
101216

102217
#### Setup Details
103218

@@ -109,7 +224,7 @@ To facilitate development with Claude Code, this project is configured with `vit
109224

110225
#### Usage for Claude Code
111226

112-
1. **Start Development Server**: Claude Code runs `yarn dev` in background bash shell
227+
1. **Start Development Server**: Claude Code runs `yarn dev-app` in background bash shell
113228
2. **Error Monitoring**: Runtime errors appear in terminal with full stack traces
114229
3. **Real-time Debugging**: Errors visible immediately as user interacts with browser
115230
4. **Error Format**: Shows file location, line numbers, complete stack traces, and timestamps
@@ -145,7 +260,7 @@ Example error output:
145260

146261
#### Version Compatibility
147262

148-
⚠️ **Important**: We use Vite 6.3.5 (not the latest 7.x) for security reasons and plugin compatibility. The `vite-plugin-terminal` has [known compatibility issues](https://github.com/patak-dev/vite-plugin-terminal/issues/34) with Vite 7.x. If you need Vite 7.x, consider implementing a custom error monitoring solution.
263+
⚠️ **Important**: We use Vite 6.x (currently 6.4.1, not the latest 7.x) for security reasons and plugin compatibility. The `vite-plugin-terminal` has [known compatibility issues](https://github.com/patak-dev/vite-plugin-terminal/issues/34) with Vite 7.x. If you need Vite 7.x, consider implementing a custom error monitoring solution.
149264

150265
#### Workflow Benefits
151266

@@ -223,17 +338,18 @@ KiddoPaint.Tools.Toolbox.ToolName = function () {
223338

224339
## Feature Development Workflow
225340

226-
1. Read feature requests from `prompts-TODO/` directory (newest first)
341+
1. Read feature requests from `prompts-TODO/` directory (check `current.txt` first, then others)
227342
2. Create a new git branch for the feature
228-
3. Implement using JavaScript best practices in the modular structure
229-
4. Ensure no build or lint errors before committing
230-
5. Use conventional commit format
231-
6. Push branch and create PR via GitHub CLI (`gh pr create`)
232-
7. Verify CI passes on GitHub, make & push any needed corrections
233-
8. **BEFORE MERGING**: Move feature request file from `prompts-TODO/` to `prompts-DONE/` using `git mv`
234-
9. Commit and push the moved feature request file to the PR
235-
10. Merge PR and delete branch
236-
11. Locally: `git fetch origin/main` and fast-forward local main branch
343+
3. **First commit**: Add the feature request file to git (if not already tracked)
344+
4. Implement using JavaScript best practices in the modular structure
345+
5. Make logical, incremental commits following conventional commit format
346+
6. Run tests locally (`yarn test`) before pushing
347+
7. Push branch and create PR via GitHub CLI (`gh pr create`)
348+
8. Verify CI passes on GitHub, make & push any needed corrections
349+
9. **BEFORE MERGING**: Move feature request file from `prompts-TODO/` to `prompts-DONE/` using `git mv`
350+
10. Commit and push the moved feature request file to the PR
351+
11. Merge PR and delete branch via GitHub UI
352+
12. Locally: `git checkout main && git pull origin main` to sync with remote
237353

238354
## Key Development Patterns
239355

@@ -260,17 +376,27 @@ KiddoPaint.Tools.Toolbox.ToolName = function () {
260376

261377
## Testing Strategy
262378

263-
Testing framework is configured but not yet adapted for JavaScript files:
379+
### Current Test Setup
264380

265-
- Vitest and Playwright are set up but configured for TypeScript
266-
- Need to adapt testing for JavaScript files in `js/` directory
267-
- Focus on utility functions first (most testable)
268-
- Consider integration tests for tool interactions
269-
- Test canvas rendering functionality
381+
- **Unit Tests**: Vitest 3.2.3 configured for both JavaScript and TypeScript files
382+
- Test files: `**/*.{test,spec}.{js,ts,tsx}` and `**/js/**/*.{test,spec}.js`
383+
- Environment: jsdom for DOM testing
384+
- Setup file: `src/test-setup.ts`
385+
- Coverage provider: v8
386+
- Coverage output: text, json, html formats
387+
388+
- **E2E Tests**: Playwright 1.52.0 configured
389+
- Test files in `tests/e2e/`
390+
- Excluded from Vitest coverage
391+
- Multiple browser support (Chromium, Firefox, WebKit)
392+
393+
- **Coverage Scope**:
394+
- Includes: `js/**/*.js` and `src/**/*.{js,ts,tsx}`
395+
- Excludes: config files, test files, node_modules, coverage, dist, site
270396

271397
### Coverage Thresholds (TODO: Increase as tests are added)
272398

273-
**Current Status (2025-06-17)**: Very low coverage thresholds set to allow CI to pass:
399+
**Current Status (as of June 2025)**: Very low coverage thresholds set to allow CI to pass:
274400

275401
- Lines: 1% (currently 1.76%)
276402
- Functions: 10% (currently 14.96%)
@@ -279,15 +405,45 @@ Testing framework is configured but not yet adapted for JavaScript files:
279405

280406
**Target Goals**: 70% lines/functions/statements, 60% branches
281407

282-
⚠️ **IMPORTANT**: These thresholds should be gradually increased as we add more comprehensive tests to the JavaScript codebase. See `vitest.config.ts` for current configuration.
408+
⚠️ **IMPORTANT**: These thresholds should be gradually increased as we add more comprehensive tests to the JavaScript codebase. See [vitest.config.ts](vitest.config.ts:30-35) for current configuration.
409+
410+
### Test Development Priorities
411+
412+
1. Utility functions in `js/util/` (most testable, already has some tests)
413+
2. Brush and texture generators (pure functions)
414+
3. Tool behavior and canvas operations
415+
4. Integration tests for multi-tool workflows
416+
5. E2E tests for complete user journeys
283417

284418
## File Organization
285419

286-
- `js/`: Modular JavaScript source code (primary codebase)
287-
- `src/assets/`: Static assets (images, sounds, CSS)
288-
- `src/`: React/TypeScript components (future migration target)
420+
- `js/`: Modular JavaScript source code (~15,700 lines, primary codebase)
421+
- `js/tools/`: 50+ drawing tools
422+
- `js/brushes/`: 20+ brush pattern generators
423+
- `js/textures/`: Texture/fill pattern generators
424+
- `js/builders/`: Complex shape builders
425+
- `js/stamps/`: Stamp and text systems
426+
- `js/submenus/`: UI submenu definitions
427+
- `js/sounds/`: Audio system and sound library
428+
- `js/util/`: Core utilities (display, colors, caching, filters)
429+
- `js/init/`: Application initialization and setup
430+
- `src/`: React/TypeScript components and assets
431+
- `src/assets/`: Static assets (images, sounds, CSS)
432+
- `src/components/`, `src/contexts/`, `src/hooks/`: Future React migration target
433+
- `src/kidpix-main.js`: Main entry point for React version (future)
434+
- `src/test-setup.ts`: Vitest test setup
289435
- `index.html`: Main application entry point loading modular JS files
290-
- Documentation in `doc/` with user and maintainer guides
436+
- `doc/`: Documentation built with MkDocs (user and maintainer guides)
437+
- `prompts-TODO/`: Feature request files (newest first)
438+
- `prompts-DONE/`: Completed feature requests
439+
- `util/`: Utility scripts for stamp management
440+
- Stamp spritesheet PNGs (kidpix-spritesheet-0.png through -8.png)
441+
- Stamp name JSON files with metadata for all stamps
442+
- `stamp-verification.html`: Visual tool for verifying stamp names and positions
443+
- `scripts/`: Development scripts (screenshot capture, install scripts)
444+
- `tests/`: Test files
445+
- `tests/e2e/`: Playwright end-to-end tests
446+
- `.github/workflows/`: CI/CD workflows
291447

292448
## Key Systems
293449

@@ -326,14 +482,17 @@ KiddoPaint.Submenu.toolname = [
326482

327483
Each tool can have associated sounds (start, during, end) with support for random sound selection and multi-part audio sequences.
328484

329-
### Canvas Management
485+
### Canvas Management and Persistence
330486

331487
The `KiddoPaint.Display` system handles:
332488

333489
- Canvas clearing and saving operations
334-
- Undo functionality (single-level)
335-
- Local storage persistence
336-
- Layer compositing
490+
- **Multi-level undo/redo** (works across page reloads!)
491+
- Implemented in commit f25d218 (September 2025)
492+
- Stores canvas states in browser localStorage
493+
- Maintains undo/redo history across sessions
494+
- Local storage persistence for drawings
495+
- Layer compositing across five canvas layers
337496

338497
## Future Migration Notes
339498

0 commit comments

Comments
 (0)