A drawing app built for agent/human collaboration
Rust
Help leads to the guides
Indicode BVf09475bd0aab
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d71787b..bb084e1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ The first builds, and klad's licences.- 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.- Help > Report a problem shows the report before it is copied (version, system, the last messages and lines of klad's log, with your home folder hidden) and can zip the drawing to attach; `klad report` prints the same. Errors and crashes are kept in a small log for it.+- Help > Guides and Help > What's new open klad's guides and this changelog on klad.studio; the welcome on the start window links the guides too.- Support by email: Help > Contact support opens an email to [email protected] with the version and your system filled in; Report a problem can email its report there too, and About links klad.studio and the address. Crash messages name the address as well as the issues page.- Messages say what happened and what to do next; when klad itself goes wrong it says so, and that your work is saved.- Bones: a bones layer holds a skeleton (`klad bone`, the bone tool J), weights from the bones or painted (`klad weights`), and poses that bend the drawing (`klad pose`, pose mode); in-betweens of two poses turn the bones. The bone tool lists the skeleton, picks a bone in every mode, and moves ends, joints and whole bones with their children (`klad bone --move` with `--by`).diff --git a/crates/app/src/commands.rs b/crates/app/src/commands.rsindex 2e3ce8e..66d8cff 100644--- a/crates/app/src/commands.rs+++ b/crates/app/src/commands.rs@@ -154,6 +154,8 @@ pub enum Cmd {InstallCommand,ReportProblem,ContactSupport,+ Guides,+ WhatsNew,PaintOver,CompareReference,About,@@ -494,7 +496,7 @@ use Repeat as R;use Trigger as T;impl Cmd {- pub const ALL: [Cmd; 167] = [+ pub const ALL: [Cmd; 169] = [Cmd::Brush,Cmd::Eraser,Cmd::Fill,@@ -652,6 +654,8 @@ impl Cmd {Cmd::InstallCommand,Cmd::ReportProblem,Cmd::ContactSupport,+ Cmd::Guides,+ Cmd::WhatsNew,Cmd::About,Cmd::Export,Cmd::AddFont,@@ -2142,6 +2146,24 @@ impl Cmd {R::No,"an email to klad's support in your email app, with the version and your system filled in",),+ Cmd::Guides => spec(+ "help.guides",+ "guides",+ icon::FILE,+ G::Panels,+ T::None,+ R::No,+ "klad's guides on klad.studio, in your browser: drawing, colour, animating, posing and exporting",+ ),+ Cmd::WhatsNew => spec(+ "help.whats-new",+ "what's new",+ icon::SPARKLE,+ G::Panels,+ T::None,+ R::No,+ "what changed in each version of klad, on klad.studio",+ ),Cmd::InstallCommand => spec("file.install-command","install the klad command",@@ -2317,6 +2339,8 @@ impl Cmd {Cmd::InstallCommand => "Install the klad command",Cmd::ReportProblem => "Report a problem…",Cmd::ContactSupport => "Contact support",+ Cmd::Guides => "Guides",+ Cmd::WhatsNew => "What's new",Cmd::PaintOver => "Paint over…",Cmd::CompareReference => "Compare with reference",Cmd::About => "About klad and licences",@@ -2618,6 +2642,8 @@ pub const MENUS: [Menu; 9] = [title: "Help",items: &[Run(Cmd::FirstSteps),+ Run(Cmd::Guides),+ Run(Cmd::WhatsNew),Run(Cmd::Palette),Run(Cmd::Keys),Line,diff --git a/crates/app/src/editor/commands.rs b/crates/app/src/editor/commands.rsindex f7da08d..af1f078 100644--- a/crates/app/src/editor/commands.rs+++ b/crates/app/src/editor/commands.rs@@ -672,6 +672,8 @@ impl Editor {Cmd::InstallCommand => self.start_job(install_job()),Cmd::ReportProblem => self.windows.report = !self.windows.report,Cmd::ContactSupport => self.contact_support(),+ Cmd::Guides => self.open_link(klad_core::contact::GUIDES.to_string()),+ Cmd::WhatsNew => self.open_link(klad_core::contact::CHANGES.to_string()),Cmd::CopyPath => {let path = self.scene.bundle.root.display().to_string();self.ctx.copy_text(path.clone());diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex a90a957..836c556 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -4314,3 +4314,31 @@ fn help_reaches_support_by_email_and_about_links_the_site() {);let _ = std::fs::remove_dir_all(&path);}++#[test]+fn help_opens_the_guides_and_whats_new() {+ let path = sample("help-links");+ let mut h = harness(editor(&path), vec2(1440.0, 1000.0));+ [+ (Cmd::Guides, "https://klad.studio/docs"),+ (Cmd::WhatsNew, "https://klad.studio/docs/changelog"),+ ]+ .into_iter()+ .for_each(|(cmd, url)| {+ h.state_mut().invoke(cmd).unwrap();+ h.run_steps(1);+ assert_eq!(h.state().opened.last().map(String::as_str), Some(url), "{cmd:?}");+ });+ let help = crate::commands::MENUS.iter().find(|m| m.title == "Help").unwrap();+ [Cmd::FirstSteps, Cmd::Guides, Cmd::WhatsNew, Cmd::ContactSupport]+ .into_iter()+ .for_each(|cmd| {+ assert!(+ help.items+ .iter()+ .any(|i| matches!(i, crate::commands::Item::Run(c) if *c == cmd)),+ "Help has {cmd:?}"+ );+ });+ let _ = std::fs::remove_dir_all(&path);+}diff --git a/crates/app/src/home.rs b/crates/app/src/home.rsindex ef86ca5..57d1e02 100644--- a/crates/app/src/home.rs+++ b/crates/app/src/home.rs@@ -541,6 +541,7 @@ mod tests {h.query_by_label("Welcome to klad").is_some(),"a first start says hello");+ assert!(h.query_by_label("Guides").is_some(), "and links the guides");assert!(h.query_by_label("a rock on its own").is_some(),"the samples show with what they are"diff --git a/crates/app/src/start.rs b/crates/app/src/start.rsindex 235392f..4de6557 100644--- a/crates/app/src/start.rs+++ b/crates/app/src/start.rs@@ -173,6 +173,8 @@ impl Start {settings.welcomed = true;self.changed = true;}+ ui.hyperlink_to("Guides", klad_core::contact::GUIDES)+ .on_hover_text("klad's guides on klad.studio, in your browser");});});chosendiff --git a/crates/core/src/contact.rs b/crates/core/src/contact.rsindex de9ec75..dbd1962 100644--- a/crates/core/src/contact.rs+++ b/crates/core/src/contact.rs@@ -1,6 +1,8 @@pub const SUPPORT: &str = "[email protected]";pub const SITE: &str = "https://klad.studio";pub const ISSUES: &str = "https://github.com/klad-app/klad/issues";+pub const GUIDES: &str = "https://klad.studio/docs";+pub const CHANGES: &str = "https://klad.studio/docs/changelog";pub fn mailto(subject: &str, body: &str) -> String {format!(diff --git a/docs/DESIGN.md b/docs/DESIGN.mdindex b266a6f..57e9575 100644--- a/docs/DESIGN.md+++ b/docs/DESIGN.md@@ -439,7 +439,7 @@ Scripts are any language that prints edit ops as JSON lines into `klad apply`. G- Commands (M4 batch 1): every editor action is a `Cmd` in one list (`commands.rs`): an id (`tool.brush`, `drawing.new`, kept in settings), a name in plain words, a Phosphor icon, a group, its keys or the hold that triggers it, whether a held key repeats it, and a line on what it does. Keys, the strip, panel buttons, the timeline's buttons and context menu, and the palette all run commands through `Editor::invoke`, which first asks `can_run` (a reason when it cannot, shown as a refusal) and remembers the last twelve run. A key matches only with exactly its modifiers (shift K is not K); key repeats run commands that repeat (`=`, `[`, cmd Z) and frame steps only once the frame on screen caught up. cmd K opens the palette: type to filter (name start, then a key, a word, a substring, the letters in order, the group; hyphens ignored, so "inb" finds in-between), arrows and Return run, rows grey out with the reason, recent commands first; `?` opens it too. Every control has a hover hint after 0.35 s (from its command where there is one) and is at least 24 pt high; a test walks every control of every panel and window to keep it so.- Tool options and selections (M4 batch 2): a bar over the canvas holds the active tool's settings (brush: picker, size, opacity, flow, and a "more" menu for hardness, lightest size, curve, taper, stabiliser and smoothing; fill: reference, gap, tolerance, grow, opacity; strokes: cut at the lasso edge, select all; points: corner, smooth, simplify, make it a path). The strip shows the eraser while the eraser brush or the pen's eraser end is on, and two colours (the current one over the second; X or a click swaps them; picking a colour from a swatch, the hex field or the eyedropper makes the old one the second). cmd alt drag sideways on the canvas sizes the brush (doubling every 120 pt), the circle staying where the drag began. H flips the view left-right (the view's mappings and the GPU matrix mirror; the document does not change); the status line's zoom takes a click for 100% and a double-click to fit, its rotation a click to turn upright. A selection bar sits under (or over) the selection's box: for strokes flips, quarter turns, recolour, thinner, thicker, opacity, copy, paste, duplicate in place, delete, deselect; for a shape flips (sx or sy negated and its rotation mirrored), quarter turns, fill with the colour and outline in the colour (rectangles, ellipses, paths and text: `fill`, or `stroke.paint`, or a new `stroke` at the pen's width when it had none; Edit > Shape; `klad set <id> fill=...` is the CLI form), duplicate in place (an `add` of the node without ids, above it), delete, deselect; for points corner, smooth, nudges, delete. Arrows nudge strokes, a shape or points by 1 px, 10 px with shift. Strokes select across layers (M5 batch 2 round 1): cmd or shift click on rows in the layers panel adds paint layers to the active one (marked with a blue edge); S then lassos, clicks and selects all on all of them, and the selection (one part per layer) moves, turns, scales, flips, recolours, cuts at the lasso edge, copies and deletes as one edit, each layer's marks staying on their layer. A selection on several layers moves as one edit, each layer previewed while it is dragged; copies of several layers paste back into their own layers, a copy of one layer into the active one. The strip's panels button lists the six panels and the timeline with a tick each, so a closed panel always has a way back. U draws rectangles and ellipses on a vector layer (shift for a square or circle, alt from the centre, rounded corners for rectangles; fill, outline and width shared with the pen, the fill in the first colour and the outline in the second, as for the pen's paths) as `rect` and `ellipse` nodes. Mirror painting (the brush bar's "mirror" and its axis) paints every stroke's mirror image as it is drawn, in a second stroke buffer landed after the first, and commits both as plain marks in one history step. Handles are drawn at 12 pt and hit within 12 pt (`grab`); a press becomes a drag once it has moved 3 pt on screen, so a tap that wobbles selects and does not move; shapes whose rotation is a quarter turn get edge handles too (`lift::stretched` scales their own axis). Pen events that arrive while a point edit is being written are held and replayed in order after it. The colour pane shows the picker and the palette (swatches drag to reorder; the x in a hovered swatch's corner, or a right-click, removes it) and recent colours; the brush pane (its own since 2026-11-08, Kevin: "make brush its own palette, like colour and layers") the size presets and the brushes as tiles, each with a sample stroke drawn by `klad-brush` once per brush definition. A saved layout without a pane gets it after the pane it follows by default.- First start (S8.7, `start.rs`, `editor/first.rs`, `klad_core::samples`): until the settings say `welcomed` (set when any drawing opens, or by "Not now"), the start window opens with a welcome offering first steps. First steps make `first steps.klad` (1280 by 800 on paper, one paint layer) in the drawings folder and open it with a small window of three steps that tick as they happen: a brush stroke is saved, a fill is saved, the request for an agent is copied (a sentence with the drawing's path asking the agent to read `klad skill`, render the drawing and add a shadow; "install the klad command" sits next to it). Help > First steps opens and closes the window on any drawing. The checklist is the editor's alone: it teaches the hands on the canvas, and an agent's first steps are `klad skill`. Revisit the third step when klad is an MCP server (S8.10). Under the recent drawings the start window shows the samples: the drawings `samples/shipped.json` names (name, bundle, a line on what it shows), each a card with its thumbnail and that line; a click copies it into the drawings folder without its `.cache` (`samples::copy`, `<name>.klad` or `<name> 2.klad`) and opens the copy, so a sample is never changed. `klad samples` lists the same set and `--copy <name> [--into folder]` copies one (default the current folder). Samples are found like the fonts: `KLAD_SAMPLES`, then `samples/` next to the binary, `../Resources/samples`, `../share/klad/samples`, and a source checkout's `samples/` up to five folders above the binary (where they exist after `just samples`; a sample not built is left out). `packaging/samples.sh` puts them in every build: it builds any that are missing with that build's `klad` (through the sample's `build.sh`, `PYTHON` naming the interpreter), copies them without caches, and renders each one's `<name>.thumb.png` next to it at 336 px, so the start window never renders into the app (a thumbnail outside the bundle is used as it is; only recent drawings' `.cache/thumb.png` are remade when the drawing changes). `app.sh` puts them in `Resources/samples`, `archive.sh` in the archive's `samples/` and the AppImage's `usr/share/klad/samples`; the six weigh about 4 MB.-- Messages and problem reports (S8.8, `report.rs`): a message says what happened and what to do next ("nothing to fill there: click inside closed lines, or raise the gap so small openings close"); a refusal names the step that makes the command possible. Errors that mean klad itself went wrong (an invariant broken, a picture missing that should be there) are `report::Bug`s: the editor says "something went wrong inside klad (what), everything up to your last edit is saved; Help > Report a problem sends it to [email protected] or to klad's issues" instead of the bare detail; a job whose CLI crashed reads the same, and a job that failed says "<job> did not finish: <the CLI's reason>". Every error message, job failure and crash of the editor or the CLI is appended to `klad.log` next to the settings (`KLAD_LOG` overrides it; past 512 KB the older half goes), one dated line each. Help > Report a problem opens a window with the report as it will be copied: klad's version and where it ran, the system (macOS version, the Linux distribution, Windows' version, and the processor), a place for what happened, the drawing's size, the last 40 messages and the last 40 lines of the log, with the home folder written as `~` and the drawing's folder as `<the drawing's folder>`. "include the drawing" zips the drawing without its cache next to it (`<name> for a report.zip`, stored entries, written by klad itself) and the report names the file to attach; "copy the report" copies it, "email it to support" opens an email to the support address with the report in it (the person attaches the zip), and "open klad's issues" opens GitHub. Help > Contact support opens an email with the version and the system filled in, and About links klad.studio and the address. The address, the site and the issues page are constants in `klad_core::contact`; the site's sync reads the address from there. Nothing is sent by klad. `klad report [--drawing <bundle>]` prints the same report from the command line (version, system, log, the drawing zipped).+- Messages and problem reports (S8.8, `report.rs`): a message says what happened and what to do next ("nothing to fill there: click inside closed lines, or raise the gap so small openings close"); a refusal names the step that makes the command possible. Errors that mean klad itself went wrong (an invariant broken, a picture missing that should be there) are `report::Bug`s: the editor says "something went wrong inside klad (what), everything up to your last edit is saved; Help > Report a problem sends it to [email protected] or to klad's issues" instead of the bare detail; a job whose CLI crashed reads the same, and a job that failed says "<job> did not finish: <the CLI's reason>". Every error message, job failure and crash of the editor or the CLI is appended to `klad.log` next to the settings (`KLAD_LOG` overrides it; past 512 KB the older half goes), one dated line each. Help > Report a problem opens a window with the report as it will be copied: klad's version and where it ran, the system (macOS version, the Linux distribution, Windows' version, and the processor), a place for what happened, the drawing's size, the last 40 messages and the last 40 lines of the log, with the home folder written as `~` and the drawing's folder as `<the drawing's folder>`. "include the drawing" zips the drawing without its cache next to it (`<name> for a report.zip`, stored entries, written by klad itself) and the report names the file to attach; "copy the report" copies it, "email it to support" opens an email to the support address with the report in it (the person attaches the zip), and "open klad's issues" opens GitHub. Help > Contact support opens an email with the version and the system filled in, and About links klad.studio and the address. Help > Guides and Help > What's new open the guides and the changelog on klad.studio, and the start window's welcome links the guides. The address, the site, the issues page, the guides and the changelog are constants in `klad_core::contact`; the site's sync reads the address from there. Nothing is sent by klad. `klad report [--drawing <bundle>]` prints the same report from the command line (version, system, log, the drawing zipped).- Menus (S8.6, `commands::MENUS`, `menus.rs`): one list of menus holds every command but the holds (pan, zoom, the eyedropper, flipping, rolling, the parallax preview and sizing on the canvas, which are gestures), so the menus, the palette and the keys stay one list; a test fails when a command is in no menu or in two. The menus, in order: File (new, open, recent, close; import; export; the path and the command line tool), Edit (undo; copy, paste, duplicate, delete; selecting; Transform, Strokes and Points submenus), Tools (the tools, the brush, the colours), Layer (new, duplicate, rename, group, delete; show, lock, clip, lock alpha; Mask and Shape generators submenus, paint over; refill and gaps), Frame (stepping, drawings, holds and moves, inserting and removing frames), Animation (playback, onion skin, exposure, Selected frames and Clip submenus, the checks across frames), View (zoom, rotation, flip, the reference), Window (the panels, the message log, numbers) and Help. Each command has a short menu label (`Cmd::menu`: "Show", "Clip to layer below", "Export…"), since the menu says what it acts on, while the palette and hints keep the longer names; "…" marks a command that opens a window. Items show one key each (Backspace for delete); toggles show a tick, except commands that open a window; a command that cannot run now is greyed out (its reason is the palette's). A test keeps labels unique in each menu and under 30 characters. On macOS the list becomes the system menu bar (`menus::install`, rebuilt when the keys or the recent drawings change): an app menu with About, Settings, Services, hide and Quit, then the list, whose Window menu also gets the system's Minimize, Zoom and Bring all to front (it is the app's windows menu). Items target one Objective-C object (`KladMenuTarget`, `define_class!`) whose `kladRun:` queues the command for the next frame (the editor runs it through `Editor::invoke` as any key would) and whose `validateMenuItem:` reads a snapshot of what is off and on that the app refreshes every 0.4 s. The item keys are shown but not claimed: the object is each menu's delegate and answers no to `menuHasKeyEquivalent:forEvent:target:action:`, so a key still reaches the editor's own dispatch (which knows holds, repeats and text fields) and nothing runs twice; only the app menu's own keys (cmd , cmd Q cmd H) and Window's cmd M are AppKit's. On Windows and Linux (and in tests) the same list is an egui menu bar over the window, hidden with the panels (Tab). File > Open recent lists the last ten drawings; File > Close the drawing (cmd W, refused while a job runs) goes back to the start window, where only new, open, recent and quit run. Settings and Quit sit in the app menu on macOS and in Edit and File elsewhere; About (with the licences) is in Help everywhere and also in the macOS app menu.- Messages and jobs (M4 batch 1): every result, refusal and error goes through `Editor::say` with a tone (info, done, refused, error). Done and refused messages show for 3.5 and 6 s as a toast in the bottom left corner of the canvas, newest lowest (2026-11-08: they used to follow the pointer, which got in the way), errors until dismissed, info only in the status line; the status line shows the latest message (a click opens the message log, the last 200 with times), the frame, where the next stroke goes ("draws into c12 on lines, frames 4 to 7"), running jobs with a cancel button, slow internal work (preparing a selection, drawing an edited path, loading a frame), zoom and rotation. Times that used to be status text (stroke, fill, edit, undo, sync, frame step, last play, last job) are kept by name for the numbers window. Background jobs (in-betweens, Godot export) run the same `klad` binary through one job list (`jobs.rs`); when the CLI exits with code 75 (the document changed while it computed) the job runs again, up to three times, so an edit made in the editor meanwhile is never overwritten.- Tools: brush, eraser, smudge, fill (inside lines, gap closing), lasso select and transform, move/rotate/scale handles, path point editing, eyedropper.