A drawing app built for agent/human collaboration
Rust
Update checks say what happened; check now and klad updates
Indicode BV57011dbdcab3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex db0fa75..3ec9f56 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,7 +10,8 @@ The first builds, and klad's licences.- The editor runs on Windows and Linux (`klad open`, or `klad-editor`), with the platform's open dialog; pens that report pressure through the system (Windows) draw with it.- On a Mac, `.draw` drawings show in Finder as one item and open in klad with a double click.- `klad install` (and "install the klad command" in the editor's document menu) puts `klad` on the terminal's path, for you and for agents. `klad skill` prints the agent skill.-- The editor checks once a day whether a newer version is out and says so, with a link to what changed (off in the settings window).+- The editor checks once a day whether a newer version is out and says so, with a link to what changed (off in the settings window); About's "check now" and `klad updates` check on demand and say why a check failed.+- The agent's key field turns away a Claude subscription token (from `claude setup-token`) and says why: klad needs a Claude Console API key.- `klad --version` and About show the commit a build was made from.- In-betweens blend colours evenly (in OKLab), so light can follow a turning limb when the second key is coloured for it.- `klad arcs` follows the part of a foot on the ground: a heel-to-toe roll is no longer reported as a slide.diff --git a/crates/app/src/agent/claude.rs b/crates/app/src/agent/claude.rsindex 53383d3..ff03425 100644--- a/crates/app/src/agent/claude.rs+++ b/crates/app/src/agent/claude.rs@@ -294,10 +294,27 @@ fn rand_tag() -> u128 {.map_or(0, |d| d.as_nanos())}+pub fn refused(key: &str) -> Option<&'static str> {+ match key {+ "" => Some("paste a key first"),+ k if k.starts_with("sk-ant-oat") => Some(+ "this is a Claude subscription token (from claude setup-token). Anthropic allows a Pro or Max subscription only in Claude Code and on claude.ai, so klad needs an API key from the Claude Console (console.anthropic.com), which starts with sk-ant-api",+ ),+ _ => None,+ }+}+#[cfg(test)]mod tests {use super::*;+ #[test]+ fn a_subscription_token_is_refused_with_the_reason() {+ assert!(refused("sk-ant-oat01-abc").unwrap().contains("claude setup-token"));+ assert_eq!(refused(""), Some("paste a key first"));+ assert_eq!(refused("sk-ant-api03-abc"), None);+ }+#[test]fn a_streamed_reply_with_thinking_text_and_a_tool_call_comes_back_whole() {let lines = [diff --git a/crates/app/src/editor.rs b/crates/app/src/editor.rsindex 713524a..b78bdb4 100644--- a/crates/app/src/editor.rs+++ b/crates/app/src/editor.rs@@ -554,6 +554,9 @@ pub(crate) struct Editor {pub(crate) settings_path: Option<PathBuf>,pub(crate) settings_dirty: bool,pub(crate) update: Option<crate::updates::Release>,+ pub(crate) update_feed: String,+ update_check: Option<std::sync::mpsc::Receiver<crate::updates::Checked>>,+ update_said: Option<String>,pub(crate) wants: Option<Want>,view: Option<View>,canvas_rect: Rect,@@ -717,6 +720,9 @@ impl Editor {settings_path,settings_dirty: false,update: None,+ update_feed: crate::updates::feed(),+ update_check: None,+ update_said: None,wants: None,view: None,canvas_rect: Rect::NOTHING,diff --git a/crates/app/src/editor/agentpane.rs b/crates/app/src/editor/agentpane.rsindex f8dc0a2..08850f6 100644--- a/crates/app/src/editor/agentpane.rs+++ b/crates/app/src/editor/agentpane.rs@@ -394,8 +394,12 @@ impl Editor {.labelled_by(label.id).hint("a key from the Claude Console; kept in the Keychain on a Mac, never in settings or the drawing");if ui.button("save").hint("keep the key and check it").clicked() {- let key = std::mem::take(&mut self.agent.key);- match agent::secret::store(&key).and_then(|_| agent::claude::models(&key)) {+ let key = std::mem::take(&mut self.agent.key).trim().to_string();+ let checked = agent::claude::refused(&key).map_or(Ok(()), |why| Err(anyhow::anyhow!(why)));+ match checked+ .and_then(|_| agent::secret::store(&key))+ .and_then(|_| agent::claude::models(&key))+ {Ok(models) => {self.say(Tone::Done, format!("key saved; {} models", models.len()));self.agent.models = models;diff --git a/crates/app/src/editor/panels.rs b/crates/app/src/editor/panels.rsindex 76d9d3f..219983c 100644--- a/crates/app/src/editor/panels.rs+++ b/crates/app/src/editor/panels.rs@@ -281,16 +281,43 @@ impl Editor {));}- fn about_panel(ui: &mut egui::Ui, update: Option<&crate::updates::Release>) {+ fn about_panel(&mut self, ui: &mut egui::Ui) {static LINES: std::sync::OnceLock<Vec<&'static str>> = std::sync::OnceLock::new();let lines = LINES.get_or_init(|| klad_core::notices::NOTICES.lines().collect());ui.label(RichText::new(format!("klad {}", crate::VERSION)).strong());- if let Some(release) = update {+ if let Some(checked) = self.update_check.as_ref().and_then(|c| c.try_recv().ok()) {+ self.update_check = None;+ self.update_said = Some(crate::updates::outcome(&checked));+ self.settings.updates_checked = crate::updates::now();+ self.settings_dirty = true;+ if let Ok(Some(release)) = checked {+ self.update = Some(release);+ self.update_said = None;+ }+ }+ if let Some(release) = &self.update {ui.horizontal(|ui| {ui.label(crate::updates::summary(release));ui.hyperlink_to("what changed", &release.url);});}+ ui.horizontal(|ui| {+ let checking = self.update_check.is_some();+ if ui+ .add_enabled(!checking, egui::Button::new("check now"))+ .hint("ask klad's releases whether a newer version is out")+ .clicked()+ {+ self.update_check = Some(crate::updates::spawn(self.update_feed.clone()));+ self.update_said = None;+ }+ if checking {+ ui.label(RichText::new("checking").color(theme::WEAK));+ ui.ctx().request_repaint_after(std::time::Duration::from_millis(100));+ } else if let Some(said) = &self.update_said {+ ui.label(RichText::new(said).color(theme::WEAK));+ }+ });ui.label("Source-available licence, copyright Indicode BV. Built on the open source work listed below; klad licences prints the same.");ui.add_space(6.0);ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);@@ -637,7 +664,7 @@ impl Editor {"about",(format!("{} About klad", icon::INFO), settings_at),&mut open,- |ui| Self::about_panel(ui, self.update.as_ref()),+ |ui| self.about_panel(ui),);self.windows.about &= open;}diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex 8f9fc5d..1b94358 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -2668,3 +2668,43 @@ fn a_problem_report_holds_the_version_the_system_and_the_last_messages() {);let _ = std::fs::remove_dir_all(&path);}++#[test]+fn check_now_in_about_says_what_the_releases_feed_holds() {+ let path = sample("check-now");+ let mut editor = editor(&path);+ let feed = path.with_extension("feed.json");+ std::fs::write(+ &feed,+ r#"{"tag_name":"v9.9.9","html_url":"https://github.com/klad-app/klad/releases","body":"- a test"}"#,+ )+ .unwrap();+ editor.update_feed = feed.display().to_string();+ editor.windows.about = true;+ let mut h = harness(editor, vec2(1440.0, 1000.0));+ h.run_steps(2);+ h.get_by_label("check now").click();+ let start = std::time::Instant::now();+ while h.query_by_label("klad 9.9.9 is out: a test").is_none() && start.elapsed().as_secs() < 10 {+ h.run_steps(1);+ std::thread::sleep(std::time::Duration::from_millis(10));+ }+ assert!(h.query_by_label("klad 9.9.9 is out: a test").is_some());+ assert!(h.state().settings.updates_checked > 0);+ std::fs::write(&feed, "not json").unwrap();+ h.get_by_label("check now").click();+ let start = std::time::Instant::now();+ while h+ .query_by_label("could not check: the releases feed did not make sense")+ .is_none()+ && start.elapsed().as_secs() < 10+ {+ h.run_steps(1);+ std::thread::sleep(std::time::Duration::from_millis(10));+ }+ assert!(+ h.query_by_label("could not check: the releases feed did not make sense")+ .is_some()+ );+ let _ = std::fs::remove_file(&feed);+}diff --git a/crates/app/src/home.rs b/crates/app/src/home.rsindex 4fff1fd..573d4c4 100644--- a/crates/app/src/home.rs+++ b/crates/app/src/home.rs@@ -45,7 +45,7 @@ pub(crate) struct Home {gpu: Option<egui_wgpu::RenderState>,themed: bool,pub(crate) update: Option<crate::updates::Release>,- checking: bool,+ checking: Option<std::sync::mpsc::Receiver<updates::Checked>>,}impl Home {@@ -62,8 +62,7 @@ impl Home {home.settings.updates_checked,updates::now(),) {- updates::start(updates::feed());- home.checking = true;+ home.checking = Some(updates::spawn(updates::feed()));}home.begin(&cc.egui_ctx, path);Ok(home)@@ -82,7 +81,7 @@ impl Home {gpu,themed: false,update: None,- checking: false,+ checking: None,}}@@ -124,13 +123,10 @@ impl Home {}fn checked(&mut self) {- if !self.checking {- return;- }- let Some(result) = updates::take() else {+ let Some(result) = self.checking.as_ref().and_then(|c| c.try_recv().ok()) else {return;};- self.checking = false;+ self.checking = None;let now = updates::now();self.settings.updates_checked = now;match self.editor.as_mut() {@@ -144,7 +140,7 @@ impl Home {}}}- if let Some(release) = result {+ if let Ok(Some(release)) = result {if let Some(editor) = self.editor.as_mut() {editor.say(Tone::Info, updates::summary(&release));}@@ -155,6 +151,9 @@ impl Home {pub(crate) fn frame(&mut self, ui: &mut egui::Ui) {let ctx = ui.ctx().clone();self.checked();+ if self.checking.is_some() {+ ctx.request_repaint_after(std::time::Duration::from_millis(200));+ }if let Some(editor) = self.editor.as_mut()&& editor.update.is_none(){diff --git a/crates/app/src/lib.rs b/crates/app/src/lib.rsindex e710d66..e3814b4 100644--- a/crates/app/src/lib.rs+++ b/crates/app/src/lib.rs@@ -20,7 +20,7 @@ mod start;mod stats;mod sync;mod theme;-mod updates;+pub mod updates;mod view;pub use home::run;diff --git a/crates/app/src/updates.rs b/crates/app/src/updates.rsindex 26027ae..28b1e43 100644--- a/crates/app/src/updates.rs+++ b/crates/app/src/updates.rs@@ -1,5 +1,4 @@use serde::Deserialize;-use std::sync::{Mutex, OnceLock};use std::time::{SystemTime, UNIX_EPOCH};pub const FEED: &str = "https://api.github.com/repos/klad-app/klad/releases/latest";@@ -50,27 +49,44 @@ pub fn now() -> u64 {SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())}-fn fetch(feed: &str) -> Option<String> {- match feed.starts_with("http") {- true => std::process::Command::new("curl")- .args([- "-fsSL",- "--max-time",- "10",- "-H",- "Accept: application/vnd.github+json",- feed,- ])- .output()- .ok()- .filter(|o| o.status.success())- .map(|o| String::from_utf8_lossy(&o.stdout).to_string()),- false => std::fs::read_to_string(feed).ok(),+pub type Checked = Result<Option<Release>, String>;++fn answer(code: &str, body: &str) -> Result<String, String> {+ match code.trim() {+ "200" => Ok(body.to_string()),+ "404" => Err("no release of klad is published yet".to_string()),+ other => Err(format!("the releases feed answered {other}")),+ }+}++fn fetch(feed: &str) -> Result<String, String> {+ if !feed.starts_with("http") {+ return std::fs::read_to_string(feed).map_err(|e| format!("reading {feed}: {e}"));}+ let out = std::process::Command::new("curl")+ .args([+ "-sSL",+ "--max-time",+ "10",+ "-H",+ "Accept: application/vnd.github+json",+ "-w",+ "\n%{http_code}",+ feed,+ ])+ .output()+ .map_err(|e| format!("could not run curl: {e}"))?;+ if !out.status.success() {+ return Err("could not reach the releases feed (no network?)".to_string());+ }+ let text = String::from_utf8_lossy(&out.stdout);+ let (body, code) = text.rsplit_once('\n').unwrap_or(("", &text));+ answer(code, body)}-pub fn check(feed: &str, current: &str) -> Option<Release> {- parse(&fetch(feed)?).filter(|r| newer(current, &r.version))+pub fn check(feed: &str, current: &str) -> Checked {+ let release = parse(&fetch(feed)?).ok_or_else(|| "the releases feed did not make sense".to_string())?;+ Ok(Some(release).filter(|r| newer(current, &r.version)))}pub fn summary(release: &Release) -> String {@@ -85,25 +101,23 @@ pub fn summary(release: &Release) -> String {}}-type Found = Mutex<Option<Option<Release>>>;--fn found() -> &'static Found {- static FOUND: OnceLock<Found> = OnceLock::new();- FOUND.get_or_init(|| Mutex::new(None))+pub fn outcome(checked: &Checked) -> String {+ match checked {+ Ok(Some(release)) => summary(release),+ Ok(None) => format!("klad {} is the newest version", env!("CARGO_PKG_VERSION")),+ Err(e) => format!("could not check: {e}"),+ }}-pub fn start(feed: String) {+pub fn spawn(feed: String) -> std::sync::mpsc::Receiver<Checked> {+ let (send, receive) = std::sync::mpsc::channel();std::thread::Builder::new().name("klad update check".into()).spawn(move || {- let result = check(&feed, env!("CARGO_PKG_VERSION"));- *found().lock().unwrap_or_else(|e| e.into_inner()) = Some(result);+ let _ = send.send(check(&feed, env!("CARGO_PKG_VERSION")));}).ok();-}--pub fn take() -> Option<Option<Release>> {- found().lock().unwrap_or_else(|e| e.into_inner()).take()+ receive}pub fn feed() -> String {@@ -129,15 +143,34 @@ mod tests {.unwrap()};write("v0.2.0");- let found = check(feed.to_str().unwrap(), "0.1.0").unwrap();+ let found = check(feed.to_str().unwrap(), "0.1.0").unwrap().unwrap();assert_eq!(found.version, "0.2.0");assert_eq!(summary(&found),"klad 0.2.0 is out: Paint over: brushwork from any picture");write("v0.1.0");- assert!(check(feed.to_str().unwrap(), "0.1.0").is_none());- assert!(check(dir.join("missing.json").to_str().unwrap(), "0.1.0").is_none());+ assert_eq!(check(feed.to_str().unwrap(), "0.1.0"), Ok(None));+ assert_eq!(+ outcome(&Ok(None)),+ format!("klad {} is the newest version", env!("CARGO_PKG_VERSION"))+ );+ let missing = check(dir.join("missing.json").to_str().unwrap(), "0.1.0");+ assert!(+ outcome(&missing).starts_with("could not check: reading "),+ "{missing:?}"+ );+ std::fs::write(&feed, "<html>").unwrap();+ assert_eq!(+ check(feed.to_str().unwrap(), "0.1.0"),+ Err("the releases feed did not make sense".to_string())+ );+ assert_eq!(+ answer("404", ""),+ Err("no release of klad is published yet".to_string())+ );+ assert_eq!(answer("503", ""), Err("the releases feed answered 503".to_string()));+ assert_eq!(answer("200", "{}"), Ok("{}".to_string()));assert!(newer("0.9.3", "0.10.0") && !newer("1.2.0", "1.1.9") && newer("0.1.0", "v0.1.1"));assert!(due(true, 0, DAY) && !due(true, DAY, DAY + 60) && !due(false, 0, 10 * DAY));std::fs::remove_dir_all(&dir).unwrap();@@ -149,12 +182,9 @@ mod tests {std::fs::create_dir_all(&dir).unwrap();let feed = dir.join("latest.json");std::fs::write(&feed, r#"{"tag_name":"v99.0.0","html_url":"https://example.org"}"#).unwrap();- start(feed.display().to_string());- let found = (0..200).find_map(|_| {- std::thread::sleep(std::time::Duration::from_millis(10));- take()- });- assert_eq!(found.flatten().map(|r| r.version), Some("99.0.0".to_string()));+ let checking = spawn(feed.display().to_string());+ let found = checking.recv_timeout(std::time::Duration::from_secs(5)).unwrap();+ assert_eq!(found.unwrap().map(|r| r.version), Some("99.0.0".to_string()));std::fs::remove_dir_all(&dir).unwrap();}}diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rsindex 48001e8..0eb7bb4 100644--- a/crates/cli/src/main.rs+++ b/crates/cli/src/main.rs@@ -1703,6 +1703,12 @@ enum Command {Skill,#[command(hide = true, about = "Print the command reference, docs/cli.md")]Reference,+ #[cfg(feature = "editor")]+ #[command(+ about = "Check now whether a newer klad is out (the editor also checks once a day by itself)",+ long_about = "Check now whether a newer klad is out, on klad's releases page (the editor also checks once a day by itself, and its About window has check now). KLAD_UPDATE_FEED points it at another feed, a URL or a JSON file shaped like GitHub's latest release.\n\n klad updates"+ )]+ Updates,#[command(about = "Measure stroke storage, brush speed, replay, cache and compositing")]Bench {#[arg(long, default_value_t = 10_000)]@@ -3289,6 +3295,16 @@ fn run() -> Result<()> {Command::Install { dir } => install::install(dir.as_deref())?,Command::Skill => print!("{}", include_str!("../../../docs/skill/SKILL.md")),Command::Reference => print!("{}", reference()),+ #[cfg(feature = "editor")]+ Command::Updates => {+ use klad_app::updates;+ let checked = updates::check(&updates::feed(), env!("CARGO_PKG_VERSION"));+ match &checked {+ Ok(Some(release)) => println!("{}\n{}", updates::outcome(&checked), release.url),+ Ok(None) => println!("{}", updates::outcome(&checked)),+ Err(_) => bail!(updates::outcome(&checked)),+ }+ }Command::Bench { strokes, size, seed } => bench::run(strokes, size, seed)?,#[cfg(feature = "editor")]Command::Open { bundle } => klad_app::run(bundle)?,diff --git a/crates/cli/tests/binary.rs b/crates/cli/tests/binary.rsindex f06b917..78d1221 100644--- a/crates/cli/tests/binary.rs+++ b/crates/cli/tests/binary.rs@@ -107,3 +107,34 @@ fn the_client_makes_edits_reads_and_renders_a_drawing() {assert!(matches!(missing, Error::Failed { .. }), "{missing}");std::fs::remove_dir_all(&dir).unwrap();}++#[test]+fn updates_says_what_the_feed_holds() {+ let dir = std::env::temp_dir().join(format!("draw-binary-updates-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ let feed = dir.join("latest.json");+ let run = |feed: &std::path::Path| {+ Command::new(env!("CARGO_BIN_EXE_klad"))+ .arg("updates")+ .env("KLAD_UPDATE_FEED", feed)+ .output()+ .unwrap()+ };+ std::fs::write(+ &feed,+ r#"{"tag_name":"v9.9.9","html_url":"https://github.com/klad-app/klad/releases","body":"- a test"}"#,+ )+ .unwrap();+ let out = run(&feed);+ assert!(out.status.success());+ assert_eq!(+ String::from_utf8_lossy(&out.stdout),+ "klad 9.9.9 is out: a test\nhttps://github.com/klad-app/klad/releases\n"+ );+ std::fs::write(&feed, r#"{"tag_name":"v0.0.1","html_url":"https://example.org"}"#).unwrap();+ assert!(String::from_utf8_lossy(&run(&feed).stdout).contains("is the newest version"));+ let missing = run(&dir.join("missing.json"));+ assert!(!missing.status.success());+ assert!(String::from_utf8_lossy(&missing.stderr).starts_with("error: could not check: reading"));+ std::fs::remove_dir_all(&dir).unwrap();+}diff --git a/docs/DESIGN.md b/docs/DESIGN.mdindex 006eb1b..f6daef2 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`, `.draw` 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. 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.+**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`, `.draw` 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. 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.### Stackdiff --git a/docs/cli.md b/docs/cli.mdindex 6e4fbb1..721346f 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -75,6 +75,7 @@ This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad it- [`klad licences`](#klad-licences): Print the licence and the third-party notices (every open source part klad is built on)- [`klad install`](#klad-install): Put klad on the terminal's path, for you and for agents- [`klad skill`](#klad-skill): Print the agent skill: how an agent draws with klad (the same text as docs/skill/SKILL.md)+- [`klad updates`](#klad-updates): Check now whether a newer klad is out (the editor also checks once a day by itself)- [`klad bench`](#klad-bench): Measure stroke storage, brush speed, replay, cache and compositing- [`klad open`](#klad-open): Open the editor, on a bundle or on the start window (new, open, recent)@@ -3293,6 +3294,20 @@ Options:Print help```+## klad updates++```text+Check now whether a newer klad is out, on klad's releases page (the editor also checks once a day by itself, and its About window has check now). KLAD_UPDATE_FEED points it at another feed, a URL or a JSON file shaped like GitHub's latest release.++ klad updates++Usage: klad updates++Options:+ -h, --help+ Print help (see a summary with '-h')+```+## klad bench```text