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.

Open settings in a window with categories

emanuele-emc8e948436498
diff --git a/README.md b/README.md
index 17021e6..5efbc8b 100644
--- a/README.md
+++ b/README.md
@@ -74,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. Open Settings at the bottom of the sidebar, press Sync and paste its URL. Kanzo makes `~/kanzo` a git repo and pushes the board.
+2. Click Settings at the bottom of the sidebar, choose 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, use Change sync repo in Settings.
+From then on, choose 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, change it in Settings, under Sync.
Sync is for switching machines: work on one, sync, then move to the other. For agents on several machines at once, run one board with `listen = "0.0.0.0"` on a network you trust, and point every agent at `http://<host>:4242/mcp`, passing the project by name.
diff --git a/src/app.js b/src/app.js
index 262ed46..df44a47 100644
--- a/src/app.js
+++ b/src/app.js
@@ -75,6 +75,7 @@ const ICONS = {
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"/>',
+ info: '<circle cx="12" cy="12" r="9"/><path d="M12 16v-4M12 8h.01"/>',
};
function icon(name, color) {
@@ -450,7 +451,7 @@ function closeMenu() {
$("#settings").classList.remove("open");
}
-// A click elsewhere closes the menu; one on a "⋯" or the settings 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, #settings")) closeMenu();
});
@@ -1141,12 +1142,14 @@ schedulePoll();
// ---------- sync ----------
-// 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.
+// Sync 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.
+let syncing = false;
+
async function syncNow(keep) {
- const button = $("#settings");
- button.disabled = true;
- button.classList.add("syncing");
+ if (syncing) return;
+ syncing = true;
+ toast("Syncing…");
let diverged = null;
try {
const res = await fetch("/api/sync", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ keep }) });
@@ -1155,8 +1158,7 @@ async function syncNow(keep) {
else if (reply.diverged) diverged = reply;
else toast(reply.error || res.statusText);
} catch (err) { toast(err.message); }
- button.disabled = false;
- button.classList.remove("syncing");
+ syncing = false;
if (diverged) chooseSide(diverged);
}
@@ -1172,7 +1174,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 in the settings menu; null before it's set up.
+// The repo the board syncs with; null before it's set up.
let syncRemote = null;
// "you/kanzo-data" from any of its URLs.
@@ -1185,20 +1187,11 @@ async function loadSyncRemote() {
return syncRemote;
}
-// Sync asks for a repo the first time; after that, the repo in the settings menu changes it.
-function openSyncDialog() {
+// Sync asks for a repo, in Settings, the first time.
+async function sync() {
closeMenu();
- $("#sync-dialog").hidden = false;
- $("#sync-title").textContent = syncRemote ? "Sync with another repo" : "Sync your board";
- $("#sync-create").hidden = !!syncRemote;
- $("#sync-url").value = syncRemote || "";
- $("#sync-error").hidden = true;
- $("#sync-url").focus();
- $("#sync-url").select();
-}
-
-function closeSyncDialog() {
- $("#sync-dialog").hidden = true;
+ if (await loadSyncRemote()) syncNow();
+ else openSettings("sync");
}
$("#sync-form").addEventListener("submit", async (e) => {
@@ -1212,7 +1205,7 @@ $("#sync-form").addEventListener("submit", async (e) => {
const reply = await res.json().catch(() => ({}));
if (res.ok) {
syncRemote = reply.remote;
- closeSyncDialog();
+ closeSettings();
syncNow();
} else {
$("#sync-error").textContent = reply.error || res.statusText;
@@ -1225,42 +1218,23 @@ $("#sync-form").addEventListener("submit", async (e) => {
save.disabled = false;
save.textContent = "Save and sync";
});
-$("#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(); } });
-
-async function sync() {
- closeMenu();
- if (await loadSyncRemote()) syncNow();
- else openSyncDialog();
-}
-// ---------- settings ----------
+// ---------- menu and 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() {
+// The Settings button at the bottom of the sidebar opens a menu, as in Claude: Settings,
+// Check for updates and Sync.
+function toggleSettingsMenu() {
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}`)));
+ el("button", { onclick: () => openSettings() }, icon("settings"), "Settings"),
+ el("button", { onclick: () => { closeMenu(); checkForUpdates(); } }, icon("update"), "Check for updates",
+ el("span", { class: "value" }, `v${state.board.version}`)),
+ el("button", { onclick: sync }, icon("sync"), "Sync"));
document.body.append(menu);
const r = button.getBoundingClientRect();
menu.style.width = `${r.width}px`;
@@ -1269,12 +1243,51 @@ function toggleSettings() {
menu.focus();
}
-$("#settings").addEventListener("click", toggleSettings);
+$("#settings").addEventListener("click", toggleSettingsMenu);
+
+// The settings window, as in Claude's: categories on the left, their settings on the right.
+function openSettings(section = "board") {
+ closeMenu();
+ $("#settings-backlog").checked = state.board?.statuses.includes("backlog") ?? false;
+ $("#sync-url").value = syncRemote || "";
+ $("#sync-create").hidden = !!syncRemote;
+ $("#sync-error").hidden = true;
+ $("#settings-version").textContent = state.board ? `Kanzo ${state.board.version}` : "";
+ showSection(section);
+ $("#settings-dialog").hidden = false;
+ if (section === "sync") $("#sync-url").focus();
+ else $("#settings-close").focus();
+}
+
+function showSection(section) {
+ document.querySelectorAll("#settings-nav button").forEach((b) => b.classList.toggle("active", b.dataset.section === section));
+ document.querySelectorAll(".settings-pane").forEach((p) => { p.hidden = p.dataset.section !== section; });
+}
+
+function closeSettings() {
+ $("#settings-dialog").hidden = true;
+}
+
+$("#settings-nav").addEventListener("click", (e) => {
+ const b = e.target.closest("button");
+ if (b) showSection(b.dataset.section);
+});
+$("#settings-close").addEventListener("click", closeSettings);
+$("#settings-dialog").addEventListener("mousedown", (e) => { if (e.target.id === "settings-dialog") closeSettings(); });
+$("#settings-dialog").addEventListener("keydown", (e) => { if (e.key === "Escape") { e.stopPropagation(); closeSettings(); } });
+$("#settings-backlog").addEventListener("change", async (e) => {
+ const box = e.target;
+ try {
+ await api("PATCH", "/settings", { backlog: box.checked });
+ loadBoard();
+ } catch (err) { box.checked = !box.checked; toast(err.message); }
+});
+$("#settings-update").addEventListener("click", checkForUpdates);
// ---------- update ----------
// Kanzo checks GitHub for a newer release once a day and offers it at the bottom of the
-// sidebar; the settings menu asks right away. Installing replaces the running board and
+// sidebar; its menu asks right away. Installing replaces the running board and
// restarts it, and the page reloads once it's back.
async function checkUpdate() {
try {
@@ -1294,7 +1307,6 @@ function showUpdate({ current, available }) {
}
async function checkForUpdates() {
- closeMenu();
toast("Checking for updates…");
try {
const status = await api("GET", "/update?now=1");
diff --git a/src/index.html b/src/index.html
index 8076bb6..18dd793 100644
--- a/src/index.html
+++ b/src/index.html
@@ -107,11 +107,7 @@ aside {
.update:disabled { opacity: .6; cursor: default; }
#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; }
+.menu .value { margin-left: auto; padding-left: 12px; color: var(--faint); font-size: 12px; }
/* Controls */
input.field, textarea.field, select.field {
@@ -334,15 +330,36 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.results { overflow-y: auto; padding: 6px; }
.dialog-window {
width: min(520px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 18px;
- background: var(--menu); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
+ background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
.dialog-window h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dialog-window p { margin: 0; color: var(--muted); line-height: 1.45; }
-.dialog-window .error { color: var(--danger); white-space: pre-line; font-size: 13px; }
.dialog-window .row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
-.dialog-window .row a { margin-right: auto; color: var(--muted); font-size: 13px; }
-.dialog-window .row a:hover { color: var(--text); }
-.dialog-window .btn:disabled { opacity: .6; cursor: default; }
+/* The settings window, as in Claude's: categories on the left, their settings on the right. */
+.settings-window {
+ width: min(760px, 100%); height: min(460px, 76vh); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
+ background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
+}
+.settings-head { display: flex; align-items: center; padding: 12px 14px 12px 22px; border-bottom: 1px solid var(--border); }
+.settings-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
+.settings-head .ghost { width: auto; margin-left: auto; padding: 6px; color: var(--muted); }
+.settings-head .ghost:hover, .settings-head .ghost:focus-visible { color: var(--text); }
+.settings-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 0; }
+#settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--sidebar); border-right: 1px solid var(--border); }
+#settings-nav .active { background: var(--active); }
+.settings-pane { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px; overflow-y: auto; }
+.settings-pane h3 { margin: 0; font-size: 15px; font-weight: 600; }
+.settings-pane p { margin: 0; color: var(--muted); line-height: 1.45; }
+.settings-pane .error { color: var(--danger); white-space: pre-line; font-size: 13px; }
+.settings-pane .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
+.settings-pane .row a { color: var(--muted); font-size: 13px; }
+.settings-pane .row a:hover { color: var(--text); }
+.settings-pane .row .btn { margin-left: auto; }
+.settings-pane .btn:disabled { opacity: .6; cursor: default; }
+.setting { display: flex; align-items: center; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
+.setting .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
+.setting .text span { color: var(--muted); font-size: 13px; }
+label.setting { cursor: pointer; }
.results .label { color: var(--faint); font-size: 12px; padding: 8px 12px 4px; }
.results .note { color: var(--faint); padding: 14px 12px; }
.result {
@@ -370,6 +387,8 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.nav .label { display: none; }
#new-project-toggle { display: none; }
.columns { grid-auto-columns: minmax(78vw, 1fr); padding: 0 12px 12px; }
+ .settings-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
+ #settings-nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); }
header { padding: 12px; }
}
</style>
@@ -430,18 +449,44 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
</div>
</div>
-<div class="search-dialog" id="sync-dialog" hidden>
- <form class="dialog-window" id="sync-form" role="dialog" aria-labelledby="sync-title">
- <h2 id="sync-title">Sync your board</h2>
- <p>Keep this board the same on all your machines through a private git repo you own. Use the same repo on each machine.</p>
- <input class="field" id="sync-url" placeholder="https://github.com/you/kanzo-data" autocomplete="off" spellcheck="false" aria-label="Repository URL">
- <p class="error" id="sync-error" hidden></p>
- <div class="row">
- <a id="sync-create" href="https://github.com/new?name=kanzo-data&amp;visibility=private" target="_blank" rel="noopener">Create a private repo on GitHub</a>
- <button class="btn" type="button" id="sync-cancel">Cancel</button>
- <button class="btn primary" type="submit" id="sync-save">Save and sync</button>
+<div class="search-dialog" id="settings-dialog" hidden>
+ <div class="settings-window" role="dialog" aria-labelledby="settings-title">
+ <div class="settings-head">
+ <h2 id="settings-title">Settings</h2>
+ <button class="ghost" id="settings-close" title="Close (Esc)" aria-label="Close"><span class="icon" data-icon="close"></span></button>
</div>
- </form>
+ <div class="settings-body">
+ <nav id="settings-nav">
+ <button class="ghost" data-section="board"><span class="icon" data-icon="board"></span>Board</button>
+ <button class="ghost" data-section="sync"><span class="icon" data-icon="sync"></span>Sync</button>
+ <button class="ghost" data-section="about"><span class="icon" data-icon="info"></span>About</button>
+ </nav>
+ <section class="settings-pane" data-section="board">
+ <h3>Board</h3>
+ <label class="setting">
+ <span class="text">Backlog column<span>A column before todo, for tasks agents leave alone</span></span>
+ <span class="switch"><input type="checkbox" id="settings-backlog" aria-label="Backlog column"><span></span></span>
+ </label>
+ </section>
+ <form class="settings-pane" data-section="sync" id="sync-form">
+ <h3>Sync</h3>
+ <p>Keep this board the same on all your machines through a private git repo you own. Use the same repo on each machine.</p>
+ <input class="field" id="sync-url" placeholder="https://github.com/you/kanzo-data" autocomplete="off" spellcheck="false" aria-label="Repository URL">
+ <p class="error" id="sync-error" hidden></p>
+ <div class="row">
+ <a id="sync-create" href="https://github.com/new?name=kanzo-data&amp;visibility=private" target="_blank" rel="noopener">Create a private repo on GitHub</a>
+ <button class="btn primary" type="submit" id="sync-save">Save and sync</button>
+ </div>
+ </form>
+ <section class="settings-pane" data-section="about">
+ <h3>About</h3>
+ <div class="setting">
+ <span class="text">Version<span id="settings-version"></span></span>
+ <button class="btn" id="settings-update">Check for updates</button>
+ </div>
+ </section>
+ </div>
+ </div>
</div>
<div class="search-dialog" id="project-dialog" hidden>
<form class="dialog-window" id="new-project" role="dialog" aria-labelledby="project-title">