Kale is a very small web page for editing one file collaboratively in a GitHub repo.
You paste:
- a GitHub personal access token
- a GitHub file link, like
https://github.com/tweedefloor/kale/blob/main/README.md
The app loads the latest GitHub file, syncs live edits between open browsers with CRDTs, and commits the current editor state back to the same branch when you click commit.
Everything runs in your browser. There is no backend server.
Use a fine-grained personal access token.
- Go to GitHub token settings
- Set an expiration.
- Under Repository access, select Only select repositories, then pick the repo you want to edit (the same as in the Github file link above)
- Under Repository permissions, set:
- Contents:
Read and write - Issues:
Read and write - Metadata:
Read-onlyshould already be included
- Generate the token and paste it into the app.
Caution
Note: the token can edit files in the repos you grant it access to, so keep the URL containing ?pat=... as secret. Actually.. probably you shouldnt use this app at all. I dont think its a good idea to go around the internet and paste your PAT into random github projects. Maybe I can even hack your repo now. Thats not so good.
Open index.html in a browser or host it as a static website.
Paste the token and GitHub file link, load the file, edit it, then click commit.
On load, Kale fetches the latest GitHub file once. After that, open browsers sync through CRDT/WebRTC; GitHub is only used for signaling and for saving checkpoints when you click commit. Commit reads the latest branch head and writes the current editor state on top.
Once you pasted them, the url can be bookmarked like file:///Users/cf/dev/tweedefloor/kale/index.html?pat=<xxx>&repo=<xxx>