we want to make a browser-based game using three.js that will distract your cat while you eat dinner so they don't steal your food.
-
-
Save scragz/c9f79786d0a406536fed1b3bca77a45c to your computer and use it in GitHub Desktop.
Your task is to collaborate on developing or refining a project or feature concept. This prompt solicits iterative feedback to expand a basic idea into a comprehensive, well-structured request.
- PROJECT_REQUEST: A short description of the project or feature’s initial concept.
In each exchange, the AI will:
- Ask questions to clarify the project or feature.
- Suggest missing considerations or user flows.
- Organize requirements logically.
- Present the updated project request in a well-defined Markdown specification.
This ensures you iterate toward a final, clear “Project Request” doc.
- User Provides Concept: User supplies the idea.
- AI Gathers Clarifications: The AI asks targeted questions to flesh out missing details, such as feature scope or user needs.
- AI Updates the Specification: After each round of questions/answers, the AI returns a new version of the Markdown-based request format.
- Repeat until the request is complete, well-defined, and you are satisfied.
# Project Name
[Description goes here]
## Target Audience
[Who will use this? What are their needs?]
## Desired Features
### [Feature Category]
- [ ] [High-level requirement]
- [ ] [Further detail, sub-requirement]
## Design Requests
- [ ] [Visual or UX requirement]
- [ ] [Relevant detail or constraint]
## Other Notes
- [Any additional considerations or open questions]
<project_request> we want to make a browser-based game using three.js that will distract your cat while you eat dinner so they don't steal your food. </project_request>
PawPursuit (working title)
A browser-based Three.js “motion lure” that auto-starts on page load, runs silently and full-screen on a tablet or TV, and continuously displays high-contrast, fast/erratic motion patterns to keep a cat visually occupied while the human eats. No user input, UI, or telemetry—just endless dark-background visuals until the tab/app is closed.
- Human operator: Wants zero-setup distraction—open URL, walk away.
- Cat viewer: Attracted to quick, unpredictable movement and contrast; loses interest if patterns repeat too long.
- Continuous animation of multiple “prey” archetypes (laser-dot streaks, fluttering moths, scurrying bugs, ribbon trails)
- Each archetype defined by a motion algorithm (random zigzags, bezier loops, sudden darts & pauses)
- Automatic mode cycling every N seconds/minutes to prevent habituation (value baked-in, e.g., 60–120s)
- Periodic “attention reset” events (brief particle bursts or color pulses) at randomized intervals
- Global difficulty scalars (speed, spawn count) wired but hardcoded (no exposed UI)
- Auto-enter (or request) full-screen on load; graceful fallback if denied
- Dark background only; palettes limited to high-contrast hues (neon greens/blues vs. dark)
- Completely silent—no audio assets, no WebAudio init
- Runs indefinitely until the page is closed or device sleeps
- Aim for 60fps on mid-range tablets; dynamic degradation (reduce particle count, lower resolution) if FPS drops
- Simple thermal/battery heuristic (time-based downgrades after X minutes)
- Avoid strobing (>3 flashes/sec) and extreme luminance shifts
- Three.js for rendering
- Vanilla JS modules; optional bundler (Vite/Rollup) for dev only
- PWA-capable for offline use (cache assets, manifest, service worker)
- Config values (mode durations, effect density) stored inline or in a JSON file; no persistence needed
- Hidden dev/debug toggle via URL param (
?debug=1
) to expose sliders in dev mode - Ambient “cool down” mode (slow drifting shapes) triggered after long runtime
- Lightweight theming system to add new modes via JSON
- Dark canvas with saturated motion trails; foreground elements never fully white
- No text or UI overlays during play
- Motion feels organic (ease-in/out, micro-pauses), not purely linear mathy paths
- No monetization, branding, or analytics—this is a quick example project.
- License unspecified; assume MIT/open-source unless changed later.
- QA scope minimal: test on Chrome (desktop), Safari iPadOS, and a smart-TV browser if available.
Your task is to generate a comprehensive technical specification based on either:
- A new project request, or
- A new feature request in an existing project
The specification must be precise, thorough, and suitable for planning & code generation.
- REQUEST: The project or feature request in
<project_request>
. - RULES: The guidelines or best practices in
<project_rules>
, if any.
- REFERENCE: A starter template or reference design in
<reference_code>
.
- Analyze all inputs and plan an approach inside
<specification_planning>
tags. - Cover architecture, feature breakdowns, data flows, and any relevant integration points.
- Return a final specification in Markdown following one of the two templates (see “Output Templates” below):
- Template A: New Project Specification
- Template B: Existing Project Feature Specification
-
Review Inputs
- The AI reviews
<project_request>
,<project_rules>
, and (optionally)<reference_code>
.
- The AI reviews
-
Planning
- Within
<specification_planning>
tags, the AI identifies key workflows, project structure, data flows, etc. - Pinpoints challenges and clarifies requirements.
- Within
-
Specification Output
-
Based on whether the REQUEST is for a new project or a feature in an existing project, the AI creates a detailed specification using the corresponding template:
- Template A (New Project Specification)
- Template B (Existing Feature Specification)
-
The specification must cover:
- System Overview
- Project Structure
- Feature Specification
- Database Schema
- Server Actions
- Design System
- Component Architecture
- Authentication & Authorization
- Data Flow
- Payment Integration
- Analytics Integration
- Testing
-
-
Further Iteration
- The user can request additional details, modifications, or clarifications as needed.
- Ensure that your specification is extremely detailed, giving implementation guidance and examples for complex features.
- Clearly define interfaces and data contracts.
- Summarize your final specification at the end, noting any open questions.
- The user may keep refining the request until it's complete and ready.
Below are two templates: one for a new project and one for a feature in an existing project. Use whichever is appropriate based on the user’s REQUEST.
# {Project Name} Technical Specification (New Project)
## 1. System Overview
- **Core Purpose & Goals**: High-level product vision and why it exists
- **Primary Use Cases**: Key user workflows and expected outcomes
- **High-Level Architecture**: Diagram or textual overview (client, server, DB, third-party services)
## 2. Technology & Tools
- **Languages & Frameworks**: (e.g., TypeScript, React, Node.js)
- **Libraries & Dependencies**: (e.g., Express, Redux, Tailwind)
- **Database & ORM**: (e.g., PostgreSQL, Prisma)
- **DevOps & Hosting**: (e.g., Docker, AWS, Heroku)
- **CI/CD Pipeline**: (e.g., GitHub Actions, CircleCI)
## 3. Project Structure
- **Folder Organization**: Proposed layout (e.g., `/src`, `/server`, `/client`)
- **Naming Conventions**: File naming rules and patterns
- **Key Modules**: Briefly describe each module’s purpose (e.g., auth module, payment module)
## 4. Feature Specification
### 4.1 Feature Name
- **User Story & Requirements**: What the user needs to do and why
- **Implementation Details**: Step-by-step outline
- **Edge Cases & Error Handling**: Anticipated failures, fallback UI, or notifications
- **UI/UX Considerations**: Wireframes or reference to design mocks
*(Repeat this sub-section as needed for each major feature.)*
## 5. Database Schema
### 5.1 Tables / Collections
- **Entities**: Each table/collection name, fields, data types, constraints
- **Relationships**: (One-to-many, many-to-many), indexes, etc.
- **Migrations**: Strategy for setting up or evolving schema over time
## 6. Server Actions
### 6.1 Database Actions
- **CRUD Operations**: Summaries of Create/Read/Update/Delete methods
- **Endpoints or GraphQL Queries**: Outline how data is fetched or modified
- **ORM/Query Examples**: Snippets showing typical queries or operations
### 6.2 Other Backend Logic
- **External API Integrations**: Payment gateways, third-party data sources
- **File or Media Handling**: Uploads, transformations, storage
- **Background Jobs or Workers**: Scheduled tasks, asynchronous processing
## 7. Design System
### 7.1 Visual Style
- **Branding & Theme**: Colors, fonts, icons
- **Layout & Spacing**: Grid systems, breakpoints for responsiveness
- **Accessibility Considerations**: (WCAG, ARIA attributes)
### 7.2 UI Components
- **Common Elements**: Buttons, forms, modals
- **Interaction States**: Hover, focus, disabled, error
- **Reusable Patterns**: Notification system, cards, lists
## 8. Component Architecture
### 8.1 Server/Backend Components
- **Framework**: (e.g., Express, NestJS)
- **Data Models & Domain Objects**: Classes or structs representing data
- **Error Boundaries**: Global error handling approach
### 8.2 Client/Frontend Components
- **State Management**: (Redux, Vuex, Zustand, etc.)
- **Routing**: Public vs. protected routes, lazy loading
- **Type Definitions**: If using TypeScript or Flow
## 9. Authentication & Authorization
- **Method**: JWT, OAuth2, session cookies, etc.
- **Role-Based or Permission-Based Access**: Admin, user, etc.
- **Session Management**: Token expiration, refresh tokens
## 10. Data Flow
- **Request/Response Lifecycle**: How the client communicates with the server
- **State Sync**: Strategies for updating UI when data changes
- **Real-Time Updates**: If using websockets or push notifications
## 11. Payment Integration (If Applicable)
- **Supported Providers**: Stripe, PayPal, etc.
- **Checkout Flow**: Steps from cart to confirmation
- **Webhook Handling**: Event-driven notifications for refunds, disputes
## 12. Analytics Integration (If Applicable)
- **Tracking Tools**: (Google Analytics, Mixpanel, custom)
- **Event Naming Conventions**: e.g., `user_sign_up`, `purchase_completed`
- **Reporting & Dashboards**: Where and how data is displayed
## 13. Security & Compliance
- **Encryption**: Data-at-rest (DB encryption), data-in-transit (TLS)
- **Compliance**: GDPR, HIPAA, PCI, or relevant regulations
- **Threat Modeling**: Potential vulnerabilities and mitigations
- **Secrets Management**: Storing API keys, credentials
## 14. Environment Configuration & Deployment
- **Local Setup**: Environment variables, Docker usage, build scripts
- **Staging/Production Environments**: Differences, scaling approach
- **CI/CD**: Build/test/deploy pipeline, versioning strategy
- **Monitoring & Logging**: Tools (Sentry, Datadog), log format
## 15. Testing
- **Unit Testing**: Tools (Jest, Mocha), coverage targets
- **Integration Testing**: API & DB tests
- **End-to-End (E2E) Testing**: Cypress, Playwright, test flows
- **Performance & Security Testing**: Load tests, automated scans
---
### Summary & Next Steps
- **Recap**: Key design choices and architectural patterns
- **Open Questions**: Any unresolved dependencies, features, or resource constraints
- **Future Enhancements**: Suggestions for iteration or expansions
# {Feature Name} Technical Specification (Existing Project)
## 1. High-Level Context
- **Existing System Recap**: Brief description of the project’s overall purpose
- **Where This Feature Fits**: Which modules or user flows it impacts
- **Key Integration Points**: Data sources, APIs, or shared services it relies on
## 2. Adhering to Existing Conventions
- **File Structure & Naming**: Follow the current repository layout (e.g., `/server/api`, `/client/components`)
- **Styling & Theming**: Align with existing design system (colors, typography, spacing)
- **Coding Standards**: Language style guides, linting, or frameworks already in use
## 3. Feature Specification
### 3.1 Feature Name
- **User Story & Requirements**: Specific functionality or user journey
- **Implementation Details**: Outline of how this integrates into existing code
- **Edge Cases & Error Handling**: Additional or changed logic for unexpected inputs
- **UI/UX Changes**: New screens or modifications to existing components
*(Repeat or subdivide for multiple related sub-features if needed.)*
## 4. Database Schema (Updates or New Tables)
### 4.1 Tables / Fields
- **Modified Entities**: Additional columns, changed constraints
- **New Tables**: If the feature requires entirely new entities
- **Migration Strategy**: How to roll out changes without disrupting existing data
## 5. Server Actions
### 5.1 Database Actions
- **New or Updated CRUD Ops**: Summaries of how data is created, read, updated, deleted
- **Impact on Existing Data Models**: Note any relationships with existing tables
- **Queries or Stored Procedures**: If relevant, show code snippets or references
### 5.2 Other Backend Logic
- **External API Calls**: If we add or modify integrations
- **File Handling**: Uploading, processing, or storing new file types
- **Background Jobs**: Any scheduled tasks relevant to the feature
## 6. Design System (Adjustments or Extensions)
### 6.1 Visual Style
- **Alignment with Current Theme**: Use existing color palette, typography
- **Additional Icons or Elements**: If the feature needs new icons, states, or patterns
### 6.2 UI Components
- **New Components**: Reusable parts introduced by this feature
- **Modifications to Existing Components**: Updated props, styling, or logic
- **State & Validation Changes**: Additional checks, error messages, or dynamic updates
## 7. Component Architecture (New or Modified)
### 7.1 Server/Backend
- **Endpoints or Services**: Revised or newly added
- **Refactoring Needs**: If existing code must be reorganized
- **Data Models**: Updated or extended classes/interfaces
### 7.2 Client/Frontend
- **Updated State Management**: Additional store slices, new actions or reducers
- **Routing Changes**: New routes, guarded routes for the feature
- **Integration with Existing Hooks/HOCs**: Where and how the feature is injected
## 8. Authentication & Authorization
- **Adjustments to Existing Auth Flow**: New roles or permissions required?
- **Access Control**: Which users can use this feature, any restricted endpoints?
- **Session/Token Implications**: If token scopes or session data need changes
## 9. Data Flow
- **Revised Sequence Diagram**: Show how data moves for the new feature
- **Impacts on Global State**: If the feature modifies shared application state
- **Real-Time or Async Updates**: Changes to websockets, push notifications, or polling
## 10. Payment Integration (If Applicable)
- **Updates to Existing Payment Flows**: New products, pricing, or discount codes
- **Webhook Changes**: Handling refunds or subscription modifications
- **Security/Compliance**: If PCI or other guidelines are affected
## 11. Analytics Integration
- **New Events or Metrics**: Additional tracking for usage, conversions, or performance
- **Dashboards/Reports**: Where new metrics appear, how they’re accessed
- **Alignment with Existing Analytics**: Follow naming conventions, data schemas
## 12. Testing
- **Unit Tests**: New or updated tests focusing on changed logic
- **Integration Tests**: Checking how this feature interacts with existing modules
- **End-to-End Tests**: Confirm end-user scenarios using e.g. Cypress, Playwright
- **Backward Compatibility**: Ensuring existing features remain functional
---
### Summary & Next Steps
- **Recap**: How this feature enhances or modifies the existing system
- **Open Questions**: Dependencies, integration pitfalls, unresolved decisions
- **Deployment Considerations**: Any phased rollout, feature flagging, or scheduled release
<project_request>
PawPursuit (working title)
A browser-based Three.js “motion lure” that auto-starts on page load, runs silently and full-screen on a tablet or TV, and continuously displays high-contrast, fast/erratic motion patterns to keep a cat visually occupied while the human eats. No user input, UI, or telemetry—just endless dark-background visuals until the tab/app is closed.
- Human operator: Wants zero-setup distraction—open URL, walk away.
- Cat viewer: Attracted to quick, unpredictable movement and contrast; loses interest if patterns repeat too long.
- Continuous animation of multiple “prey” archetypes (laser-dot streaks, fluttering moths, scurrying bugs, ribbon trails)
- Each archetype defined by a motion algorithm (random zigzags, bezier loops, sudden darts & pauses)
- Automatic mode cycling every N seconds/minutes to prevent habituation (value baked-in, e.g., 60–120s)
- Periodic “attention reset” events (brief particle bursts or color pulses) at randomized intervals
- Global difficulty scalars (speed, spawn count) wired but hardcoded (no exposed UI)
- Auto-enter (or request) full-screen on load; graceful fallback if denied
- Dark background only; palettes limited to high-contrast hues (neon greens/blues vs. dark)
- Completely silent—no audio assets, no WebAudio init
- Runs indefinitely until the page is closed or device sleeps
- Aim for 60fps on mid-range tablets; dynamic degradation (reduce particle count, lower resolution) if FPS drops
- Simple thermal/battery heuristic (time-based downgrades after X minutes)
- Avoid strobing (>3 flashes/sec) and extreme luminance shifts
- Three.js for rendering
- Vanilla JS modules; optional bundler (Vite/Rollup) for dev only
- PWA-capable for offline use (cache assets, manifest, service worker)
- Config values (mode durations, effect density) stored inline or in a JSON file; no persistence needed
- Hidden dev/debug toggle via URL param (
?debug=1
) to expose sliders in dev mode - Ambient “cool down” mode (slow drifting shapes) triggered after long runtime
- Lightweight theming system to add new modes via JSON
- Dark canvas with saturated motion trails; foreground elements never fully white
- No text or UI overlays during play
- Motion feels organic (ease-in/out, micro-pauses), not purely linear mathy paths
- No monetization, branding, or analytics—this is a quick example project.
- License unspecified; assume MIT/open-source unless changed later.
- QA scope minimal: test on Chrome (desktop), Safari iPadOS, and a smart-TV browser if available. </project_request>
- Core Purpose & Goals
A zero-interaction, browser-based visual “motion lure” for cats. Loads, enters (or requests) full-screen, and continuously renders erratic, high-contrast motion patterns on a dark background to maintain feline attention while the human eats. - Primary Use Cases
- Human opens URL on tablet/TV → animation auto-starts, runs indefinitely.
- (Dev only) Load with
?debug=1
to tweak parameters during development.
- High-Level Architecture
Pure client-side PWA:- Client: HTML shell + JavaScript modules using Three.js for WebGL rendering.
- Service Worker: Offline caching of static assets.
- No backend / database / telemetry.
\[HTML Shell] --> \[Bootstrap JS]
├─ Renderer (Three.js)
├─ Mode Manager
│ ├─ Motion Algorithms
│ └─ Attention Reset System
├─ Performance Governor
└─ PWA Service Worker
- Languages & Frameworks: ES2020+ JavaScript, Three.js.
- Libraries & Dependencies:
- Three.js (rendering)
- (Optional) GSAP or custom tween functions (only if needed)
- Database & ORM: None.
- DevOps & Hosting:
- Static hosting (e.g., GitHub Pages, Netlify, Cloudflare Pages).
- Optional Docker for local dev consistency.
- CI/CD Pipeline:
- GitHub Actions: lint, unit tests on push, deploy to Pages on main merge.
/public
index.html
manifest.webmanifest
sw\.js # service worker
assets/ # icons, splash screens if any
/src
main.js # entry, bootstrap
core/
renderer.js # Three.js init, resize logic
sceneFactory.js # Builds scene, camera, lights
performanceGovernor.js
fullscreen.js
config.js # constants (durations, counts)
modes/
index.js # Mode registry & manager
laserDot.js
flutterMoth.js
scurryBug.js
ribbonTrail.js
systems/
attentionReset.js
random.js # RNG utilities
mathUtil.js # bezier, easing, noise
debug/
debugOverlay.js # Only loaded with ?debug=1
/test
unit/
mathUtil.spec.js
performanceGovernor.spec.js
e2e/
autoplay.spec.js # e.g., Playwright
- Naming Conventions:
lowerCamelCase
for JS variables/functions,PascalCase
for classes. File names kebab-case or camelCase consistently (pick one). - Key Modules:
renderer.js
: abstracts Three.js boilerplate.modes/*
: independent motion archetypes implementing a shared interface.performanceGovernor.js
: monitors FPS/time, adjusts density.attentionReset.js
: triggers bursts/pulses.
- User Story & Requirements
- As a human, I open the page; it instantly displays moving prey-like visuals indefinitely, without any interaction.
- As a cat, I see rapidly moving targets with occasional bursts to renew interest.
- Implementation Details
ModeManager
cycles modes every 60–120s (hardcoded).- Each mode spawns entities implementing
update(deltaTime)
andrender()
hooks. - Randomized reset events via
AttentionResetSystem.trigger()
at pseudo-random intervals (e.g., 20–45s).
- Edge Cases & Error Handling
- WebGL context loss → try to recover or reload renderer.
- Full-screen API denied → still run in windowed mode.
- Low FPS (<30) → reduce spawn count, lower resolution (set
renderer.setPixelRatio
).
- UI/UX Considerations
- No visible UI in production mode.
- Avoid harsh flashes (>3 Hz). Use eased pulses instead.
- Requirements
- Auto-play on
DOMContentLoaded
. - Attempt
requestFullscreen()
. If fails, continue. - Silent—no audio engine initialization.
- Auto-play on
- Edge Cases
- Some TV browsers block fullscreen or autoplay requests; handle gracefully.
- Device sleeps—no prevention; human responsibility.
- Requirements
- Target ~60 FPS on mid-range tablets (A12/A13, Snapdragon mid-tier).
PerformanceGovernor
checks moving average FPS every 5 seconds:- If FPS < 45: reduce particle/entity counts by 25%.
- If still < 30: reduce renderer pixelRatio to 0.75, etc.
- Edge Cases
- Thermal throttling triggers low-FPS signals; degrade effects automatically.
- Requirements
?debug=1
query param loadsdebugOverlay.js
.- Overlay shows sliders for speed, spawnCount, modeDuration.
- Hidden in production build (tree-shaken or env-flagged).
- N/A – No persistent backend.
- Rationale: All settings are hardcoded or ephemeral; no user data.
- N/A
- External API Integrations: None.
- File/Media Handling: None—assets are procedural or prebundled textures.
- Background Jobs/Workers: None on server; optional Web Worker for heavy math could be future enhancement.
- Branding & Theme: Dark background (#000–#111). Saturated hues (greens/blues/neons) for foreground trails. Avoid pure white.
- Layout & Spacing: Full-bleed canvas; no DOM UI except hidden debug overlay.
- Accessibility:
- Avoid flicker >3 Hz.
- Provide meta tag or link to “safety note” (small text in HTML head or comments).
- Production: None.
- Debug: Simple sliders, toggles, numeric inputs (plain HTML/CSS).
- N/A
- Renderer (class): initializes WebGLRenderer, Scene, Camera; manages resize & render loop.
- ModeManager: holds array of mode definitions, switches mode on timeout.
- Mode Interface:
interface Mode { name: string; init(scene: THREE.Scene, config: ModeConfig): void; update(dt: number): void; dispose(): void; }
-
Prey Entity Interface:
interface PreyEntity { mesh: THREE.Object3D; update(dt: number): void; reset?(reason: ResetReason): void; }
-
PerformanceGovernor: monitors FPS, toggles flags or calls mode to adjust spawn counts.
-
AttentionResetSystem: ephemeral particle systems or color pulses layered over scene.
- N/A – Public, no user accounts.
- Request/Response Lifecycle: Initial GET of static files. No further network calls.
- State Sync: Internal JS state only; config constants loaded at boot.
- Real-Time Updates: Render loop (
requestAnimationFrame
) updates entities each frame.
Sequence (simplified):
window load -> bootstrap -> init Renderer -> ModeManager.init(firstMode)
-> renderLoop(dt):
Mode.update(dt)
Governor.checkFps()
Renderer.render(scene, camera)
-> setTimeout (mode switch)
-> randomInterval (attention reset)
- N/A
- N/A (explicitly declined)
- Encryption: HTTPS hosting recommended (PWA requires).
- Compliance: No personal data; minimal risk.
- Threat Modeling: Only surface is static hosting. Harden service worker against cache poisoning (versioned cache names).
- Secrets Management: None.
-
Local Setup
npm install
npm run dev
(Vite) → localhost:5173- Env var
DEBUG=1
for local debug.
-
Staging/Production
- Build:
npm run build
→/dist
static bundle. - Deploy: Push to main triggers GitHub Action → deploy to CDN/Pages.
- Build:
-
CI/CD
- Jobs:
lint
,test
,build
. - Cache node_modules for faster builds.
- Jobs:
-
Monitoring & Logging
- Browser console for dev. No runtime logs in prod (optional Sentry if crashes matter, but likely overkill).
-
Unit Testing
- Math & utility functions (bezier path gen, random ranges, FPS averaging).
- Jest or Vitest.
-
Integration Testing
- Ensure ModeManager switches modes, resets trigger correctly (mock timers).
-
End-to-End (E2E)
- Playwright/Puppeteer: open page, confirm canvas, verify RAF called, ensure no console errors.
- Visual regression (optional) using screenshot diffs for key frames.
-
Performance & Security Testing
- Manual FPS checks on target devices.
- Lighthouse for PWA compliance & basic performance (though it’s WebGL-heavy).
Recap
- Client-only, Three.js-based, auto-playing visual toy.
- Core modules: Renderer, ModeManager, Motion modes, Attention Reset, Performance Governor.
- No UI, no analytics, no backend. PWA enabled for offline.
- Safety: avoid strobe, auto-degrade performance.
Open Questions
- License (MIT assumed) — confirm.
- Minimum device/browser support list? (Chrome ≥ 90, Safari iPadOS 15+, Samsung Internet?)
- Do we want a fallback 2D canvas mode for non-WebGL browsers?
- Maximum runtime to trigger “cool down” mode or just loop forever?
Future Enhancements
- Web Worker for heavy path calculations.
- Additional mode packs (seasonal, themed).
- Optional audio cues (if ever desired).
- Remote control micro-site (if you later want controls on a phone while TV runs visuals).
Your task is to create a comprehensive, step-by-step implementation plan for building a fully functional web application based on provided input documents. The plan should be detailed enough for a code-generation AI to execute each step sequentially.
- PROJECT_REQUEST: An overview of the project requirements or user request.
- PROJECT_RULES: Any specific rules, guidelines, or best practices to follow.
- TECHNICAL_SPECIFICATION: A thorough technical spec outlining architecture, data flows, features, etc.
- REFERENCE_CODE: Any initial code or directory structure templates that should be referenced or expanded.
In each exchange, you will:
- Analyze the provided inputs to understand the scope and requirements of the project.
- Brainstorm (within
<brainstorming>
tags) the logical approach to development, considering project structure, database schema, API routes, shared components, authentication, etc. - Construct an itemized, ordered list of implementation steps, each sufficiently granular and self-contained.
- Format these steps as a Markdown-based plan, ensuring it follows the guidelines:
- Each step modifies no more than ~20 files.
- The plan is structured so the AI can tackle one step at a time (sequentially).
- Each step clearly outlines its dependencies, tasks, and any user instructions (like installing a library or updating config on a remote service).
Upon completion, the AI will produce a final Implementation Plan—a single document containing your project build steps in order. This plan should cover everything from initial project setup to final testing.
- Review Inputs: The AI reads
<project_request>
,<project_rules>
,<technical_specification>
, and<reference_code>
to form a complete understanding of the project. - Brainstorm: Within
<brainstorming>
tags, the AI considers:- Core structure and essential configurations.
- Database schema, server actions, and API routes.
- Shared components, layouts, and feature pages.
- Authentication, authorization, and third-party service integrations.
- Client-side interactivity and state management.
- Testing strategy and error handling.
- Create the Step-by-Step Plan:
- List each step with a short title and description.
- Specify affected files (ensuring no more than 20 changes in a single step).
- Indicate step dependencies (if any).
- Highlight any user instructions for manual tasks.
- Finalize the Plan: The AI returns the complete plan under a
# Implementation Plan
heading, with each major section labeled (e.g., “## [Section Name]”) and the sub-steps in a checklist format.
Below is an example of the Implementation Plan structure you should produce once the brainstorming is complete:
# Implementation Plan
## [Section Name]
- [ ] Step 1: [Brief title]
- **Task**: [Detailed explanation of what needs to be implemented]
- **Files**: [Up to 20 files, ideally less]
- `path/to/file1.ts`: [Description of changes]
- ...
- **Step Dependencies**: [e.g., "None" or "Step 2"]
- **User Instructions**: [Any manual tasks the user must perform]
[Additional steps... up to final deployment and testing]
After listing all steps, provide a brief summary of your overall approach and key considerations (e.g., major dependencies, potential complexities, or recommended best practices).
<technical_specification> [removed] </technical_specification>
<project_request> [removed] </project_request>
Keep each step ≤20 files by grouping logically (e.g., one step = create base folders + minimal files). Later steps add one mode per step to spread changes.
We’ll scaffold config first, then core engine, then systems, then modes, then polish (governor, resets), then PWA, tests, CI, deploy.
We’ll add “User Instructions” where manual (e.g., set GitHub Pages). We’ll note dependencies.
We’ll ensure each step mentions exact files.
-
Step 0.1: Create repo & baseline tooling
-
Task: Init Git repo, Node project, add Vite, ESLint/Prettier, basic scripts.
-
Files:
package.json
: init, add scripts (dev
,build
,preview
,test
,lint
).gitignore
: node_modules, distvite.config.js
: basic ES module build.eslintrc.cjs
,.prettierrc
: lint/format configREADME.md
: quick start commands
-
Step Dependencies: None
-
User Instructions:
git init && npm init -y && npm i three vite vitest @vitest/ui eslint prettier
-
-
Step 1.1: Public assets & HTML shell
-
Task: Add minimal HTML with canvas container, meta tags, dark theme; add manifest + icons; stub service worker.
-
Files:
public/index.html
: root,<canvas id="app">
placeholder, meta “safety note”public/manifest.webmanifest
: name, icons, theme_colorpublic/sw.js
: empty install/activate listeners with versioned cache name constantpublic/assets/icon-512.png
,public/assets/icon-192.png
(placeholders)
-
Step Dependencies: Step 0.1
-
User Instructions: Provide/replace real icons later.
-
-
Step 2.1: Create src layout & bootstrap entry
-
Task: Create folder tree and minimal boot code to start RAF loop.
-
Files:
src/main.js
: entry; imports renderer, modeManager (stub), fullscreen attemptsrc/core/renderer.js
: init Three.js renderer, scene, camera, resize handlersrc/core/sceneFactory.js
: build scene/camera defaultssrc/core/fullscreen.js
: helper to request fullscreen gracefullysrc/core/config.js
: constants (modeDuration, resetIntervals, etc.)src/modes/index.js
: exportsModeManager
stubsrc/systems/random.js
: RNG utilities stub
-
Step Dependencies: Step 1.1
-
User Instructions: None
-
-
Step 3.1: Implement render loop & delta calc
-
Task: Add RAF loop, dt calc, call current mode.update, renderer.render; error guard for WebGL loss.
-
Files:
src/core/renderer.js
: addstartLoop()
methodsrc/main.js
: wire loop start, try/catch around rendersrc/modes/index.js
: exposegetCurrentModeUpdate()
-
Step Dependencies: Step 2.1
-
User Instructions: None
-
-
Step 4.1: Define Mode & PreyEntity interfaces
-
Task: Create JS doc typedefs or TS-like comments; implement base class/helpers.
-
Files:
src/modes/types.d.ts
(or.js
with JSDoc):Mode
,PreyEntity
,ModeConfig
src/modes/baseMode.js
: utility parent with common init/dispose
-
Step Dependencies: Step 3.1
-
User Instructions: None
-
-
Step 4.2: Implement
laserDot
mode-
Task: Single moving dot with zigzag behavior.
-
Files:
src/modes/laserDot.js
src/systems/mathUtil.js
: bezier/zigzag helpers
-
Step Dependencies: Step 4.1
-
User Instructions: None
-
-
Step 5.1: ModeManager implementation
-
Task: Load array of modes, switch on timer; dispose old, init new.
-
Files:
src/modes/index.js
: full manager (init, update, switchMode)src/core/config.js
: addMODE_DURATION_MS = 90000
(example)
-
Step Dependencies: Step 4.2
-
User Instructions: None
-
-
Step 6.1: Flutter Moth Mode
-
Task: Entities with erratic fluttering (noise-based paths).
-
Files:
src/modes/flutterMoth.js
src/systems/mathUtil.js
: add perlin/simplex noise or pseudo-noise func
-
Step Dependencies: Step 5.1
-
User Instructions: None
-
-
Step 6.2: Scurry Bug Mode
-
Task: Short darting bursts with pauses.
-
Files:
src/modes/scurryBug.js
-
Step Dependencies: Step 6.1
-
User Instructions: None
-
-
Step 6.3: Ribbon Trail Mode
-
Task: Trail-rendered ribbons (line segments or tube geometry).
-
Files:
src/modes/ribbonTrail.js
-
Step Dependencies: Step 6.2
-
User Instructions: None
-
-
Step 7.1: Particle/Color Pulse System
-
Task: Implement
AttentionResetSystem
that spawns transient particles or screen tint pulse. -
Files:
src/systems/attentionReset.js
src/core/config.js
: add reset interval constants (min/max secs)- (Optional)
src/systems/particles.js
: simple particle group helper
-
Step Dependencies: Step 6.3
-
User Instructions: None
-
-
Step 8.1: FPS monitor & adaptive degradation
-
Task: Moving average FPS; adjust spawn counts/pixelRatio.
-
Files:
src/core/performanceGovernor.js
src/core/renderer.js
: exposesetPixelRatio
src/modes/index.js
: allow ModeManager to forward “degrade” signals to modes
-
Step Dependencies: Step 7.1
-
User Instructions: None
-
-
Step 9.1: Auto-start & fullscreen request logic
-
Task: On
DOMContentLoaded
, request fullscreen, start visuals; fall back gracefully. -
Files:
src/main.js
: finalize startup orchestrationsrc/core/fullscreen.js
: handle various browser APIs
-
Step Dependencies: Step 8.1
-
User Instructions: Test on target tablet/TV browsers.
-
-
Step 10.1: Debug overlay gated by
?debug=1
-
Task: Create simple DOM overlay with sliders; only load when flag present.
-
Files:
src/debug/debugOverlay.js
src/main.js
: conditional importsrc/core/config.js
: expose config mutators in debug mode
-
Step Dependencies: Step 9.1
-
User Instructions: Access via
http://localhost:5173/?debug=1
-
-
Step 11.1: Service worker cache & offline
-
Task: Implement install/activate/fetch handlers; precache core assets; versioning.
-
Files:
public/sw.js
: full cache logicpublic/manifest.webmanifest
: confirm scope/start_urlsrc/main.js
: register SW (navigator.serviceWorker.register)
-
Step Dependencies: Step 9.1
-
User Instructions: In Chrome dev tools, “Application” tab → verify PWA installability.
-
-
Step 12.1: Unit test framework
-
Task: Configure Vitest/Jest; write initial mathUtil + governor tests.
-
Files:
vitest.config.js
orjest.config.cjs
test/unit/mathUtil.spec.js
test/unit/performanceGovernor.spec.js
-
Step Dependencies: Step 8.1
-
User Instructions:
npm run test:unit
-
-
Step 12.2: E2E smoke test
-
Task: Add Playwright; open page, verify canvas, no errors.
-
Files:
playwright.config.ts
test/e2e/autoplay.spec.ts
-
Step Dependencies: Step 9.1
-
User Instructions:
npx playwright install && npm run test:e2e
-
-
Step 13.1: GitHub Actions workflow
-
Task: Add workflow to lint, test, build; deploy to Pages/Netlify.
-
Files:
.github/workflows/ci.yml
: run lint/test/build- (If GitHub Pages)
.github/workflows/deploy.yml
: deploy dist
-
Step Dependencies: Steps 12.1 & 12.2
-
User Instructions: Configure repo secrets if using Netlify/Cloudflare; for Pages, enable it in repo settings.
-
-
Step 14.1: Manual device tests & tweaks
-
Task: Test on iPad Safari, Android Chrome, TV browser; adjust constants.
-
Files:
src/core/config.js
: tweak defaults- Possibly minor fixes across mode files (<5 files)
-
Step Dependencies: Step 11.1
-
User Instructions: Manually test on actual hardware, record FPS/perceived engagement.
-
-
Step 15.1: Finalize README & LICENSE
-
Task: Document usage, dev/debug flags, build steps; add MIT license.
-
Files:
README.md
: production instructions + dev docsLICENSE
(MIT)
-
Step Dependencies: Step 14.1
-
User Instructions: None
-
We scaffold a Vite-based pure JS project, implement a modular Three.js engine with a mode system, attention resets, and a performance governor. We ensure autoplay + fullscreen with no UI, only an optional debug overlay. PWA caching provides offline capability. Testing (unit & E2E) and CI/CD are integrated. Each step is isolated to ≤20 files and sequenced logically for codegen automation.
Key complexities: performant motion algorithms, adaptive degradation, and ensuring fullscreen/autoplay across diverse browsers. Keep constants tweakable and avoid strobing. Future enhancements (workers, extra modes) can slot in after Step 6 without architectural changes.
follow the plan below and make my game!
- Core Purpose & Goals
A zero-interaction, browser-based visual “motion lure” for cats. Loads, enters (or requests) full-screen, and continuously renders erratic, high-contrast motion patterns on a dark background to maintain feline attention while the human eats. - Primary Use Cases
- Human opens URL on tablet/TV → animation auto-starts, runs indefinitely.
- (Dev only) Load with
?debug=1
to tweak parameters during development.
- High-Level Architecture
Pure client-side PWA:- Client: HTML shell + JavaScript modules using Three.js for WebGL rendering.
- Service Worker: Offline caching of static assets.
- No backend / database / telemetry.
\[HTML Shell] --> \[Bootstrap JS]
├─ Renderer (Three.js)
├─ Mode Manager
│ ├─ Motion Algorithms
│ └─ Attention Reset System
├─ Performance Governor
└─ PWA Service Worker
- Languages & Frameworks: ES2020+ JavaScript, Three.js.
- Libraries & Dependencies:
- Three.js (rendering)
- (Optional) GSAP or custom tween functions (only if needed)
- Database & ORM: None.
- DevOps & Hosting:
- Static hosting (e.g., GitHub Pages, Netlify, Cloudflare Pages).
- Optional Docker for local dev consistency.
- CI/CD Pipeline:
- GitHub Actions: lint, unit tests on push, deploy to Pages on main merge.
/public
index.html
manifest.webmanifest
sw\.js # service worker
assets/ # icons, splash screens if any
/src
main.js # entry, bootstrap
core/
renderer.js # Three.js init, resize logic
sceneFactory.js # Builds scene, camera, lights
performanceGovernor.js
fullscreen.js
config.js # constants (durations, counts)
modes/
index.js # Mode registry & manager
laserDot.js
flutterMoth.js
scurryBug.js
ribbonTrail.js
systems/
attentionReset.js
random.js # RNG utilities
mathUtil.js # bezier, easing, noise
debug/
debugOverlay.js # Only loaded with ?debug=1
/test
unit/
mathUtil.spec.js
performanceGovernor.spec.js
e2e/
autoplay.spec.js # e.g., Playwright
- Naming Conventions:
lowerCamelCase
for JS variables/functions,PascalCase
for classes. File names kebab-case or camelCase consistently (pick one). - Key Modules:
renderer.js
: abstracts Three.js boilerplate.modes/*
: independent motion archetypes implementing a shared interface.performanceGovernor.js
: monitors FPS/time, adjusts density.attentionReset.js
: triggers bursts/pulses.
- User Story & Requirements
- As a human, I open the page; it instantly displays moving prey-like visuals indefinitely, without any interaction.
- As a cat, I see rapidly moving targets with occasional bursts to renew interest.
- Implementation Details
ModeManager
cycles modes every 60–120s (hardcoded).- Each mode spawns entities implementing
update(deltaTime)
andrender()
hooks. - Randomized reset events via
AttentionResetSystem.trigger()
at pseudo-random intervals (e.g., 20–45s).
- Edge Cases & Error Handling
- WebGL context loss → try to recover or reload renderer.
- Full-screen API denied → still run in windowed mode.
- Low FPS (<30) → reduce spawn count, lower resolution (set
renderer.setPixelRatio
).
- UI/UX Considerations
- No visible UI in production mode.
- Avoid harsh flashes (>3 Hz). Use eased pulses instead.
- Requirements
- Auto-play on
DOMContentLoaded
. - Attempt
requestFullscreen()
. If fails, continue. - Silent—no audio engine initialization.
- Auto-play on
- Edge Cases
- Some TV browsers block fullscreen or autoplay requests; handle gracefully.
- Device sleeps—no prevention; human responsibility.
- Requirements
- Target ~60 FPS on mid-range tablets (A12/A13, Snapdragon mid-tier).
PerformanceGovernor
checks moving average FPS every 5 seconds:- If FPS < 45: reduce particle/entity counts by 25%.
- If still < 30: reduce renderer pixelRatio to 0.75, etc.
- Edge Cases
- Thermal throttling triggers low-FPS signals; degrade effects automatically.
- Requirements
?debug=1
query param loadsdebugOverlay.js
.- Overlay shows sliders for speed, spawnCount, modeDuration.
- Hidden in production build (tree-shaken or env-flagged).
- N/A – No persistent backend.
- Rationale: All settings are hardcoded or ephemeral; no user data.
- N/A
- External API Integrations: None.
- File/Media Handling: None—assets are procedural or prebundled textures.
- Background Jobs/Workers: None on server; optional Web Worker for heavy math could be future enhancement.
- Branding & Theme: Dark background (#000–#111). Saturated hues (greens/blues/neons) for foreground trails. Avoid pure white.
- Layout & Spacing: Full-bleed canvas; no DOM UI except hidden debug overlay.
- Accessibility:
- Avoid flicker >3 Hz.
- Provide meta tag or link to “safety note” (small text in HTML head or comments).
- Production: None.
- Debug: Simple sliders, toggles, numeric inputs (plain HTML/CSS).
- N/A
- Renderer (class): initializes WebGLRenderer, Scene, Camera; manages resize & render loop.
- ModeManager: holds array of mode definitions, switches mode on timeout.
- Mode Interface:
interface Mode { name: string; init(scene: THREE.Scene, config: ModeConfig): void; update(dt: number): void; dispose(): void; }
-
Prey Entity Interface:
interface PreyEntity { mesh: THREE.Object3D; update(dt: number): void; reset?(reason: ResetReason): void; }
-
PerformanceGovernor: monitors FPS, toggles flags or calls mode to adjust spawn counts.
-
AttentionResetSystem: ephemeral particle systems or color pulses layered over scene.
- N/A – Public, no user accounts.
- Request/Response Lifecycle: Initial GET of static files. No further network calls.
- State Sync: Internal JS state only; config constants loaded at boot.
- Real-Time Updates: Render loop (
requestAnimationFrame
) updates entities each frame.
Sequence (simplified):
window load -> bootstrap -> init Renderer -> ModeManager.init(firstMode)
-> renderLoop(dt):
Mode.update(dt)
Governor.checkFps()
Renderer.render(scene, camera)
-> setTimeout (mode switch)
-> randomInterval (attention reset)
- N/A
- N/A (explicitly declined)
- Encryption: HTTPS hosting recommended (PWA requires).
- Compliance: No personal data; minimal risk.
- Threat Modeling: Only surface is static hosting. Harden service worker against cache poisoning (versioned cache names).
- Secrets Management: None.
-
Local Setup
npm install
npm run dev
(Vite) → localhost:5173- Env var
DEBUG=1
for local debug.
-
Staging/Production
- Build:
npm run build
→/dist
static bundle. - Deploy: Push to main triggers GitHub Action → deploy to CDN/Pages.
- Build:
-
CI/CD
- Jobs:
lint
,test
,build
. - Cache node_modules for faster builds.
- Jobs:
-
Monitoring & Logging
- Browser console for dev. No runtime logs in prod (optional Sentry if crashes matter, but likely overkill).
-
Unit Testing
- Math & utility functions (bezier path gen, random ranges, FPS averaging).
- Jest or Vitest.
-
Integration Testing
- Ensure ModeManager switches modes, resets trigger correctly (mock timers).
-
End-to-End (E2E)
- Playwright/Puppeteer: open page, confirm canvas, verify RAF called, ensure no console errors.
- Visual regression (optional) using screenshot diffs for key frames.
-
Performance & Security Testing
- Manual FPS checks on target devices.
- Lighthouse for PWA compliance & basic performance (though it’s WebGL-heavy).
Recap
- Client-only, Three.js-based, auto-playing visual toy.
- Core modules: Renderer, ModeManager, Motion modes, Attention Reset, Performance Governor.
- No UI, no analytics, no backend. PWA enabled for offline.
- Safety: avoid strobe, auto-degrade performance.
Open Questions
- License (MIT assumed) — confirm.
- Minimum device/browser support list? (Chrome ≥ 90, Safari iPadOS 15+, Samsung Internet?)
- Do we want a fallback 2D canvas mode for non-WebGL browsers?
- Maximum runtime to trigger “cool down” mode or just loop forever?
Future Enhancements
- Web Worker for heavy path calculations.
- Additional mode packs (seasonal, themed).
- Optional audio cues (if ever desired).
- Remote control micro-site (if you later want controls on a phone while TV runs visuals).
Single-page PWA, no backend. Core chunks: toolchain (Vite), Three.js bootstrapping, renderer wrapper, mode system, attention reset, performance governor, fullscreen + startup, PWA (manifest + SW), optional debug overlay, testing (unit + e2e), CI/CD.
Keep each step ≤20 files by grouping logically (e.g., one step = create base folders + minimal files). Later steps add one mode per step to spread changes.
We’ll scaffold config first, then core engine, then systems, then modes, then polish (governor, resets), then PWA, tests, CI, deploy.
We’ll add “User Instructions” where manual (e.g., set GitHub Pages). We’ll note dependencies.
We’ll ensure each step mentions exact files.
-
Step 0.1: Create repo & baseline tooling
-
Task: Init Git repo, Node project, add Vite, ESLint/Prettier, basic scripts.
-
Files:
package.json
: init, add scripts (dev
,build
,preview
,test
,lint
).gitignore
: node_modules, distvite.config.js
: basic ES module build.eslintrc.cjs
,.prettierrc
: lint/format configREADME.md
: quick start commands
-
Step Dependencies: None
-
User Instructions:
git init && npm init -y && npm i three vite vitest @vitest/ui eslint prettier
-
-
Step 1.1: Public assets & HTML shell
-
Task: Add minimal HTML with canvas container, meta tags, dark theme; add manifest + icons; stub service worker.
-
Files:
public/index.html
: root,<canvas id="app">
placeholder, meta “safety note”public/manifest.webmanifest
: name, icons, theme_colorpublic/sw.js
: empty install/activate listeners with versioned cache name constantpublic/assets/icon-512.png
,public/assets/icon-192.png
(placeholders)
-
Step Dependencies: Step 0.1
-
User Instructions: Provide/replace real icons later.
-
-
Step 2.1: Create src layout & bootstrap entry
-
Task: Create folder tree and minimal boot code to start RAF loop.
-
Files:
src/main.js
: entry; imports renderer, modeManager (stub), fullscreen attemptsrc/core/renderer.js
: init Three.js renderer, scene, camera, resize handlersrc/core/sceneFactory.js
: build scene/camera defaultssrc/core/fullscreen.js
: helper to request fullscreen gracefullysrc/core/config.js
: constants (modeDuration, resetIntervals, etc.)src/modes/index.js
: exportsModeManager
stubsrc/systems/random.js
: RNG utilities stub
-
Step Dependencies: Step 1.1
-
User Instructions: None
-
-
Step 3.1: Implement render loop & delta calc
-
Task: Add RAF loop, dt calc, call current mode.update, renderer.render; error guard for WebGL loss.
-
Files:
src/core/renderer.js
: addstartLoop()
methodsrc/main.js
: wire loop start, try/catch around rendersrc/modes/index.js
: exposegetCurrentModeUpdate()
-
Step Dependencies: Step 2.1
-
User Instructions: None
-
-
Step 4.1: Define Mode & PreyEntity interfaces
-
Task: Create JS doc typedefs or TS-like comments; implement base class/helpers.
-
Files:
src/modes/types.d.ts
(or.js
with JSDoc):Mode
,PreyEntity
,ModeConfig
src/modes/baseMode.js
: utility parent with common init/dispose
-
Step Dependencies: Step 3.1
-
User Instructions: None
-
-
Step 4.2: Implement
laserDot
mode-
Task: Single moving dot with zigzag behavior.
-
Files:
src/modes/laserDot.js
src/systems/mathUtil.js
: bezier/zigzag helpers
-
Step Dependencies: Step 4.1
-
User Instructions: None
-
-
Step 5.1: ModeManager implementation
-
Task: Load array of modes, switch on timer; dispose old, init new.
-
Files:
src/modes/index.js
: full manager (init, update, switchMode)src/core/config.js
: addMODE_DURATION_MS = 90000
(example)
-
Step Dependencies: Step 4.2
-
User Instructions: None
-
-
Step 6.1: Flutter Moth Mode
-
Task: Entities with erratic fluttering (noise-based paths).
-
Files:
src/modes/flutterMoth.js
src/systems/mathUtil.js
: add perlin/simplex noise or pseudo-noise func
-
Step Dependencies: Step 5.1
-
User Instructions: None
-
-
Step 6.2: Scurry Bug Mode
-
Task: Short darting bursts with pauses.
-
Files:
src/modes/scurryBug.js
-
Step Dependencies: Step 6.1
-
User Instructions: None
-
-
Step 6.3: Ribbon Trail Mode
-
Task: Trail-rendered ribbons (line segments or tube geometry).
-
Files:
src/modes/ribbonTrail.js
-
Step Dependencies: Step 6.2
-
User Instructions: None
-
-
Step 7.1: Particle/Color Pulse System
-
Task: Implement
AttentionResetSystem
that spawns transient particles or screen tint pulse. -
Files:
src/systems/attentionReset.js
src/core/config.js
: add reset interval constants (min/max secs)- (Optional)
src/systems/particles.js
: simple particle group helper
-
Step Dependencies: Step 6.3
-
User Instructions: None
-
-
Step 8.1: FPS monitor & adaptive degradation
-
Task: Moving average FPS; adjust spawn counts/pixelRatio.
-
Files:
src/core/performanceGovernor.js
src/core/renderer.js
: exposesetPixelRatio
src/modes/index.js
: allow ModeManager to forward “degrade” signals to modes
-
Step Dependencies: Step 7.1
-
User Instructions: None
-
-
Step 9.1: Auto-start & fullscreen request logic
-
Task: On
DOMContentLoaded
, request fullscreen, start visuals; fall back gracefully. -
Files:
src/main.js
: finalize startup orchestrationsrc/core/fullscreen.js
: handle various browser APIs
-
Step Dependencies: Step 8.1
-
User Instructions: Test on target tablet/TV browsers.
-
-
Step 10.1: Debug overlay gated by
?debug=1
-
Task: Create simple DOM overlay with sliders; only load when flag present.
-
Files:
src/debug/debugOverlay.js
src/main.js
: conditional importsrc/core/config.js
: expose config mutators in debug mode
-
Step Dependencies: Step 9.1
-
User Instructions: Access via
http://localhost:5173/?debug=1
-
-
Step 11.1: Service worker cache & offline
-
Task: Implement install/activate/fetch handlers; precache core assets; versioning.
-
Files:
public/sw.js
: full cache logicpublic/manifest.webmanifest
: confirm scope/start_urlsrc/main.js
: register SW (navigator.serviceWorker.register)
-
Step Dependencies: Step 9.1
-
User Instructions: In Chrome dev tools, “Application” tab → verify PWA installability.
-
-
Step 12.1: Unit test framework
-
Task: Configure Vitest/Jest; write initial mathUtil + governor tests.
-
Files:
vitest.config.js
orjest.config.cjs
test/unit/mathUtil.spec.js
test/unit/performanceGovernor.spec.js
-
Step Dependencies: Step 8.1
-
User Instructions:
npm run test:unit
-
-
Step 12.2: E2E smoke test
-
Task: Add Playwright; open page, verify canvas, no errors.
-
Files:
playwright.config.ts
test/e2e/autoplay.spec.ts
-
Step Dependencies: Step 9.1
-
User Instructions:
npx playwright install && npm run test:e2e
-
-
Step 13.1: GitHub Actions workflow
-
Task: Add workflow to lint, test, build; deploy to Pages/Netlify.
-
Files:
.github/workflows/ci.yml
: run lint/test/build- (If GitHub Pages)
.github/workflows/deploy.yml
: deploy dist
-
Step Dependencies: Steps 12.1 & 12.2
-
User Instructions: Configure repo secrets if using Netlify/Cloudflare; for Pages, enable it in repo settings.
-
-
Step 14.1: Manual device tests & tweaks
-
Task: Test on iPad Safari, Android Chrome, TV browser; adjust constants.
-
Files:
src/core/config.js
: tweak defaults- Possibly minor fixes across mode files (<5 files)
-
Step Dependencies: Step 11.1
-
User Instructions: Manually test on actual hardware, record FPS/perceived engagement.
-
-
Step 15.1: Finalize README & LICENSE
-
Task: Document usage, dev/debug flags, build steps; add MIT license.
-
Files:
README.md
: production instructions + dev docsLICENSE
(MIT)
-
Step Dependencies: Step 14.1
-
User Instructions: None
-
We scaffold a Vite-based pure JS project, implement a modular Three.js engine with a mode system, attention resets, and a performance governor. We ensure autoplay + fullscreen with no UI, only an optional debug overlay. PWA caching provides offline capability. Testing (unit & E2E) and CI/CD are integrated. Each step is isolated to ≤20 files and sequenced logically for codegen automation.
Key complexities: performant motion algorithms, adaptive degradation, and ensuring fullscreen/autoplay across diverse browsers. Keep constants tweakable and avoid strobing. Future enhancements (workers, extra modes) can slot in after Step 6 without architectural changes.