Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

CI: the commit check is the format check and the audit

Indicode BV9b1c389ad833
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 18aa496..ba7b3dd 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -10,40 +10,17 @@ env:
CARGO_TERM_COLOR: always
jobs:
- linux:
+ format:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- - name: System libraries
- run: sudo apt-get update && sudo apt-get install -y libxkbcommon-dev libwayland-dev libx11-dev libxcb1-dev libfontconfig1-dev
- uses: dtolnay/rust-toolchain@stable
with:
- components: clippy, rustfmt
- - uses: Swatinem/rust-cache@v2
+ components: rustfmt
- run: cargo fmt --all --check
- - run: cargo clippy --workspace --all-targets -- -D warnings
- - run: cargo test --workspace
- - run: python3 docs/skill/drawkit.py --check
audit:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
-
- 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/.github/workflows/full.yml b/.github/workflows/full.yml
new file mode 100644
index 0000000..7a0f3a2
--- /dev/null
+++ b/.github/workflows/full.yml
@@ -0,0 +1,39 @@
+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/CLAUDE.md b/CLAUDE.md
index 3c392d0..5c4953e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -31,8 +31,8 @@ Agent-first 2D art application in Rust: a `klad` CLI for agents and a native edi
- No comments in code except `// TODO:`.
- Iterator chains over `for` loops where they read better; plain loops in hot pixel paths where they are clearer or faster.
- Determinism in `core`, `brush` and `render`: transcendental math through `libm`, one seeded RNG (`klad_core::rng`), no wall clock, no `HashMap` iteration order in output, parallelism only over independent units (tiles, image rows).
-- Bundles are never broken by a format change: bump the format version (`klad/N` in `doc.json`) and add a migration, and update `docs/format.md` in the same change. `klad/1` (2026-11-06) started clean: the `.draw` folders before it (`draw-anything/0` to `/9`) do not open, by Kevin's choice.
+- Bundles are never broken by a format change: bump the format version (`klad/N` in `doc.json`) and add a migration, and update `docs/format.md` in the same change. `klad/1` (2026-11-06) started clean: the `.draw` folders before it (`draw-anything/0` to `/9`) do not open.
- Permissive dependencies only: MIT, Apache-2.0, BSD-2/3, ISC, Zlib, BSL-1.0, Unicode-3.0, CC0-1.0; fonts bundled in the editor may be OFL-1.1 or the Ubuntu Font Licence (egui's), and the fonts in `fonts/` OFL-1.1 or Apache-2.0 (`fonts/update.py` fetches them unchanged; the notices list them). No GPL, LGPL or MPL unless dual licensed with one of these. `deny.toml` holds the list and `just audit` checks it; every shipped licence text is in `THIRD-PARTY-NOTICES.md` (`just notices`).
- klad is source-available, not open source, copyright Indicode BV: the app is under the PolyForm Internal Use License 1.0.0 with permissions for personal use (free to build from source), proposing contributions and sharing drawings, and a limit: a company with 100,000 euros or more in revenue in its last tax year needs a bought licence per person; it also covers the builds it sells, and a bought build is such a licence (`LICENSE`; `license-file` in Cargo, since it has no SPDX identifier). `docs/format.md`, `docs/cli.md`, `docs/skill/` and `crates/client` are MIT (`LICENSE-MIT`): `klad-client` depends on none of the other crates, a format change updates `docs/format.md` in the same change, and a command change runs `just reference` (a test checks `docs/cli.md`). Outside contributions come in under the CLA (`CLA.md`).
- No em-dashes in docs, messages or UI text.
-- `just build` counts the version up (patch; `minor` and `major` on request) for every build Kevin makes; agents build with `just compile`, which does not, and commit a counted-up `Cargo.toml` and `Cargo.lock` with the next change.
+- `just build` counts the version up (patch; `minor` and `major` on request) for every release build made on the maintainer's machine; agents build with `just compile`, which does not, and commit a counted-up `Cargo.toml` and `Cargo.lock` with the next change.
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index 74d96c7..af3cfba 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -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`. 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 lint, tests and the audit on every pull request, tests on macOS and builds on Windows. 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`. 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.
### Stack