Scratch Copilot AI is a powerful Chrome extension that acts as an intelligent assistant for the Scratch editor. It empowers users to create, modify, and control their Scratch projects using natural language through an integrated Gemini AI chat interface.
- Expert Level Coding: Generates code based on the "Griffpatch Manifesto"—enforcing single-script architectures, high-performance game loops, and velocity-based physics.
- Advanced Extension Support: Built-in support for Face Sensing, Video Sensing, Pen, Music, and more with verified opcode mapping.
- Smart VM Control: Real-time control of the Scratch VM, including green flag triggers, variable setting, and sprite manipulation.
- Project Inspection: Quickly summarize your current Scratch project state.
- Modern UI: Sleek, dark-themed, and responsive interface with an easy-to-access 🤖 launcher.
- Clone this repository to your local machine.
- Open Chrome and navigate to
chrome://extensions/. - Enable Developer mode in the top-right corner.
- Click Load unpacked and select the directory containing these files.
- Open any Scratch project in the Scratch Editor.
- Click the 🤖 floating button in the bottom-right corner.
- Configure your Gemini API Key in the extension settings panel.
- Start chatting with the AI to begin building your games!
The extension follows a modular architecture with all source files organized in the src/ directory:
src/aiClient.js: Integrates with Google's Gemini API to process prompts and output Scratch-compatible JSON.src/vmController.js: Interfaces directly with the Scratch VM instance to perform actions like creating sprites, adding costumes, and injecting block scripts.src/ui.js: Manages the visual components, chat interface, and user interactions.src/content.js: Handles the injection of the extension's scripts into the Scratch editor's main execution context.src/vmHook.js: Establishes and manages connections to the Scratch VM.src/assetManager.js: Handles sprite, costume, sound, and backdrop asset management.src/blockBuilder.js: Constructs and validates Scratch block structures.src/spriteController.js: Controls sprite-specific operations and properties.src/variableManager.js: Manages variables and broadcasts across the project.src/extensionLoader.js: Loads and registers required Scratch extensions.src/projectSerializer.js: Serializes and deserializes project state for persistence.src/debugPanel.js: Provides debugging utilities and logging for development.src/logger.js: Centralized logging system for the extension.
This project is licensed under the MIT License - see the LICENSE file for details.
