Skip to content

armgit / kanzo

Public Imported from GitHub
0

Self-hosted, sharable kanban for humans and agents. One 4.7 MB binary, 5 MB of RAM, 10 to 60 tokens per agent reply, starts in 3 ms, zero setup.

Install the board as an app, with shortcuts for projects

emanuele-emfd85fb0e734f
diff --git a/README.md b/README.md
index 1dd7d21..b9eedd1 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,9 @@ kanzo
The board opens at http://localhost:4242. That's all the setup there is: the first run creates `~/kanzo`, and the whole board lives in it.
-`n` adds a task, `/` or `⌘K` searches every project, `⌘`-click or a drag on empty board space selects tasks to move, tag or delete together, `f` filters the board and `↵` keeps the filter, `Tab` moves to the description, `⌘↵` saves and closes. `Esc` leaves a description or tags with what you typed saved, and cancels other fields. Mark a task Human and agents leave it to you; the person icon shows only those. Paste or drop an image into a task or a comment to attach it. Give a task a URL, like its pull request on any site, and click the link on its card to open it; agents set it with `url`. A link to a file in a description or comment, `[name](file:///path)`, opens in your editor. When a new version is out, the sidebar offers it: one click installs it.
+`n` adds a task, `/` or `⌘K` searches every project, `⌘`-click or a drag on empty board space selects tasks to move, tag or delete together, `f` filters the board and `↵` keeps the filter, `Tab` moves to the description, `⌘↵` saves and closes. `Esc` leaves a description or tags with what you typed saved, and cancels other fields. In Chrome or Edge, **Install app** at the bottom of the sidebar makes the board an app of its own; on macOS `kanzo` then opens it instead of a tab, on the default port. In the app, `⌘1`–`⌘8` pick a project, `⌘9` the last one and `⌘0` all of them.
+
+Mark a task Human and agents leave it to you; the person icon shows only those. Paste or drop an image into a task or a comment to attach it. Give a task a URL, like its pull request on any site, and click the link on its card to open it; agents set it with `url`. A link to a file in a description or comment, `[name](file:///path)`, opens in your editor. When a new version is out, the sidebar offers it: one click installs it.
## Connect your agents
diff --git a/src/app.js b/src/app.js
index 9d3b7ba..8781b22 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1370,6 +1370,13 @@ document.addEventListener("keydown", (e) => {
const typing = e.target.closest("input, textarea, select");
const plain = !typing && !e.metaKey && !e.ctrlKey;
if (e.key === "Escape" && state.menu) { closeMenu(); return; }
+ // Only in the installed app: in a browser tab, these keys belong to the browser.
+ if (/^\d$/.test(e.key) && (e.metaKey || e.ctrlKey) && state.board && matchMedia("(display-mode: standalone)").matches) {
+ const { projects } = state.board;
+ const slug = e.key === "0" ? "all" : projects[e.key === "9" ? projects.length - 1 : e.key - 1]?.slug;
+ e.preventDefault();
+ if (slug) setProject(slug);
+ }
if (e.key === "Escape" && state.task && !typing) closeTask();
if (e.key === "Escape" && !typing) clearSelection();
if ((e.key === "/" && plain) || (e.key === "k" && (e.metaKey || e.ctrlKey))) {
@@ -1733,6 +1740,16 @@ async function installUpdate(available) {
location.reload();
}
+// Chromium's browsers ask this only while the board isn't installed; the others never do.
+let installPrompt;
+window.addEventListener("beforeinstallprompt", (e) => {
+ e.preventDefault();
+ installPrompt = e;
+ $("#install").hidden = false;
+});
+window.addEventListener("appinstalled", () => { $("#install").hidden = true; });
+$("#install").addEventListener("click", () => installPrompt.prompt());
+
checkUpdate();
setInterval(checkUpdate, 24 * 60 * 60 * 1000);
loadSyncRemote();
diff --git a/src/icon.png b/src/icon.png
new file mode 100644
index 0000000..a905542
Binary files /dev/null and b/src/icon.png differ
diff --git a/src/index.html b/src/index.html
index 5385103..254accb 100644
--- a/src/index.html
+++ b/src/index.html
@@ -5,6 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kanzo</title>
<link rel="icon" href="/logo.png">
+<link rel="manifest" href="/manifest.webmanifest">
+<link rel="apple-touch-icon" href="/icon.png">
+<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f9f9f9">
+<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000">
<style>
:root {
--bg: #ffffff; --sidebar: #f9f9f9; --col: #f7f7f7; --card: #ffffff; --card-hover: #f4f4f4; --panel: #ffffff;
@@ -497,6 +501,7 @@ label.setting { cursor: pointer; }
<button class="ghost" id="new-project-toggle"><span class="icon" data-icon="newProject"></span>New project</button>
<nav class="nav" id="nav"></nav>
<button class="ghost update" id="update" hidden><span class="icon" data-icon="update"></span><span id="update-label"></span></button>
+ <button class="ghost" id="install" title="Use the board as an app of its own" hidden><span class="icon" data-icon="update"></span>Install app</button>
<button class="ghost" id="settings" aria-haspopup="menu"><span class="icon" data-icon="settings"></span>Settings</button>
</aside>
diff --git a/src/web.rs b/src/web.rs
index f488dc0..4187ca6 100644
--- a/src/web.rs
+++ b/src/web.rs
@@ -25,10 +25,12 @@ const INDEX: &str = include_str!("index.html");
const IMAGE_LIMIT: usize = 25 * 1024 * 1024;
const APP_JS: &str = include_str!("app.js");
const LOGO: &[u8] = include_bytes!("logo.png");
+const ICON: &[u8] = include_bytes!("icon.png");
+const MANIFEST: &str = r##"{"id":"/","name":"Kanzo","start_url":"/","display":"standalone","background_color":"#ffffff","icons":[{"src":"/icon.png","sizes":"192x192 512x512","type":"image/png"}]}"##;
/// Scripts only from this server, so even a bug in the Markdown renderer cannot run injected script.
const CSP: &str = "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; \
- connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
+ connect-src 'self'; manifest-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
pub async fn serve(home: Home, open: bool) -> Result<()> {
let port = home.config.port;
@@ -40,7 +42,7 @@ pub async fn serve(home: Home, open: bool) -> Result<()> {
if share::is_kanzo(&format!("127.0.0.1:{port}")).await {
println!("Kanzo is already running at {url}");
if open {
- open_browser(&url);
+ open_board(&url, port);
}
return Ok(());
}
@@ -63,7 +65,9 @@ pub async fn serve(home: Home, open: bool) -> Result<()> {
println!("MCP over HTTP at {url}/mcp");
}
if open {
- open_browser(&url);
+ // It waits to see if there's an app, which must not hold up the board.
+ let url = url.clone();
+ tokio::task::spawn_blocking(move || open_board(&url, port));
}
// Cancelling this also ends open MCP streams, which would otherwise hold up shutdown.
let shutdown = CancellationToken::new();
@@ -171,6 +175,11 @@ fn router(home: Home, guard: Arc<Guard>, shutdown: CancellationToken) -> Router
.route("/", get(|| async { Html(INDEX) }))
.route("/app.js", get(|| async { ([(header::CONTENT_TYPE, "text/javascript; charset=utf-8")], APP_JS) }))
.route("/logo.png", get(|| async { ([(header::CONTENT_TYPE, "image/png")], LOGO) }))
+ .route("/icon.png", get(|| async { ([(header::CONTENT_TYPE, "image/png")], ICON) }))
+ .route(
+ "/manifest.webmanifest",
+ get(|| async { ([(header::CONTENT_TYPE, "application/manifest+json")], MANIFEST) }),
+ )
.route("/api/ping", get(|| async { "kanzo" }))
.route("/api/update", get(update_status).post(update_now))
.route("/api/network", get(network).post(change_network).route_layer(middleware::from_fn(this_computer)))
@@ -826,6 +835,21 @@ fn exit_with_console() {
}
}
+/// The installed app if there is one, or else a browser tab. An app opens the address it was
+/// installed from, so only on the default port, where that's this board.
+fn open_board(url: &str, port: u16) {
+ let app = cfg!(target_os = "macos")
+ && port == crate::home::DEFAULT_PORT
+ && std::process::Command::new("open")
+ .args(["-a", "Kanzo"])
+ .stderr(std::process::Stdio::null())
+ .status()
+ .is_ok_and(|s| s.success());
+ if !app {
+ open_browser(url);
+ }
+}
+
fn open_browser(url: &str) {
let opener = if cfg!(target_os = "macos") {
"open"