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.

Move sync and updates into a settings menu

emanuele-em4e1b1b2f3f6c
diff --git a/README.md b/README.md
index 1700f9c..c4e060b 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,8 @@ Every command takes `--home <dir>` to use another data folder.
`n` adds a task, `/` or `⌘K` searches every project, `Tab` moves to the description, `⌘↵` saves and closes, `Esc` cancels.
+Need somewhere to park ideas? Turn on the Backlog column in Settings, at the bottom of the sidebar: agents leave its tasks alone until you move them to `todo`.
+
Paste or drop an image into a task or a comment to attach it, as in ChatGPT. Agents get its file path and can open it.
When a new version is out, the sidebar offers it: one click installs it and restarts the board.
@@ -72,10 +74,10 @@ Then ask: *"take the next task from kanzo and do it."* The agent moves the card
A laptop, a desktop, a Raspberry Pi: they all share one board through a private git repo you own.
1. [Create an empty private repo](https://github.com/new?name=kanzo-data&visibility=private) on GitHub, or anywhere git can push.
-2. Press the sync button in the sidebar and paste its URL. Kanzo makes `~/kanzo` a git repo and pushes the board.
+2. Open Settings at the bottom of the sidebar, press Sync and paste its URL. Kanzo makes `~/kanzo` a git repo and pushes the board.
3. On each other machine, do the same with the same URL: Kanzo offers to use the board that's already there.
-From then on, press sync, or run `kanzo sync`, when you switch machines. It commits the board and pulls or pushes it, and it's safe while the board and your agents are running. If both machines changed the board, Kanzo asks which one to keep. To move to another repo, click its name at the bottom of the sidebar.
+From then on, press sync, or run `kanzo sync`, when you switch machines. It commits the board and pulls or pushes it, and it's safe while the board and your agents are running. If both machines changed the board, Kanzo asks which one to keep. To move to another repo, use Change sync repo in Settings.
## Settings
diff --git a/src/app.js b/src/app.js
index f014168..babc1c7 100644
--- a/src/app.js
+++ b/src/app.js
@@ -27,7 +27,7 @@ const state = {
dropped: false, // the current drag ended in a drop
layout: "", // key of the rendered column layout
allDone: false, // show every card in the done column
- menu: null, // slug of the project whose "⋯" menu is open
+ menu: null, // slug of the project whose "⋯" menu is open, or "settings"
};
// ---------- helpers ----------
@@ -73,6 +73,7 @@ const ICONS = {
expand: '<path d="m11 17-5-5 5-5M18 17l-5-5 5-5"/>',
rename: '<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>',
update: '<circle cx="12" cy="12" r="9"/><path d="M12 7v9M8 12l4 4 4-4"/>',
+ settings: '<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
send: '<path d="M12 19V5M5 12l7-7 7 7"/>',
};
@@ -316,7 +317,6 @@ function setProject(slug) {
}
function render() {
- if (!$("#version").disabled) $("#version").textContent = `v${state.board.version}`;
renderNav();
renderHeader();
renderColumns();
@@ -447,11 +447,12 @@ function closeMenu() {
state.menu = null;
document.querySelector(".menu")?.remove();
document.querySelectorAll(".nav .menu-open").forEach((i) => i.classList.remove("menu-open"));
+ $("#settings").classList.remove("open");
}
-// A click elsewhere closes the menu; one on a "⋯" button is left to toggle it.
+// A click elsewhere closes the menu; one on a "⋯" or the settings button is left to toggle it.
document.addEventListener("mousedown", (e) => {
- if (!e.target.closest(".menu, .nav .more")) closeMenu();
+ if (!e.target.closest(".menu, .nav .more, #settings")) closeMenu();
});
// A click outside the task panel closes it. Cards are left to open their own task,
// and the project menu to do its job.
@@ -1119,7 +1120,7 @@ schedulePoll();
// The sync button runs `kanzo sync`: it commits the board and pulls or pushes it through
// the data folder's git remote. When both machines changed it, the board asks which to keep.
async function syncNow(keep) {
- const button = $("#sync");
+ const button = $("#settings");
button.disabled = true;
button.classList.add("syncing");
let diverged = null;
@@ -1147,7 +1148,7 @@ function chooseSide({ first }) {
else if (confirm("Take the other machine's board instead? This machine's board is kept in kanzo.db.bak.")) syncNow("remote");
}
-// The repo the board syncs with, shown at the bottom of the sidebar; null before it's set up.
+// The repo the board syncs with, shown in the settings menu; null before it's set up.
let syncRemote = null;
// "you/kanzo-data" from any of its URLs.
@@ -1155,19 +1156,12 @@ function repoName(url) {
return (url || "").replace(/\.git$/, "").split(/[/:]/).filter(Boolean).slice(-2).join("/");
}
-function showSyncRemote(remote) {
- syncRemote = remote;
- $("#sync-repo").hidden = !remote;
- $("#sync-repo-name").textContent = repoName(remote);
- $("#sync-repo").title = remote ? `Syncs with ${remote}. Click to change.` : "";
-}
-
async function loadSyncRemote() {
- try { showSyncRemote((await api("GET", "/sync")).remote); } catch {}
+ try { syncRemote = (await api("GET", "/sync")).remote; } catch {}
return syncRemote;
}
-// Sync asks for a repo the first time; after that, the repo in the sidebar changes it.
+// Sync asks for a repo the first time; after that, the repo in the settings menu changes it.
function openSyncDialog() {
closeMenu();
$("#sync-dialog").hidden = false;
@@ -1193,7 +1187,7 @@ $("#sync-form").addEventListener("submit", async (e) => {
body: JSON.stringify({ url: $("#sync-url").value }) });
const reply = await res.json().catch(() => ({}));
if (res.ok) {
- showSyncRemote(reply.remote);
+ syncRemote = reply.remote;
closeSyncDialog();
syncNow();
} else {
@@ -1211,17 +1205,53 @@ $("#sync-cancel").addEventListener("click", closeSyncDialog);
$("#sync-dialog").addEventListener("mousedown", (e) => { if (e.target.id === "sync-dialog") closeSyncDialog(); });
$("#sync-dialog").addEventListener("keydown", (e) => { if (e.key === "Escape") { e.stopPropagation(); closeSyncDialog(); } });
-$("#sync").addEventListener("click", async () => {
+async function sync() {
+ closeMenu();
if (await loadSyncRemote()) syncNow();
else openSyncDialog();
-});
-$("#sync-repo").addEventListener("click", openSyncDialog);
+}
+
+// ---------- settings ----------
+
+// The settings menu at the bottom of the sidebar, as in ChatGPT: sync, the backlog
+// column, and the version, which checks for updates.
+function toggleSettings() {
+ const wasOpen = state.menu === "settings";
+ closeMenu();
+ if (wasOpen || !state.board) return;
+ state.menu = "settings";
+ const button = $("#settings");
+ button.classList.add("open");
+ const backlog = el("input", { type: "checkbox", "aria-label": "Backlog column" });
+ backlog.checked = state.board.statuses.includes("backlog");
+ backlog.addEventListener("change", async () => {
+ try {
+ await api("PATCH", "/settings", { backlog: backlog.checked });
+ loadBoard();
+ } catch (err) { backlog.checked = !backlog.checked; toast(err.message); }
+ });
+ const menu = el("div", { class: "menu", role: "menu", tabindex: "-1" },
+ el("button", { onclick: sync }, icon("sync"), "Sync", el("span", { class: "value" }, syncRemote ? repoName(syncRemote) : "Set up")),
+ syncRemote ? el("button", { onclick: openSyncDialog }, icon("rename"), "Change sync repo") : null,
+ el("label", { class: "option", title: "A column before todo, for tasks agents leave alone" },
+ icon("board"), "Backlog column", el("span", { class: "switch" }, backlog, el("span"))),
+ el("div", { class: "sep" }),
+ el("button", { onclick: checkForUpdates }, icon("update"), "Check for updates", el("span", { class: "value" }, `v${state.board.version}`)));
+ document.body.append(menu);
+ const r = button.getBoundingClientRect();
+ menu.style.width = `${r.width}px`;
+ menu.style.left = `${r.left}px`;
+ menu.style.top = `${r.top - 6 - menu.offsetHeight}px`;
+ menu.focus();
+}
+
+$("#settings").addEventListener("click", toggleSettings);
// ---------- update ----------
// Kanzo checks GitHub for a newer release once a day and offers it at the bottom of the
-// sidebar; clicking the version there asks right away. Installing replaces the running board
-// and restarts it, and the page reloads once it's back.
+// sidebar; the settings menu asks right away. Installing replaces the running board and
+// restarts it, and the page reloads once it's back.
async function checkUpdate() {
try {
showUpdate(await api("GET", "/update"));
@@ -1239,11 +1269,9 @@ function showUpdate({ current, available }) {
};
}
-// The version at the bottom of the sidebar checks for updates when clicked.
-$("#version").addEventListener("click", async () => {
- const button = $("#version");
- button.disabled = true;
- button.textContent = "Checking…";
+async function checkForUpdates() {
+ closeMenu();
+ toast("Checking for updates…");
try {
const status = await api("GET", "/update?now=1");
showUpdate(status);
@@ -1257,9 +1285,7 @@ $("#version").addEventListener("click", async () => {
toast("Can't reach GitHub to check for updates");
}
} catch (err) { toast(err.message); }
- button.disabled = false;
- button.textContent = state.board ? `v${state.board.version}` : "";
-});
+}
async function installUpdate(available) {
const button = $("#update");
diff --git a/src/index.html b/src/index.html
index a4f9f1d..b4f8968 100644
--- a/src/index.html
+++ b/src/index.html
@@ -105,14 +105,13 @@ aside {
.update { margin-top: 8px; background: var(--hover); }
.update:hover, .update:focus-visible { background: var(--active); }
.update:disabled { opacity: .6; cursor: default; }
-.about { display: flex; align-items: center; gap: 8px; padding: 10px 10px 0; color: var(--faint); font-size: 12px; }
-.about .ghost { width: auto; margin-left: -6px; padding: 2px 6px; font-size: 12px; color: var(--faint); }
-.about .ghost:hover, .about .ghost:focus-visible { color: var(--text); }
-.about .ghost:disabled { cursor: default; }
-#sync-repo { display: inline-flex; align-items: center; gap: 5px; margin: 0 -6px 0 auto; min-width: 0; }
-#sync-repo[hidden] { display: none; }
-#sync-repo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-#sync-repo .icon svg { width: 13px; height: 13px; }
+#settings { margin-top: 8px; color: var(--muted); }
+#settings:hover, #settings:focus-visible, #settings.open { color: var(--text); }
+/* The settings menu: a row with a value or a switch on its right. */
+.menu .option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
+.menu .option:hover { background: var(--hover); }
+.menu .value { margin-left: auto; padding-left: 12px; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.menu .switch { margin-left: auto; }
form.new-project { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 10px; }
form.new-project .row { display: flex; gap: 6px; margin-top: 2px; }
@@ -371,7 +370,7 @@ header .new-task .icon svg { width: 16px; height: 16px; }
.nav { flex-direction: row; overflow-x: auto; }
.nav a { width: auto; }
.nav .label { display: none; }
- #new-project-toggle, form.new-project, .about { display: none; }
+ #new-project-toggle, form.new-project { display: none; }
.columns { grid-auto-columns: minmax(78vw, 1fr); padding: 0 12px 12px; }
header { padding: 12px; }
}
@@ -382,7 +381,6 @@ header .new-task .icon svg { width: 16px; height: 16px; }
<div class="brand">
<img src="/logo.png" alt="">
Kanzo
- <button class="ghost" id="sync" title="Sync with your other machines" aria-label="Sync"><span class="icon" data-icon="sync"></span></button>
<button class="ghost" id="search-open" title="Search (/ or ⌘K)" aria-label="Search tasks"><span class="icon" data-icon="search"></span></button>
</div>
<button class="ghost" id="new-project-toggle"><span class="icon" data-icon="newProject"></span>New project</button>
@@ -397,10 +395,7 @@ header .new-task .icon svg { width: 16px; height: 16px; }
</form>
<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>
- <div class="about">
- <button class="ghost" id="version" title="Check for updates"></button>
- <button class="ghost" id="sync-repo" hidden><span class="icon" data-icon="sync"></span><span id="sync-repo-name"></span></button>
- </div>
+ <button class="ghost" id="settings" aria-haspopup="menu"><span class="icon" data-icon="settings"></span>Settings</button>
</aside>
<main>