blob: 4964714c2bad960c9c9987001cfc9c2a3ef3cf49 [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
Josh Bleecher Snyder1c18ec92025-07-08 10:55:54 -070028Grab the most recent [nightly release](https://github.com/boldsoftware/sketch/releases).
29
30To build yourself, clone this repo, and then run:
31
Earl Lee2e463fb2025-04-17 11:22:22 -070032```sh
Josh Bleecher Snyder1c18ec92025-07-08 10:55:54 -070033$ make
34$ ./sketch
Earl Lee2e463fb2025-04-17 11:22:22 -070035```
David Crawshaw64d32992025-04-21 09:14:36 -070036
Pokey Rule9007dd92025-05-15 14:38:55 +010037## 🔧 Requirements
David Crawshaw64d32992025-04-21 09:14:36 -070038
Philip Zeyligerbe0da442025-06-20 15:14:24 -070039Currently, Sketch runs on MacOS and Linux. It uses Docker for containers.
Josh Bleecher Snyder5cef9db2025-04-22 16:44:13 -070040
Pokey Rule9007dd92025-05-15 14:38:55 +010041| Platform | Installation |
42| -------- | -------------------------------------------------------------------------- |
Philip Zeyligerbe0da442025-06-20 15:14:24 -070043| MacOS | `brew install colima` (or Docker Desktop/Orbstack) |
Pokey Rule9007dd92025-05-15 14:38:55 +010044| Linux | `apt install docker.io` (or equivalent for your distro) |
45| WSL2 | Install Docker Desktop for Windows (docker entirely inside WSL2 is tricky) |
David Crawshaw64d32992025-04-21 09:14:36 -070046
47The [sketch.dev](https://sketch.dev) service is used to provide access
48to an LLM service and give you a way to access the web UI from anywhere.
49
Pokey Rule9007dd92025-05-15 14:38:55 +010050## 🤝 Community & Feedback
David Crawshaw64d32992025-04-21 09:14:36 -070051
Pokey Rule9007dd92025-05-15 14:38:55 +010052- **Discord**: Join our community at [https://discord.gg/6w9qNRUDzS](https://discord.gg/6w9qNRUDzS)
53- **GitHub Issues**: Submit feedback at [https://github.com/boldsoftware/sketch/issues](https://github.com/boldsoftware/sketch/issues)
David Crawshaw64d32992025-04-21 09:14:36 -070054
Pokey Rule9007dd92025-05-15 14:38:55 +010055## 📖 User Guide
David Crawshaw64d32992025-04-21 09:14:36 -070056
Pokey Rule9007dd92025-05-15 14:38:55 +010057### Getting Started
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -070058
Pokey Rule9007dd92025-05-15 14:38:55 +010059Start 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 -070060
Pokey Rule9007dd92025-05-15 14:38:55 +010061Ask 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 -070062when the Sketch agent's turn is done, and there's something to look at.
63
64### How Sketch Works
65
66<!-- TODO: innie/outtie picture -->
67
Pokey Rule9007dd92025-05-15 14:38:55 +010068When you start Sketch, it:
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070069
Pokey Rule9007dd92025-05-15 14:38:55 +0100701. Creates a Dockerfile
712. Builds it
723. Copies your repository into it
734. Starts a Docker container with the "inside" Sketch running
74
75This 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.
76
77Sketch'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 -070078
79### Getting Your Git Changes Out
80
81<!-- TODO: git picture -->
82
Pokey Rule9007dd92025-05-15 14:38:55 +010083Sketch is trained to make Git commits. When those happen, they are
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070084automatically pushed to the git repository where you started sketch with branch
Pokey Rule9007dd92025-05-15 14:38:55 +010085names `sketch/*`.
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070086
Pokey Rule9007dd92025-05-15 14:38:55 +010087**Finding Sketch branches:**
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -070088
Pokey Rule9007dd92025-05-15 14:38:55 +010089```sh
90git branch -a --sort=creatordate | grep sketch/ | tail
91```
92
93The 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:
94
95```sh
96git cherry-pick $(git merge-base origin/main sketch/foo)
97```
98
99or merge the branch
100
101```sh
102git merge sketch/foo
103```
104
105or reset to the branch
106
107```sh
108git reset --hard sketch/foo
109```
110
111Ie use the same workflows you would if you were pulling in a friend's Pull Request.
112
113**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.
114
115Don'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 -0700116
117### Reviewing Diffs
118
119The diff view shows you changes since Sketch started. Leaving comments on lines
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -0700120adds 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 -0700121comments.
122
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700123### Connecting to Sketch's Container
124
Pokey Rule9007dd92025-05-15 14:38:55 +0100125You can interact directly with the container in three ways:
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700126
Pokey Rule9007dd92025-05-15 14:38:55 +01001271. **Web UI Terminal**: Use the "Terminal" tab in the UI
1282. **SSH**: Look at the startup logs or click the information icon to see a command like `ssh sketch-ilik-eske-tcha-lott`.
129 We have automatically configured your SSH configuration to make these special hostnames work.
1303. **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
131 can edit the code, use the terminal, review diffs, and so forth.
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700132
Pokey Rule9007dd92025-05-15 14:38:55 +0100133Using 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 -0700134
Pokey Rule9007dd92025-05-15 14:38:55 +0100135```sh
136# Forward container port 8888 to local port 8000
137ssh -L8000:localhost:8888 sketch-ilik-epor-tfor-ward go run ./cmd/server
138```
Philip Zeyliger6458e7c2025-05-10 18:07:54 -0700139
Pokey Rule9007dd92025-05-15 14:38:55 +0100140This makes `http://localhost:8000/` on your machine point to `localhost:8888` inside the container.
141
142### Using Browser Tools
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700143
144You can ask Sketch to browse a web page and take screenshots. There are tools
Josh Bleecher Snyder39ed5a52025-05-12 17:34:45 -0700145both for taking screenshots and "reading images", the latter of which sends the
Philip Zeyliger5ebdbb82025-05-10 17:20:29 -0700146image to the LLM. This functionality is handy if you're working on a web page and
147want to see what the in-progress change looks like.
148
Pokey Rule9007dd92025-05-15 14:38:55 +0100149## ❓ FAQ
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700150
Pokey Rule9007dd92025-05-15 14:38:55 +0100151### "No space left on device"
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700152
Pokey Rule9007dd92025-05-15 14:38:55 +0100153Docker images, containers, and so forth tend to pile up. Ask Docker to prune unused images and containers:
Philip Zeyliger39bcf012025-05-12 10:07:40 -0700154
Pokey Rule9007dd92025-05-15 14:38:55 +0100155```sh
156docker system prune -a
157```
158
159## 🛠️ Development
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700160
M-Ab5cb9542025-05-02 11:32:34 -0400161[![Go Reference](https://pkg.go.dev/badge/sketch.dev.svg)](https://pkg.go.dev/sketch.dev)
162
Pokey Rule9007dd92025-05-15 14:38:55 +0100163See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
Philip Zeyligerd43e5722025-04-23 19:21:26 -0700164
Pokey Rule9007dd92025-05-15 14:38:55 +0100165## 📄 Open Source
David Crawshaw64d32992025-04-21 09:14:36 -0700166
167Sketch is open source.
168It is right here in this repository!
169Have a look around and mod away.
170
Pokey Rule9007dd92025-05-15 14:38:55 +0100171If 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!)