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.

Show tasks as a list, sorted and grouped

emanuele-em81abf717644b
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 4b218c6..d0835c1 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -44,7 +44,7 @@ Where things are:
| `src/store.rs` | All SQL |
| `src/mcp.rs` | The MCP tools, over stdio and HTTP (`rmcp`, pinned on purpose: it still changes often) |
| `src/web.rs` | The board's HTTP API, and `/mcp` |
-| `src/index.html`, `src/app.js`, `src/logo.png` | The board UI: plain HTML, CSS and JavaScript, built into the binary |
+| `src/index.html`, `src/app.js`, `src/logo.png`, `src/icon.png` | The board UI: plain HTML, CSS and JavaScript, built into the binary |
| `src/sync.rs` | `kanzo sync` |
| `src/share.rs` | `kanzo share`, `join` and `leave`: sharing the board on the network |
| `src/export.rs` | `kanzo export` |
diff --git a/README.md b/README.md
index 92b63ee..b9c7b1b 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ 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. 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.
+`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, the list icon shows the same tasks as rows to sort and group, `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.
Drag the left edge of a task's panel to resize it, or expand it to the whole window; double-click the edge to reset it. **Fold** at the bottom of the sidebar leaves only its icons. Drag a project there to reorder the list, for everyone on a shared board.
diff --git a/src/app.js b/src/app.js
index d68bce3..e3db36b 100644
--- a/src/app.js
+++ b/src/app.js
@@ -79,6 +79,7 @@ const ICONS = {
close: '<path d="M18 6 6 18M6 6l12 12"/>',
more: '<circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>',
plus: '<path d="M5 12h14M12 5v14"/>',
+ list: '<path d="M4 6h16M4 12h16M4 18h16"/>',
trash: '<path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6"/>',
check: '<path d="M20 6 9 17l-5-5"/>',
copy: '<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2"/>',
@@ -514,6 +515,8 @@ function renderHeader() {
$("#new-task").hidden = !projects.length;
$("#human-only").hidden = !projects.length || isPropertyHidden("human");
$("#filter-box").hidden = !projects.length;
+ $("#view").hidden = !projects.length;
+ $("#view").setAttribute("aria-pressed", String(isList()));
$("#filters").replaceChildren(...(projects.length ? savedFilters() : []).map((f, i) =>
el("span", { class: "chip" }, el("span", {}, queryNodes(f)),
el("button", { type: "button", title: `Remove "${f}"`, "aria-label": `Remove the filter ${f}`,
@@ -548,6 +551,9 @@ async function deleteProject(p) {
function renderColumns() {
const { statuses, projects, tasks } = state.board;
const columns = $("#columns");
+ const inList = isList() && projects.length > 0;
+ columns.hidden = inList;
+ $("#list").hidden = $("#list-tools").hidden = !inList;
if (!projects.length) {
state.layout = "";
columns.style.display = "flex";
@@ -586,28 +592,66 @@ function renderColumns() {
const humanOnly = isHumanOnly();
const query = filterQuery();
$("#filter").classList.toggle("on", query.length > 0);
- for (const status of statuses) {
- const col = columns.querySelector(`[data-status="${CSS.escape(status)}"]`);
- const mine = tasks.filter((t) => t.status === status && (!humanOnly || t.human));
- const last = status === statuses[statuses.length - 1];
- const hidden = last && !state.allDone ? state.board.done_hidden || 0 : 0;
- // Filtered, the server's count of older done tasks says nothing about human ones.
- const filtered = humanOnly || query.length > 0;
- const count = mine.length + (filtered ? 0 : hidden);
- col.querySelector("h2 .count").textContent = count ? String(count) : "";
- const more = hidden
- ? el("button", { class: "ghost more", onclick: () => { state.allDone = true; loadBoard(); } },
- filtered ? "Show older" : `Show ${hidden} older`)
- : null;
- col.querySelector(".cards").replaceChildren(...[more].filter(Boolean), ...mine.map((t) => card(t, all)));
+ // Filtered, the server's count of older done tasks says nothing about human ones.
+ const filtered = humanOnly || query.length > 0;
+ const hiddenDone = state.allDone ? 0 : state.board.done_hidden || 0;
+ const more = hiddenDone
+ ? el("button", { class: "ghost more", onclick: () => { state.allDone = true; loadBoard(); } },
+ filtered ? "Show older" : `Show ${hiddenDone} older`)
+ : null;
+ if (inList) {
+ renderList(tasks.filter((t) => !humanOnly || t.human), all, more);
+ } else {
+ for (const status of statuses) {
+ const col = columns.querySelector(`[data-status="${CSS.escape(status)}"]`);
+ const mine = tasks.filter((t) => t.status === status && (!humanOnly || t.human));
+ const last = status === statuses[statuses.length - 1];
+ const count = mine.length + (!last || filtered ? 0 : hiddenDone);
+ col.querySelector("h2 .count").textContent = count ? String(count) : "";
+ col.querySelector(".cards").replaceChildren(...(last && more ? [more] : []), ...mine.map((t) => card(t, all)));
+ }
}
- highlight("filter", columns, wordsOf(query));
+ highlight("filter", inList ? $("#list") : columns, wordsOf(query));
for (const id of [...state.selected]) {
- if (!columns.querySelector(`.card[data-id="${id}"]`)) state.selected.delete(id);
+ if (!document.querySelector(`.card[data-id="${id}"]`)) state.selected.delete(id);
}
showSelection();
}
+function isList() {
+ return localStorageGet("kanzo.view") === "list";
+}
+
+// Only the view on screen is rendered: every refresh would otherwise build both.
+$("#view").addEventListener("click", () => {
+ localStorageSet("kanzo.view", isList() ? "" : "list");
+ state.layout = "";
+ render();
+});
+for (const [select, name] of [[$("#list-sort"), "kanzo.sort"], [$("#list-group"), "kanzo.group"]]) {
+ select.value = localStorageGet(name) || "";
+ select.addEventListener("change", () => { localStorageSet(name, select.value); renderColumns(); });
+}
+
+function renderList(tasks, all, more) {
+ const { statuses, projects } = state.board;
+ const by = $("#list-sort").value, group = $("#list-group").value;
+ const sorted = !by ? tasks : [...tasks].sort((a, b) =>
+ by === "id" ? a.id - b.id : by === "title" ? a.title.localeCompare(b.title) : b[by].localeCompare(a[by]));
+ const groups = new Map((group === "status" ? statuses : group === "project" ? projects.map((p) => p.slug) : []).map((g) => [g, []]));
+ for (const t of sorted) {
+ for (const g of group === "tags" ? (t.tags.length ? t.tags : [""]) : [group ? t[group] : ""]) {
+ if (!groups.has(g)) groups.set(g, []);
+ groups.get(g).push(t);
+ }
+ }
+ const names = group === "tags" ? [...groups.keys()].sort((a, b) => !a - !b || a.localeCompare(b)) : [...groups.keys()];
+ $("#list").replaceChildren(...names.flatMap((g) => !groups.get(g).length ? [] : [
+ group ? el("h2", { style: group === "status" ? "text-transform:capitalize" : null }, g || "No tag", el("span", { class: "count" }, String(groups.get(g).length))) : null,
+ ...groups.get(g).map((t) => card(t, all, true)),
+ ]).filter(Boolean), ...(more ? [more] : []));
+}
+
function showSelection() {
$("#bulk").hidden = !state.selected.size;
$("#bulk-count").textContent = `${state.selected.size} selected`;
@@ -615,7 +659,8 @@ function showSelection() {
function setSelected(id, on) {
if (on) state.selected.add(id); else state.selected.delete(id);
- document.querySelector(`[data-id="${id}"]`)?.classList.toggle("selected", on);
+ // Grouped by tag, a task can have several rows.
+ document.querySelectorAll(`.card[data-id="${id}"]`).forEach((n) => n.classList.toggle("selected", on));
}
function clearSelection() {
@@ -858,16 +903,18 @@ function plainText(md) {
.trim();
}
-function card(t, showProject) {
- const node = el("div", { class: "card" + (state.task === t.id ? " open" : "") + (t.waiting_on ? " waiting" : "") + (state.selected.has(t.id) ? " selected" : ""),
- draggable: "true", "data-id": t.id,
+// In the list, a row: no drag to reorder, since a sorted list has no one position to drop into.
+function card(t, showProject, row) {
+ const node = el("div", { class: "card" + (row ? " row" : "") + (state.task === t.id ? " open" : "") + (t.waiting_on ? " waiting" : "") + (state.selected.has(t.id) ? " selected" : ""),
+ draggable: row ? null : "true", "data-id": t.id,
onclick: (e) => { if (e.metaKey || e.ctrlKey) toggleSelected(t.id); else openTask(t.id); } },
+ row ? statusIcon(t.status) : null,
el("div", { class: "head" },
el("div", { class: "title" }, t.title),
t.human ? el("span", { class: "human-mark", title: "Human task: agents skip it" }, icon("human")) : null,
el("span", { class: "num", title: `Copy ${key(t)}`, onclick: (e) => { e.stopPropagation(); copyKey(key(t)); } },
showProject ? el("span", { class: "dot", style: `background:${projectColor(t.project)}` }) : null, `#${t.id}`)),
- ...summary(t, waitChip(t), urlChip(t)));
+ ...summary(t, waitChip(t), urlChip(t)).slice(row ? 1 : 0));
node.addEventListener("dragstart", (e) => {
state.dragging = t.id;
e.dataTransfer.effectAllowed = "move";
diff --git a/src/index.html b/src/index.html
index d1db8d1..6df4caa 100644
--- a/src/index.html
+++ b/src/index.html
@@ -141,7 +141,7 @@ header .repo-link {
}
header .repo-link:hover, header .repo-link:focus-visible { background: var(--active); color: var(--text); }
header .repo-link .icon svg { width: 14px; height: 14px; }
-#network, #human-only { width: auto; height: 35px; min-width: 35px; padding: 0 8px; justify-content: center; border-radius: 99px; }
+#network, #human-only, #view { width: auto; height: 35px; min-width: 35px; padding: 0 8px; justify-content: center; border-radius: 99px; }
#network { gap: 6px; color: var(--muted); font-size: 13px; }
#network:hover, #network:focus-visible, #network.open { color: var(--text); }
#network.on { padding: 0 12px 0 10px; background: color-mix(in srgb, #2f9e44 14%, transparent); color: #2f9e44; font-weight: 500; }
@@ -183,10 +183,10 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.chip button:hover { background: color-mix(in srgb, var(--link) 20%, transparent); }
.chip .icon svg { width: 13px; height: 13px; }
::highlight(filter), ::highlight(search) { background-color: color-mix(in srgb, var(--link) 25%, transparent); }
-#human-only { color: var(--muted); }
-#human-only:hover, #human-only:focus-visible { color: var(--text); }
-#human-only[aria-pressed="true"] { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); }
-#human-only[aria-pressed="true"]:hover, #human-only[aria-pressed="true"]:focus-visible {
+#human-only, #view { color: var(--muted); }
+#human-only:hover, #human-only:focus-visible, #view:hover, #view:focus-visible { color: var(--text); }
+#human-only[aria-pressed="true"], #view[aria-pressed="true"] { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); }
+#human-only[aria-pressed="true"]:hover, #human-only[aria-pressed="true"]:focus-visible, #view[aria-pressed="true"]:hover, #view[aria-pressed="true"]:focus-visible {
background: color-mix(in srgb, var(--link) 22%, transparent);
}
.columns {
@@ -221,6 +221,16 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.card:hover { background: var(--card-hover); }
.card.open { background: var(--active); }
html:not([data-hide~="waiting"]) .card.waiting:not(:hover) { opacity: .6; }
+.list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 24px; display: flex; flex-direction: column; gap: 4px; }
+.list > * { flex-shrink: 0; }
+.list h2 { display: flex; gap: 8px; margin: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
+.list h2:first-child { margin-top: 0; }
+.list h2 .count { color: var(--faint); font-weight: 400; }
+.card.row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 7px 12px; border-radius: 10px; cursor: pointer; }
+.row .head { flex: 1; min-width: 0; }
+.row .tags { margin: 0; flex-shrink: 0; max-width: 40%; flex-wrap: nowrap; overflow: hidden; }
+#list-tools { display: flex; gap: 6px; }
+#list-tools select { width: auto; height: 35px; padding: 0 28px 0 12px; border-radius: 99px; font-size: 13px; }
.card.selected { box-shadow: inset 0 0 0 2px var(--link); }
.marquee { position: fixed; z-index: 9; pointer-events: none; background: color-mix(in srgb, var(--link) 15%, transparent); }
.bulk { bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 16px); }
@@ -482,7 +492,8 @@ label.setting { cursor: pointer; }
.nav { flex-direction: row; overflow-x: auto; }
.nav a { width: auto; }
.nav .label { display: none; }
- #new-project-toggle, #rail, .panel-edge, #p-wide { display: none; }
+ #new-project-toggle, #rail, .panel-edge, #p-wide, .row .tags { display: none; }
+ .list { padding: 0 12px 12px; }
.panel { width: 100vw; }
.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); }
@@ -524,11 +535,17 @@ html:not(.ready) aside { visibility: hidden; }
<div class="info" id="header"></div>
<div id="filters"></div>
<span class="query" id="filter-box" hidden><span class="query-mirror" aria-hidden="true"><span></span></span><input type="search" id="filter" placeholder="Filter board" title="Show only the tasks that match, like tag:bug or -status:done (f)" aria-label="Filter the board" autocomplete="off" spellcheck="false"></span>
+ <span id="list-tools" hidden>
+ <select class="field" id="list-sort" aria-label="Sort by"><option value="">Board order</option><option value="updated_at">Updated</option><option value="created_at">Created</option><option value="title">Title</option><option value="id">ID</option></select>
+ <select class="field" id="list-group" aria-label="Group by"><option value="">No groups</option><option value="status">By status</option><option value="project">By project</option><option value="tags">By tag</option></select>
+ </span>
+ <button class="ghost" id="view" title="Show as a list" aria-label="Show as a list" aria-pressed="false" hidden><span class="icon" data-icon="list"></span></button>
<button class="ghost" id="human-only" title="Show only human tasks (h)" aria-label="Show only human tasks" aria-pressed="false" hidden><span class="icon" data-icon="human"></span></button>
<button class="ghost" id="network" aria-haspopup="dialog" aria-controls="network-menu"></button>
<button class="btn primary" id="new-task" title="New task (n)" hidden><span class="icon" data-icon="plus"></span>New task</button>
</header>
<div class="columns" id="columns"></div>
+ <div class="list" id="list" hidden></div>
</main>
<div class="bulk" id="bulk" hidden>