Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

Text files check out with unix line endings on every system

Indicode BV477eaa2849a3
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..b0e2607
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,7 @@
+* text=auto eol=lf
+*.strokes binary
+*.weights binary
+fonts/** -text
+licenses/** -text
+tests/formats/** -text
+THIRD-PARTY-NOTICES.md -text
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index b546f3f..6f79d6a 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -1,4 +1,4 @@
-_Last updated: 2026-11-10 17:00_
+_Last updated: 2026-11-10 19:40_
# klad: design
@@ -29,7 +29,7 @@ crates/
Two binaries from one crate: `klad`, the command line, and `klad-editor`, the editor alone (a windowed program on Windows, the executable of `klad.app` on a Mac, started by the Linux AppImage). `klad open [bundle]` launches the same editor from the command line, on the bundle or, without one, on the start window (new, open, recent). `--no-default-features` builds `klad` without the editor. `klad --version` and the editor's About show the version and `git describe` of the commit it was built from (`crates/version.rs`, shared by both crates' build scripts; `KLAD_BUILD` overrides it).
-**Platforms and packaging (M7).** Folders follow each platform: settings in `~/Library/Application Support/klad`, `%APPDATA%\klad` or `$XDG_CONFIG_HOME/klad`; downloaded fonts in the same places' data folder; drawings in `~/Drawings` by default. The open panel is `NSOpenPanel` on macOS and `rfd` elsewhere (the XDG portal on Linux, the common dialog on Windows). The pen: macOS reads `NSEvent`; elsewhere a pen that the system reports as a touch with force (Windows pens through `WM_POINTER`) draws with that pressure (`pen::from_egui`), and anything else draws as a mouse at full pressure; Linux tablets report no pressure through `winit` yet. `packaging/` makes the downloads: `macos/app.sh` builds `klad.app` (both binaries, lipo'd when several targets are given, the fonts, licences and skill in `Resources`, `.klad` declared as a document package of type `com.indicode.klad.drawing` so Finder shows a drawing as one item and opens it in klad) and a disk image; `archive.sh <target>` builds a `tar.gz` or `zip` with both binaries, `fonts/`, the licences and `SKILL.md`, and an AppImage on Linux when `APPIMAGETOOL` is set; `icon/` draws the icon in klad and packs `klad.icns` and `klad.ico` (the icon is a K in two brush strokes with paint body and a dry edge, an ink stem and one ember stroke for the arm and the leg; `build.sh <folder>` keeps the drawing to open in the editor). Builds use the `dist` profile (no debug info, stripped, thin LTO); the samples hash the same from it. The fonts are found next to the binary (`fonts/`), in `../Resources/fonts` or `../share/klad/fonts`. On macOS a drawing opened from Finder arrives as an `application:openURLs:` message, which klad adds to `NSObject` before the event loop starts so it reaches whatever delegate `winit` installs; the paths queue up (`opened.rs`) and the start window or editor opens the last. `klad install` puts `klad` on the terminal's path (a link in `/usr/local/bin` through an administrator prompt on macOS, `~/.local/bin` on Linux, the user's `PATH` on Windows); the editor's document menu runs it as a job. `klad skill` prints the agent skill compiled into the binary; `klad samples` lists and copies the sample drawings a build carries (First start, below). Builds are sold on itch.io (later Steam) for macOS and Windows, and Linux is built from source: on a version tag the `release` workflow builds the Windows version and pushes it to itch.io with butler (never as a workflow artifact, which anyone could download from a public repository) and publishes the changelog section as the release notes, and `just itch-mac` builds and pushes the Mac app from a Mac; `check` runs the format check and the licence and advisory audit on every pull request and every push to `main`; `build` runs on every push to `main` and when started by hand from the Actions tab (on any branch), not on pull requests, since three builds per pull request is a lot; it does what the README tells someone who clones klad, on macOS, Linux and Windows: the Linux packages it lists, `just compile`, then a stroke painted and rendered with that build, then the tests. Each job writes what it saw (the errors and the last lines of each step) into its summary on the run's page. The tests have to pass on macOS and Linux; on Windows, where klad is not tested yet, they are reported only. Pixel hashes are the same on machines of one processor family only: the vector parts are drawn by Skia, whose fast paths differ between ARM and Intel. So the test that opens the drawings of each release (`crates/cli/tests/formats.rs`) compares pixels on ARM, where its hashes were made (the Macs and the macOS runner), and on Intel checks that every frame still opens and renders. The editor asks the GitHub releases API at most once a day (`updates.rs`, curl on a thread, off in the settings window) and, when a newer version is out, says so in the start window, the message line and About, with a link to what changed; it installs nothing. About's "check now" and `klad updates` check on demand (`updates::spawn`, a channel per check) and say why a check failed: no release published yet, no network, or a feed that does not parse.
+**Platforms and packaging (M7).** Folders follow each platform: settings in `~/Library/Application Support/klad`, `%APPDATA%\klad` or `$XDG_CONFIG_HOME/klad`; downloaded fonts in the same places' data folder; drawings in `~/Drawings` by default. The open panel is `NSOpenPanel` on macOS and `rfd` elsewhere (the XDG portal on Linux, the common dialog on Windows). The pen: macOS reads `NSEvent`; elsewhere a pen that the system reports as a touch with force (Windows pens through `WM_POINTER`) draws with that pressure (`pen::from_egui`), and anything else draws as a mouse at full pressure; Linux tablets report no pressure through `winit` yet. `packaging/` makes the downloads: `macos/app.sh` builds `klad.app` (both binaries, lipo'd when several targets are given, the fonts, licences and skill in `Resources`, `.klad` declared as a document package of type `com.indicode.klad.drawing` so Finder shows a drawing as one item and opens it in klad) and a disk image; `archive.sh <target>` builds a `tar.gz` or `zip` with both binaries, `fonts/`, the licences and `SKILL.md`, and an AppImage on Linux when `APPIMAGETOOL` is set; `icon/` draws the icon in klad and packs `klad.icns` and `klad.ico` (the icon is a K in two brush strokes with paint body and a dry edge, an ink stem and one ember stroke for the arm and the leg; `build.sh <folder>` keeps the drawing to open in the editor). Builds use the `dist` profile (no debug info, stripped, thin LTO); the samples hash the same from it. The fonts are found next to the binary (`fonts/`), in `../Resources/fonts` or `../share/klad/fonts`. On macOS a drawing opened from Finder arrives as an `application:openURLs:` message, which klad adds to `NSObject` before the event loop starts so it reaches whatever delegate `winit` installs; the paths queue up (`opened.rs`) and the start window or editor opens the last. `klad install` puts `klad` on the terminal's path (a link in `/usr/local/bin` through an administrator prompt on macOS, `~/.local/bin` on Linux, the user's `PATH` on Windows); the editor's document menu runs it as a job. `klad skill` prints the agent skill compiled into the binary; `klad samples` lists and copies the sample drawings a build carries (First start, below). Builds are sold on itch.io (later Steam) for macOS and Windows, and Linux is built from source: on a version tag the `release` workflow builds the Windows version and pushes it to itch.io with butler (never as a workflow artifact, which anyone could download from a public repository) and publishes the changelog section as the release notes, and `just itch-mac` builds and pushes the Mac app from a Mac; `check` runs the format check and the licence and advisory audit on every pull request and every push to `main`; `build` runs on every push to `main` and when started by hand from the Actions tab (on any branch), not on pull requests, since three builds per pull request is a lot; it does what the README tells someone who clones klad, on macOS, Linux and Windows: the Linux packages it lists, `just compile`, then a stroke painted and rendered with that build, then the tests. Each job writes what it saw (the errors and the last lines of each step) into its summary on the run's page. The tests have to pass on macOS and Linux; on Windows, where klad is not tested yet, they are reported only. Text files check out with unix line endings on every system (`.gitattributes`), because the agent skills and other texts are compiled into the binary and git on Windows would otherwise hand them over with Windows line endings; the fonts' licence texts, the notices and the drawings of earlier releases are kept byte for byte. Pixel hashes are the same on machines of one processor family only: the vector parts are drawn by Skia, whose fast paths differ between ARM and Intel. So the test that opens the drawings of each release (`crates/cli/tests/formats.rs`) compares pixels on ARM, where its hashes were made (the Macs and the macOS runner), and on Intel checks that every frame still opens and renders. The editor asks the GitHub releases API at most once a day (`updates.rs`, curl on a thread, off in the settings window) and, when a newer version is out, says so in the start window, the message line and About, with a link to what changed; it installs nothing. About's "check now" and `klad updates` check on demand (`updates::spawn`, a channel per check) and say why a check failed: no release published yet, no network, or a feed that does not parse.
### Stack