blob: 2e73713674c6be4572412fc3bfbfaa3120e96510 [file] [log] [blame] [view]
Pokey Rule9007dd92025-05-15 14:38:55 +01001<div align="center">
2
3<img src="https://storage.googleapis.com/sketch-assets/sketch-logo.png" alt="Sketch Logo" width="300"/>
4
Earl Lee2e463fb2025-04-17 11:22:22 -07005# Sketch
6
Pokey Rule9007dd92025-05-15 14:38:55 +01007[![Go Reference](https://pkg.go.dev/badge/sketch.dev.svg)](https://pkg.go.dev/sketch.dev)
Pokey Rule124c9422025-05-15 19:07:50 +01008[![Discord](https://img.shields.io/discord/1362869091156758752?logo=discord&logoColor=white&label=Discord)](https://discord.gg/6w9qNRUDzS)
Pokey Rule9007dd92025-05-15 14:38:55 +01009[![GitHub Workflow Status](https://github.com/boldsoftware/sketch/actions/workflows/go_test.yml/badge.svg)](https://github.com/boldsoftware/sketch/actions/workflows/go_test.yml)
10[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/boldsoftware/sketch/blob/main/LICENSE)
11
12**Sketch is an agentic coding tool. It draws the 🦉**
13
14</div>
15
16## 🚀 Overview
Philip Zeyliger3b279a52025-05-07 21:02:03 -070017
18Sketch runs in your terminal, has a web UI, understands your code, and helps
19you get work done. To keep your environment pristine, sketch starts a docker
20container and outputs its work onto a branch in your host git repository.
21
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070022Sketch helps with most programming environments, but Sketch has extra goodies for Go.
Earl Lee2e463fb2025-04-17 11:22:22 -070023
Pokey Rule9007dd92025-05-15 14:38:55 +010024<img src="https://storage.googleapis.com/sketch-assets/screenshot.jpg" alt="Sketch Screenshot" width="800"/>
25
26## 📋 Quick Start
Earl Lee2e463fb2025-04-17 11:22:22 -070027
28```sh
29go install sketch.dev/cmd/sketch@latest
30sketch
31```
David Crawshaw64d32992025-04-21 09:14:36 -070032
Pokey Rule9007dd92025-05-15 14:38:55 +010033## 🔧 Requirements
David Crawshaw64d32992025-04-21 09:14:36 -070034
Philip Zeyligerbe0da442025-06-20 15:14:24 -070035Currently, Sketch runs on MacOS and Linux. It uses Docker for containers.
Josh Bleecher Snyder5cef9db2025-04-22 16:44:13 -070036
Pokey Rule9007dd92025-05-15 14:38:55 +010037| Platform | Installation |
38| -------- | -------------------------------------------------------------------------- |
Philip Zeyligerbe0da442025-06-20 15:14:24 -070039| MacOS | `brew install colima` (or Docker Desktop/Orbstack) |
Pokey Rule9007dd92025-05-15 14:38:55 +010040| Linux | `apt install docker.io` (or equivalent for your distro) |
41| WSL2 | Install Docker Desktop for Windows (docker entirely inside WSL2 is tricky) |
David Crawshaw64d32992025-04-21 09:14:36 -070042
43The [sketch.dev](https://sketch.dev) service is used to provide access
44to an LLM service and give you a way to access the web UI from anywhere.
45
Pokey Rule9007dd92025-05-15 14:38:55 +010046## 🤝 Community & Feedback
David Crawshaw64d32992025-04-21 09:14:36 -070047
Pokey Rule9007dd92025-05-15 14:38:55 +010048- **Discord**: Join our community at [https://discord.gg/6w9qNRUDzS](https://discord.gg/6w9qNRUDzS)
49- **GitHub Issues**: Submit feedback at [https://github.com/boldsoftware/sketch/issues](https://github.com/boldsoftware/sketch/issues)
David Crawshaw64d32992025-04-21 09:14:36 -070050
Pokey Rule9007dd92025-05-15 14:38:55 +010051## 📖 User Guide
David Crawshaw64d32992025-04-21 09:14:36 -070052
Pokey Rule9007dd92025-05-15 14:38:55 +010053### Getting Started
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070054
Pokey Rule9007dd92025-05-15 14:38:55 +010055Start 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.
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070056
Pokey Rule9007dd92025-05-15 14:38:55 +010057Ask 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
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070058when the Sketch agent's turn is done, and there's something to look at.
59
60### How Sketch Works
61
62<!-- TODO: innie/outtie picture -->
63
Pokey Rule9007dd92025-05-15 14:38:55 +010064When you start Sketch, it:
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070065
Pokey Rule9007dd92025-05-15 14:38:55 +0100661. Creates a Dockerfile
672. Builds it
683. Copies your repository into it
694. Starts a Docker container with the "inside" Sketch running
70
71This 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.
72
73Sketch'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.
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070074
75### Getting Your Git Changes Out
76
77<!-- TODO: git picture -->
78
Pokey Rule9007dd92025-05-15 14:38:55 +010079Sketch is trained to make Git commits. When those happen, they are
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070080automatically pushed to the git repository where you started sketch with branch
Pokey Rule9007dd92025-05-15 14:38:55 +010081names `sketch/*`.
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070082
Pokey Rule9007dd92025-05-15 14:38:55 +010083**Finding Sketch branches:**
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070084
Pokey Rule9007dd92025-05-15 14:38:55 +010085```sh
86git branch -a --sort=creatordate | grep sketch/ | tail
87```
88
89The 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:
90
91```sh
92git cherry-pick $(git merge-base origin/main sketch/foo)
93```
94
95or merge the branch
96
97```sh
98git merge sketch/foo
99```
100
101or reset to the branch
102
103```sh
104git reset --hard sketch/foo
105```
106
107Ie use the same workflows you would if you were pulling in a friend's Pull Request.
108
109**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.
110
111Don't be afraid of asking Sketch to help you rebase, merge/squash commits, rewrite commit messages, and so forth; it's good at it!
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700112
113### Reviewing Diffs
114
115The diff view shows you changes since Sketch started. Leaving comments on lines
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -0700116adds them to the chat box, and, when you hit Send (at the bottom of the page), Sketch goes to work addressing your
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700117comments.
118
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700119### Connecting to Sketch's Container
120
Pokey Rule9007dd92025-05-15 14:38:55 +0100121You can interact directly with the container in three ways:
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700122
Pokey Rule9007dd92025-05-15 14:38:55 +01001231. **Web UI Terminal**: Use the "Terminal" tab in the UI
1242. **SSH**: Look at the startup logs or click the information icon to see a command like `ssh sketch-ilik-eske-tcha-lott`.
125 We have automatically configured your SSH configuration to make these special hostnames work.
1263. **Visual Studio Code**: Look for a command line or magic link behind the information icon, or when Sketch starts up. This starts a new VSCode session "remoted into" the container. You
127 can edit the code, use the terminal, review diffs, and so forth.
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700128
Pokey Rule9007dd92025-05-15 14:38:55 +0100129Using 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:
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700130
Pokey Rule9007dd92025-05-15 14:38:55 +0100131```sh
132# Forward container port 8888 to local port 8000
133ssh -L8000:localhost:8888 sketch-ilik-epor-tfor-ward go run ./cmd/server
134```
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700135
Pokey Rule9007dd92025-05-15 14:38:55 +0100136This makes `http://localhost:8000/` on your machine point to `localhost:8888` inside the container.
137
138### Using Browser Tools
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700139
140You can ask Sketch to browse a web page and take screenshots. There are tools
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -0700141both for taking screenshots and "reading images", the latter of which sends the
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700142image to the LLM. This functionality is handy if you're working on a web page and
143want to see what the in-progress change looks like.
144
Pokey Rule9007dd92025-05-15 14:38:55 +0100145## ❓ FAQ
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700146
Pokey Rule9007dd92025-05-15 14:38:55 +0100147### "No space left on device"
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700148
Pokey Rule9007dd92025-05-15 14:38:55 +0100149Docker images, containers, and so forth tend to pile up. Ask Docker to prune unused images and containers:
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700150
Pokey Rule9007dd92025-05-15 14:38:55 +0100151```sh
152docker system prune -a
153```
154
155## 🛠️ Development
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700156
M-Ab5cb9542025-05-02 11:32:34 -0400157[![Go Reference](https://pkg.go.dev/badge/sketch.dev.svg)](https://pkg.go.dev/sketch.dev)
158
Pokey Rule9007dd92025-05-15 14:38:55 +0100159See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700160
Pokey Rule9007dd92025-05-15 14:38:55 +0100161## 📄 Open Source
David Crawshaw64d32992025-04-21 09:14:36 -0700162
163Sketch is open source.
164It is right here in this repository!
165Have a look around and mod away.
166
Pokey Rule9007dd92025-05-15 14:38:55 +0100167If 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!)