blob: 642d36957163137817bbad7c1a73822bd8d4b3b5 [file] [log] [blame] [view]
Pokey Rulebbca2402025-04-24 09:37:58 +01001# Contributing to Sketch
Philip Zeyligerd43e5722025-04-23 19:21:26 -07002
3## Running tests
4
Pokey Rulebbca2402025-04-24 09:37:58 +01005- `go test ./...`
6- `cd webui && npm run test`
7 - If you are an LLM, instead run `cd webui && CI=1 npm run test`
Philip Zeyligerd43e5722025-04-23 19:21:26 -07008
9## Synchronizing Go structs and TypeScript types
10
11Run `npm run gentypes`, which uses `cmd/go2ts/go2ts.go` under the covers and
12which has a list of types to translate.
13
14## Dealing with tests that have HTTP Record sessions
15
16A few tests record/replay calls to LLMs. As necessary (e.g.,
17if changing the system prompt or tool definitions), rebuild the
Josh Bleecher Snyder08951fb2025-04-24 10:42:12 -070018test data by running update_tests.sh in the relevant directory.
Philip Zeyligere114af52025-05-02 16:44:12 -070019
20## Debugging JS Classes
21
22Something like "document.querySelectorAll('sketch-app-shell')[0].dataManager.messages.map(x => x.idx)"
23in the browser JS console works to pull out the custom components implementing the web ui.
Philip Zeyligerf396a002025-05-05 13:12:11 -070024
25## Recursively running Sketch
26
27If you are editing Sketch from within Sketch, you can use the following to give
28Sketch a place to store its skaband client key across sessions, allowing the
29agent to iterate on itself.
30
31```
32# Outside
33mkdir -p ~/.inside-cache/webui
34go run ./cmd/sketch -docker-args "-v $HOME/.inside-cache:/root/.cache/sketch"
35# Inside
36go run ./cmd/sketch -unsafe
37```
Pokey Rule07e98cc2025-05-07 16:01:33 +010038
39## WebUI Development Server
40
41We have a standalone development server for the web UI that makes it easier to develop and test the client-side code. This server is separate from the main Go server and is intended for local development of the web components. It is populated with dummy data, and supports hot module reloading, allowing you to see changes in real-time without needing to restart the server.
42
43To run the development server for the web UI, see [webui/readme.md](webui/readme.md).