| commit | b379592340a40c4c22ac1a52be4d2e612a9aa4f4 | [log] [tgz] |
|---|---|---|
| author | Sean McCullough <banksean@gmail.com> | Fri Jun 27 01:59:41 2025 +0000 |
| committer | Autoformatter <bot@sketch.dev> | Fri Jun 27 02:04:42 2025 +0000 |
| tree | 37d9ce08602651cc11b0b1bc2f46ebdd6907fc6a | |
| parent | 659b98361783ad139412ea2a0bc62c8ed25c292e [diff] |
webui: convert sketch-call-status and sketch-chat-input to SketchTailwindElement with comprehensive demo support Convert both sketch-call-status and sketch-chat-input components from shadow DOM CSS to Tailwind classes while maintaining test compatibility and adding comprehensive demo infrastructure. Problems Solved: Shadow DOM Styling Limitations: - Both components used CSS-in-JS with shadow DOM preventing Tailwind integration - Large static styles blocks with custom CSS duplicated Tailwind functionality - Components couldn't benefit from design system consistency - Difficult to maintain custom CSS alongside Tailwind-based components Missing Demo Infrastructure: - sketch-call-status had no demo fixtures for testing component states - sketch-chat-input needed dedicated demo fixture following naming convention - Components not properly integrated into demo runner system Test Compatibility Issues: - Conversion to Tailwind required updating shadow DOM selectors - renderRoot.querySelector calls needed conversion to direct querySelector - Component tests needed updating for non-shadow DOM structure Solution Implementation: Tailwind CSS Conversion - sketch-call-status: - Changed sketch-call-status to inherit from SketchTailwindElement - Replaced CSS-in-JS styles with Tailwind utility classes and inline animations - Converted animations using @keyframes in inline <style> tag - Maintained exact visual appearance while using Tailwind classes Tailwind CSS Conversion - sketch-chat-input: - Changed sketch-chat-input to inherit from SketchTailwindElement - Replaced extensive static styles CSS block with Tailwind utility classes - Converted complex chat container, input wrapper, and button styling - Added custom fade-in animation to tailwind.config.js with keyframes Key Tailwind Class Mappings: - Call status indicators: bg-yellow-100 text-amber-500 (active), text-gray-400 (idle) - Status banners: bg-green-50 text-green-700 (idle), bg-orange-50 text-orange-600 (working) - Chat container: w-full bg-gray-100 p-4 min-h-[40px] relative - Chat input: flex-1 p-3 border border-gray-300 rounded resize-y font-mono - Send button: bg-blue-500 hover:bg-blue-600 disabled:bg-gray-400 Shadow DOM to Light DOM Conversion: - Removed static styles properties completely - Updated all renderRoot.querySelector calls to direct querySelector calls - Changed shadow DOM event handler setup to work with light DOM - Maintained all drag-and-drop and event handling functionality Test Compatibility Maintenance: - Added semantic CSS classes back to elements for test selectors - Updated sketch-chat-input.test.ts to use querySelector instead of renderRoot.querySelector - Fixed drag event simulation to work with light DOM structure - All existing tests continue to pass with updated selectors Demo Infrastructure Implementation: - Created call-status.ts demo fixtures with CallStatusState interface - Added comprehensive sketch-call-status.demo.ts with interactive controls - Created chat-input.ts demo fixture with message display and controls - Added both components to demo-runner.ts knownComponents list Interactive Demo Features: - Call status: Status variations, interactive LLM/tool call controls, connection toggle - Chat input: Message display with user/bot styling, multiple preset buttons - Both demos include real-time state updates and comprehensive examples Dependencies: - Added @tailwindcss/vite package for Tailwind integration - Updated package.json and package-lock.json with new dependency Files Modified: - sketch/webui/src/web-components/sketch-call-status.ts: Converted to SketchTailwindElement - sketch/webui/src/web-components/sketch-chat-input.ts: Converted to SketchTailwindElement - sketch/webui/src/web-components/sketch-chat-input.test.ts: Updated selectors for light DOM - sketch/webui/src/web-components/demo/demo-fixtures/call-status.ts: Added call status fixtures - sketch/webui/src/web-components/demo/demo-fixtures/index.ts: Export call status fixtures - sketch/webui/src/web-components/demo/sketch-call-status.demo.ts: Complete interactive demo - sketch/webui/src/web-components/demo/chat-input.ts: New chat input demo fixture - sketch/webui/src/web-components/demo/demo-framework/demo-runner.ts: Added both components - sketch/webui/tailwind.config.js: Added custom fade-in animation - sketch/webui/package.json: Added @tailwindcss/vite dependency Testing and Validation: - All component tests pass with updated selectors - Components render correctly with Tailwind classes - All functionality preserved including animations and interactions - Interactive demos load and function properly - Components appear in demo runner list The conversion maintains all functionality while enabling better integration with the Tailwind-based design system and providing comprehensive demo infrastructure for development and testing. Co-Authored-By: sketch <hello@sketch.dev> Change-ID: s97f4190763cfe17ak
Sketch is an agentic coding tool. It draws the 🦉
Sketch runs in your terminal, has a web UI, understands your code, and helps you get work done. To keep your environment pristine, sketch starts a docker container and outputs its work onto a branch in your host git repository.
Sketch helps with most programming environments, but Sketch has extra goodies for Go.
go install sketch.dev/cmd/sketch@latest sketch
Currently, Sketch runs on MacOS and Linux. It uses Docker for containers.
| Platform | Installation |
|---|---|
| MacOS | brew install colima (or Docker Desktop/Orbstack) |
| Linux | apt install docker.io (or equivalent for your distro) |
| WSL2 | Install Docker Desktop for Windows (docker entirely inside WSL2 is tricky) |
The sketch.dev service is used to provide access to an LLM service and give you a way to access the web UI from anywhere.
Start Sketch by running sketch in a Git repository. It will open your browser to the Sketch chat interface, but you can also use the CLI interface. Use -open=false if you want to use just the CLI interface.
Ask Sketch about your codebase or ask it to implement a feature. It may take a little while for Sketch to do its work, so hit the bell (🔔) icon to enable browser notifications. We won't spam you or anything; it will notify you when the Sketch agent's turn is done, and there's something to look at.
When you start Sketch, it:
This design lets you run multiple sketches in parallel since they each have their own sandbox. It also lets Sketch work without worry: it can trash its own container, but it can't trash your machine.
Sketch's agentic loop uses tool calls (mostly shell commands, but also a handful of other important tools) to allow the LLM to interact with your codebase.
Sketch is trained to make Git commits. When those happen, they are automatically pushed to the git repository where you started sketch with branch names sketch/*.
Finding Sketch branches:
git branch -a --sort=creatordate | grep sketch/ | tail
The UI keeps track of the latest branch it pushed and displays it prominently. You can use standard Git workflows to pull those branches into your workspace:
git cherry-pick $(git merge-base origin/main sketch/foo)
or merge the branch
git merge sketch/foo
or reset to the branch
git reset --hard sketch/foo
Ie use the same workflows you would if you were pulling in a friend's Pull Request.
Advanced: You can ask Sketch to git fetch sketch-host and rebase onto another commit. This will also fetch where you started Sketch, and we do a bit of "git fetch refspec configuration" to make origin/main work as a git reference.
Don't be afraid of asking Sketch to help you rebase, merge/squash commits, rewrite commit messages, and so forth; it's good at it!
The diff view shows you changes since Sketch started. Leaving comments on lines adds them to the chat box, and, when you hit Send (at the bottom of the page), Sketch goes to work addressing your comments.
You can interact directly with the container in three ways:
ssh sketch-ilik-eske-tcha-lott. We have automatically configured your SSH configuration to make these special hostnames work.Using SSH (and/or VSCode) allows you to forward ports from the container to your machine. For example, if you want to start your development webserver, you can do something like this:
# Forward container port 8888 to local port 8000 ssh -L8000:localhost:8888 sketch-ilik-epor-tfor-ward go run ./cmd/server
This makes http://localhost:8000/ on your machine point to localhost:8888 inside the container.
You can ask Sketch to browse a web page and take screenshots. There are tools both for taking screenshots and "reading images", the latter of which sends the image to the LLM. This functionality is handy if you're working on a web page and want to see what the in-progress change looks like.
Docker images, containers, and so forth tend to pile up. Ask Docker to prune unused images and containers:
docker system prune -a
See CONTRIBUTING.md for development guidelines.
Sketch is open source. It is right here in this repository! Have a look around and mod away.
If you want to run Sketch entirely without the sketch.dev service, you can set the flag -skaband-addr="" and then provide an ANTHROPIC_API_KEY environment variable. (More LLM services coming soon!)