Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

CI builds klad the way the README says, on macOS, Linux and Windows

Indicode BV7e2af12ba069
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..1d388c5
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,96 @@
+name: build
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+concurrency:
+ group: build-${{ github.ref }}
+ cancel-in-progress: true
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ build:
+ name: ${{ matrix.name }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - name: macOS
+ os: macos-latest
+ target: target
+ - name: Linux
+ os: ubuntu-24.04
+ target: target/linux
+ - name: Windows
+ os: windows-latest
+ target: target/windows
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ env:
+ CARGO_TERM_COLOR: never
+ CARGO_TARGET_DIR: ${{ matrix.target }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: The Linux packages the README lists
+ if: runner.os == 'Linux'
+ run: sudo apt-get update && sudo apt-get install -y pkg-config libfreetype-dev libfontconfig1-dev libxkbcommon-dev libwayland-dev
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: just
+ - uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: ". -> ${{ matrix.target }}"
+ - name: just compile, as the README says
+ run: |
+ set -o pipefail
+ just compile 2>&1 | tee compile.log
+ - name: Paint and render a stroke with the build
+ run: |
+ set -o pipefail
+ klad="${{ matrix.target }}/release/klad"
+ {
+ "$klad" new smoke.klad --width 400 --height 300
+ "$klad" stroke smoke.klad l1 --brush oil --size 20 --color '#d4612c' --path 'M40 150 C 140 40 260 260 360 150'
+ "$klad" render smoke.klad --out smoke.png
+ "$klad" skill drawing > skill.txt
+ head -n 2 skill.txt
+ } 2>&1 | tee smoke.log
+ - name: The tests
+ id: tests
+ continue-on-error: true
+ run: |
+ set -o pipefail
+ cargo test --workspace 2>&1 | tee tests.log
+ - name: Say what happened
+ if: always()
+ run: |
+ said() {
+ [ -f "$1.log" ] || return 0
+ echo "#### $1"
+ echo '```'
+ grep -n -E "^error|^warning: unused|panicked at|FAILED|test result|cannot find|not found|No such file|could not" "$1.log" | tail -n 40 || true
+ echo "... the last lines:"
+ tail -n 30 "$1.log"
+ echo '```'
+ }
+ {
+ echo "### ${{ matrix.name }}: tests ${{ steps.tests.outcome }}"
+ echo "$(rustc --version 2>&1), $(just --version 2>&1)"
+ said compile
+ said smoke
+ said tests
+ } >> "$GITHUB_STEP_SUMMARY"
+ for log in compile smoke tests; do
+ [ -f "$log.log" ] || continue
+ { grep -m 6 -E "^error|panicked at|FAILED" "$log.log" || true; } | while read -r line; do
+ echo "::warning title=${{ matrix.name }} $log::$line"
+ done
+ done
+ - name: Tests must pass where klad is tested
+ if: steps.tests.outcome == 'failure' && runner.os != 'Windows'
+ run: exit 1
diff --git a/.github/workflows/full.yml b/.github/workflows/full.yml
deleted file mode 100644
index 7a0f3a2..0000000
--- a/.github/workflows/full.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: full
-
-on:
- workflow_dispatch:
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- linux:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v4
- - name: System libraries
- run: sudo apt-get update && sudo apt-get install -y pkg-config libfreetype-dev libxkbcommon-dev libwayland-dev libx11-dev libxcb1-dev libfontconfig1-dev
- - uses: dtolnay/rust-toolchain@stable
- with:
- components: clippy, rustfmt
- - uses: Swatinem/rust-cache@v2
- - run: cargo clippy --workspace --all-targets -- -D warnings
- - run: cargo test --workspace
- - run: python3 docs/skill/drawkit.py --check
-
- macos:
- runs-on: macos-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- - uses: Swatinem/rust-cache@v2
- - run: cargo test --workspace
-
- windows:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- - uses: Swatinem/rust-cache@v2
- - run: cargo build -p klad-cli
- - run: target/debug/klad.exe --version
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index 523972b..87b8670 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -1,4 +1,4 @@
-_Last updated: 2026-11-10 14:30_
+_Last updated: 2026-11-10 17:00_
# 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`; `full`, started by hand from the Actions tab, runs clippy and the tests on Linux, the tests on macOS and the CLI build on Windows (they do not pass on the hosted runners yet, so they are kept off the commits; run `just lint` and `just test` before sending a change). 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` 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. 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