Fit Tasks to a repo of its own, and cut what the strawman leaves out
Misha Kaletsky, 2026-11-24 18:20 UTC · d2f5168c879f55832d71391ab76b802623486aea · parent 5317767
8 files changed
- M app.ts
- M index.html
- M public/app.css
- M public/app.js
- M public/manifest.webmanifest
- M public/tasks-model.js
- M tasks-model.test.mjs
- A tsconfig.json
M app.ts
@@ -1,54 +1,36 @@ -// app.ts — THE TASKS APP, as worker.ts mounts it on tasks.<domain>: a board over the markdown -// files under tasks/ in the repo that worker.ts points it at (`tasksApp({ repo })`; /repos/config -// while the mind has no such repo), or in the repo of the mind that `?repo=` names. public/app.js says what the page does, and +// app.ts — THE TASKS APP, as config/worker.ts mounts it on tasks.<domain>: a board over the +// markdown files under todo/ in the repo that worker.ts points it at (`tasksApp({ repo })`), or in +// the repo of the mind that `?repo=` names. public/app.js says what the page does, and // public/tasks-model.js how a file is read as a card. This file only serves the page: the board // reads and commits through the member's own itx, so there is no backend class and no state here. -// The task sheet edits a file as the Docs app does, through the Docs app's processors -// (../docs/processors/): /processors.json says where they are, in the Docs app's own words. import { type AppDescription, serveFiles, type IterateConfigEntrypoint } from "iterate/sdk"; -import theme from "../theme.css"; -// oxlint-disable-next-line import/extensions -- a folder: the loader hands over every file under it, by path -import liveReload from "../live-reload/"; -import { processorsAnswer } from "../docs/app.ts"; -import { openFile } from "../open-files.ts"; +import { openFile } from "../stdlib/open-files.ts"; +import theme from "../stdlib/theme.css"; import index from "./index.html"; -// oxlint-disable-next-line import/extensions -- a folder: the loader hands over every file under it, by path import files from "./public/"; /** What Tasks says of itself to anyone: the mind's sign-in pages show its name and icon. */ const TASKS: AppDescription = { name: "Tasks", icon: "/icon.svg", for: "members" }; -/** The repo the board points at when worker.ts names none. A commit to a repo other than - * `/repos/config` publishes nothing, so a card that moves does not load the mind's code again. */ -const TASKS_REPO = "/repos/tasks"; - /** `repo`: THE REPO THE BOARD POINTS AT, a path of this mind (`/repos/<name>`). The page shows - * the markdown files under `tasks/` of it. While the mind has no such repo, the page shows the - * config repo's `tasks/`; `?repo=<name>` shows any other repo for one visit. */ -export function tasksApp({ repo = TASKS_REPO }: { repo?: string } = {}) { + * the markdown files under `todo/` of it; `?repo=<name>` shows any other repo for one visit. + * `icon`: the answer for the mind's icon, which every app serves as its own + * (../stdlib/open-files.ts). */ +export function tasksApp({ repo, icon }: { repo: string; icon: () => Response }) { return { - /** The app's description and icon, for anyone: worker.ts asks this before its guard - * (../open-files.ts). */ - open: (request: Request) => openFile(request, TASKS), + /** The app's description and icon, for anyone: worker.ts asks this before its guard. */ + open: (request: Request) => openFile(request, TASKS, icon), /** Every request on the app's host. worker.ts guards it, so a member alone gets here. */ - async fetch(request: Request, host: Pick<IterateConfigEntrypoint, "auth">) { - const url = new URL(request.url); - // Where the Docs processors' classes are and which version of them this commit holds: the - // answer apps/docs/app.ts gives, so the task sheet and Docs start one doc's processors - // under one name and never as two copies. - if (url.pathname === "/processors.json") return Response.json(await processorsAnswer()); + fetch(request: Request, host: Pick<IterateConfigEntrypoint, "auth">) { // the repo worker.ts points the board at: the page asks once, when it loads - if (url.pathname === "/board.json") + if (new URL(request.url).pathname === "/board.json") return Response.json({ repo }, { headers: { "cache-control": "no-store" } }); // The page's own socket (/itx) and what @iterate-com/ui's shell asks of its host // (/.auth/session.json, /.auth/minds.json, /.auth/logout). const page = host.auth.memberPage(request); if (page) return page; - // the app's own files, and the one theme file that every app of this mind shares - return serveFiles(request, { - index, - files: { ...files, ...liveReload, "theme.css": theme }, - }); + // the app's own files, and the theme that every app of this mind shares + return serveFiles(request, { index, files: { ...files, "theme.css": theme } }); }, }; }
M index.html
@@ -10,8 +10,8 @@ <!-- What the app is called and its icon: the mind's sign-in pages show both. --> <link rel="manifest" href="/manifest.webmanifest" /> <link rel="icon" href="/icon.svg" type="image/svg+xml" /> - <!-- iterate's components, pinned to one build: the one the Dash and Docs pin. To upgrade, - change the version here. --> + <!-- iterate's components, pinned to one build: the one the Dash pins. To upgrade, change + the version here. --> <script type="importmap"> { "imports": { @@ -30,31 +30,24 @@ <script> try { window.__itxSocket = new WebSocket(new URL("/itx", location.href.replace(/^http/, "ws"))); - // time to itx: when the socket opens (page-events.md, "Speed") - window.__itxSocket.addEventListener("open", () => performance.mark("iterate:itx-open"), { - once: true, - }); } catch {} </script> - <!-- The kit's stylesheet for a page with the docs editor (the task sheet has one): everything - styles.css holds, and the editor's own classes and its live preview's look. It takes the - place of styles.css: a page links one of the two, never both. --> + <!-- The stylesheet at the address the build serves it from: the shorter one answers with a + redirect to this one. `crossorigin`, so it comes over the connection the modules use. --> <link rel="stylesheet" - href="https://esm.iterate.com/@iterate-com/ui@0.1.0-main.20261124T154040Z-83b4390/docs-editor.css" + crossorigin + href="https://esm.iterate.com/@iterate-com/ui@0.1.0-main.20261124T154040Z-83b4390/dist/styles.css" /> - <!-- The look of this mind's apps: apps/theme.css, one file for every app. One line there - makes them all dark. shadcn's components also ask for the class `dark`, so the script - puts it on <html> when the file says dark. --> + <!-- The look of this mind's apps: theme.css of /repos/stdlib, one file for every app. One + line there makes them all dark. shadcn's components also ask for the class `dark`, so the + script puts it on <html> when the file says dark. --> <link rel="stylesheet" href="/theme.css" /> <script> if (getComputedStyle(document.documentElement).colorScheme === "dark") document.documentElement.classList.add("dark"); </script> <link rel="stylesheet" href="/app.css" /> - <!-- The page takes a new commit by itself: apps/live-reload/live-reload.js says how. A commit - that changes a task changes no file of this page, so it reloads nothing. --> - <script type="module" src="/live-reload.js" blocking="render"></script> </head> <body> <div id="root"><p class="tasks-note">Connecting…</p></div>
M public/app.css
@@ -823,22 +823,20 @@ color: var(--destructive); } -/* the Docs editor fills the rest; its own bar stays at the top of the sheet's page as it scrolls */ +/* the file's text as it is written, under the head: read here, written with git */ .task-text { - display: flex; flex: 1 0 auto; - flex-direction: column; min-width: 0; + margin: 0; + padding: 1rem 1.5rem; border-top: 1px solid var(--border); + font-family: ui-monospace, SFMono-Regular, Menlo, monospace; + font-size: 0.8125rem; + line-height: 1.6; + white-space: pre-wrap; + overflow-wrap: anywhere; } -/* In its Rich view the editor draws the frontmatter as a list of properties. The sheet's head is - that list here, with controls, so the editor's is not drawn twice. Its Markdown view still shows - the frontmatter as it is written, and there it can be typed in. */ -.task-text .docs-properties { - display: none; -} - @media (max-width: 640px) { .task-sheet { width: 100vw; @@ -897,29 +895,6 @@ } /* an ask's answer box (app.js `Ask`): the field takes the row, the button keeps its own width */ -/* under an ask: who asked it, a link to that agent's chat in the Dash */ -.needs-asker { - display: flex; - align-items: center; - gap: 0.25rem; - width: fit-content; - margin-top: 0.125rem; - color: var(--muted-foreground); - font-size: 0.75rem; - text-decoration: none; -} - -a.needs-asker:hover { - color: var(--foreground); - text-decoration: underline; - text-underline-offset: 2px; -} - -.needs-asker > svg { - width: 0.75rem; - height: 0.75rem; -} - .needs-answer { display: flex; align-items: center;
M public/app.js
@@ -1,21 +1,19 @@ -// app.js — THE TASKS APP'S PAGE: the markdown files under tasks/ in one repo of this mind, as a -// board. The repo is the one worker.ts points the app at (app.ts `tasksApp({ repo })`, which -// /board.json answers; the tasks repo, tasks-model.js `TASKS_REPO`, when it names none), or the -// one that `?repo=<name>` names (/repos/<name>): the bar's "Repo" menu lists the mind's repos, -// and the page loads again for the one chosen. +// app.js — THE TASKS APP'S PAGE: the markdown files under todo/ in one repo of this mind, as a +// board. The repo is the one config/worker.ts points the app at (app.ts `tasksApp({ repo })`, +// which /board.json answers), or the one that `?repo=<name>` names (/repos/<name>): the bar's +// "Repo" menu lists the mind's repos, and the page loads again for the one chosen. // A column is a status, a card is a file (tasks-model.js says how a file is read). A person // makes a task, moves a card to another column (by drag, or from the card's menu), and filters the // board by words, by folder and by each dimension that the files hold (tags, priority, size, owner, // agent: tasks-model.js `DIMENSIONS`). "Group by" breaks the board into rows by one of them. A -// card's title opens the task in a sheet at the right of the board, where its title, its properties -// and its text are edited and commented on ("the task sheet", below). +// card's title opens the task in a sheet at the right of the board, where its title and its +// properties are edited, and its text is read ("the task sheet", below). // // EVERY CHANGE IS A COMMIT TO THAT REPO. The board shows a change at once and commits a moment // later, with whatever else was changed meanwhile: several cards moved in a row are ONE commit // (`Board`, below). The board reads the repo again at every commit to it, whoever made it, so each -// open board shows what the others did. A commit to a repo of tasks publishes nothing: only -// /repos/config is the mind's code. (`?repo=config` is a board like any other, and there a commit -// does publish the mind.) +// open board shows what the others did. A commit to a repo that the mind's code is not loaded +// from publishes nothing: /repos/home is such a repo. // // Everything it draws is a component of @iterate-com/ui, loaded through the import map in // index.html. The page's own layout is app.css. @@ -41,7 +39,6 @@ DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, - DropdownMenuSeparator, DropdownMenuTrigger, } from "@iterate-com/ui/components/ui/dropdown-menu"; import { @@ -74,7 +71,6 @@ CheckIcon, ChevronDownIcon, EllipsisIcon, - ExternalLinkIcon, PlusIcon, SearchIcon, TriangleAlertIcon, @@ -95,7 +91,6 @@ newTask, rowsOf, TASKS_DIR, - TASKS_REPO, tasksOf, valuesOf, } from "./tasks-model.js"; @@ -107,42 +102,25 @@ // (`pageSession`'s epoch, in `App`). const itx = memberItx(); const pageSession = itxSessionOf(itx); -const [{ principal }, initialRepos, pointed] = await Promise.all([ +const [{ principal }, pointed] = await Promise.all([ itx.whoami(), - itx.repos.list().catch(() => []), - // the repo worker.ts points the board at (app.ts, `tasksApp({ repo })`); an answer that is no - // JSON, or names no repo path, leaves the tasks repo - fetch("/board.json") - .then((answer) => answer.json()) - .catch(() => ({})), + // the repo config/worker.ts points the board at (app.ts, `tasksApp({ repo })`) + fetch("/board.json").then((answer) => answer.json()), ]); -/** The repo the board points at: a path `/repos/<name>` from app.ts, else the tasks repo. */ -const BOARD_REPO = /^\/repos\/[A-Za-z0-9][A-Za-z0-9._-]*$/.test(pointed?.repo) - ? pointed.repo - : TASKS_REPO; /** Who a commit made here is by: the person's email as both name and address. */ const author = principal?.email ? { name: principal.email, email: principal.email } : undefined; // The mind is its domain, and this host is one label under it. const domain = location.hostname.split(".").slice(1).join(".") || location.hostname; /** THE REPO WHOSE TASKS THE BOARD SHOWS, by its name: the one `?repo=` names, else the repo the - * board points at (`BOARD_REPO`) when the mind has it, else `config` (so a new mind's - * onboarding cards under `tasks/` in `/repos/config` appear before the tasks repo is made). - * Read once when the page loads; the bar's "Repo" menu loads the page again for another - * (`showRepo`). */ -const DEFAULT_REPO_NAME = initialRepos.some((repo) => repo.path === BOARD_REPO) - ? BOARD_REPO.split("/").at(-1) - : "config"; + * board points at. Read once when the page loads; the bar's "Repo" menu loads the page again for + * another (`showRepo`). */ +const DEFAULT_REPO_NAME = pointed.repo.split("/").at(-1); const REPO_NAME = (() => { const named = new URLSearchParams(location.search).get("repo"); return named && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(named) ? named : DEFAULT_REPO_NAME; })(); const REPO = `/repos/${REPO_NAME}`; -/** The repo with this mind's code: the editor's processors and their package pins are there. */ -const CODE_REPO = "/repos/config"; -/** A task's file in the Docs app, where it is written and commented on. */ -const docsHref = (path) => - `https://docs.${domain}/?repo=${encodeURIComponent(REPO_NAME)}&doc=${encodeURIComponent(path)}`; /** An agent's chat in the Dash (tasks-model.js `agentChatPath`), or null when the card names no * context path. */ const agentHref = (agent) => { @@ -174,7 +152,7 @@ * new column at once. * - A change is kept as what the person did ("this file's status is done"), and is applied to the * file as the repo has it when the commit is made. So a commit somebody else made meanwhile - * (an edit in Docs, an agent's) is never written over: only the status line is ours. + * (an edit pushed with git, an agent's) is never written over: only the status line is ours. * - A commit names the tip it was decided on (`parent`). When the tip has moved, the repo refuses * it, and the board reads again and tries again. * - A commit whose answer was lost (the publication it starts can cut the socket) is tried @@ -896,94 +874,15 @@ `; } -/** WHO ASKED EACH OPEN ASK OF THE BOARD: `itx.config.taskAskers` (apps/tasks/askers.js), which - * reads it from the change feed, as a map from `<file>\n<ask>` to its row. Null until the first - * answer; "unread" when the call fails, so that the page then says what it does know (the - * task's agent) and that the asker could not be read. It is asked again when the board's asks change, and once more a moment later - * when an ask has no asker yet: the feed hears of a commit a moment after the board does. */ -function useAskers(tasks) { - const asked = tasks - .flatMap((task) => task.humanAsk.map((ask) => `${task.path}\n${ask}`)) - .join("\n\n"); - const [askers, setAskers] = useState(null); - useEffect(() => { - if (!asked) return undefined; - let live = true; - let timer; - const read = (again) => - itx.config.taskAskers({ repo: REPO_NAME }).then( - (answer) => { - if (!live) return; - setAskers(new Map(answer.asks.map((row) => [`${row.file}\n${row.ask}`, row]))); - if (again && answer.asks.some((row) => !row.at)) - timer = setTimeout(() => read(false), 4000); - }, - () => live && setAskers((now) => now ?? "unread"), - ); - read(true); - return () => { - live = false; - clearTimeout(timer); - }; - }, [asked]); - return askers; -} - -/** WHO ASKED, UNDER AN ASK: the agent that added the ask, as a link to its chat in the Dash, where - * a person asks it why before they answer. `asker` is the ask's row of `useAskers`. When nothing - * says who asked (an ask older than the change feed, or one written by hand), the line names the - * task's own agent and SAYS that it is the task's agent: that one may not be the asker. A person - * who asked on the board is named with no link. */ -function Asker({ task, asker }) { - const when = asker?.at ? ` on ${asker.at.slice(0, 16).replace("T", " ")} UTC` : ""; - if (asker?.agent && agentHref(asker.agent)) - return html` - <a - class="needs-asker" - data-asker="agent" - href=${agentHref(asker.agent)} - target="_blank" - rel="noreferrer" - title=${`${asker.agent} asked this${when}. Opens its chat in the Dash.`} - > - Asked by ${valueLabel(DIMENSION.agent, asker.agent)}<${ExternalLinkIcon} /> - </a> - `; - if (asker?.by && !asker.by.startsWith("/")) - return html`<span - class="needs-asker" - data-asker="person" - title=${`${asker.by} asked this${when}${asker.page ? ` on ${asker.page}` : ""}.`} - >Asked by ${asker.by}</span - >`; - // the first answer is not here yet: say nothing, not the wrong agent - if (!asker || !agentHref(task.agent)) return null; - return html` - <a - class="needs-asker" - data-asker="assignee" - href=${agentHref(task.agent)} - target="_blank" - rel="noreferrer" - title=${`${asker.unread ? "Who asked this could not be read" : "Who asked this is not recorded"}. ${task.agent} is the agent that has the task. Opens its chat in the Dash.`} - > - ${asker.unread ? "Asker not read" : "Asker not recorded"}. The task's agent: - ${valueLabel(DIMENSION.agent, task.agent)}<${ExternalLinkIcon} /> - </a> - `; -} - /** ONE ASK OF A TASK, WITH THE BOX THAT ANSWERS IT. An answer is a change like a moved card: the * ask leaves the list at once, and a commit a moment later takes its line out of the file's * `human-ask:` and keeps the ask with the answer, who gave it and when under `## Answers` in the - * task's text (tasks-model.js `answerAsk`). The agent that follows the task hears of that commit - * (apps/tasks/feed.js), so nobody has to tell it. */ -function Ask({ task, ask, asker }) { + * task's text (tasks-model.js `answerAsk`). */ +function Ask({ task, ask }) { const [answer, setAnswer] = useState(""); return html` <li> <span>${ask}</span> - <${Asker} task=${task} asker=${asker} /> <form class="needs-answer" onSubmit=${(event) => { @@ -1020,10 +919,9 @@ /** "Needs a person" (`?needs=person`), in place of the board: each task that is not done and asks a * person something (`human-ask:`) or says what holds it (`blocked-on:`), as a row. A person - * answers an ask here (`Ask`), and each ask names the agent that asked it, as a link to its chat - * (`Asker`); what holds a task is only read. The board's other filters still narrow it. */ + * answers an ask here (`Ask`); what holds a task is only read. The board's other filters still + * narrow it. */ function NeedsPage({ state, tasks, filtered }) { - const askers = useAskers(tasks); if (!state.loaded) return state.loadError ? html`<p class="tasks-note" role="alert">Couldn't read the tasks: ${state.loadError}</p>` @@ -1080,19 +978,7 @@ html` <ul class="needs-asks" aria-label="Asks"> ${task.humanAsk.map( - (ask) => - html`<${Ask} - key=${ask} - task=${task} - ask=${ask} - asker=${ - // a row with no asker for an ask that the answer does not have (a new one): the task's agent then - askers && - (askers === "unread" - ? { unread: true } - : (askers.get(`${task.path}\n${ask}`) ?? {})) - } - />`, + (ask) => html`<${Ask} key=${ask} task=${task} ask=${ask} />`, )} </ul> ` @@ -1482,12 +1368,6 @@ )} <//> <//> - <${DropdownMenuSeparator} /> - <${DropdownMenuItem} - onClick=${() => window.open(docsHref(task.path), "_blank", "noreferrer")} - > - <${ExternalLinkIcon} />Open in Docs - <//> <//> <//> </div> @@ -1569,59 +1449,12 @@ } // ── the task sheet ── -// A TASK OPENS IN A SHEET AT THE RIGHT OF THE BOARD (`?task=<path>`), and is edited there: -// -// - its TEXT in the Docs app's live editor (@iterate-com/ui's `DocEditor` on a `DocSession`): -// several people type at once, comment on the text, and the doc's processor saves what they -// type as a commit, a minute after the first unsaved edit or when the last one leaves; -// - its TITLE AND PROPERTIES through the board's own changes (`board.change`), as a card's move: -// shown at once on the card and on every open board, and one commit a moment later. The open -// editors get that commit merged into their text by the doc's processor. -// -// So the sheet has two things that can be waiting, and its saving line names both. A changed -// title renames nothing: the file's path is the task's identity. -// -// The editor is the Docs app's, with the Docs app's processors (apps/docs/processors/): the page -// names them exactly as the Docs page does (/processors.json, apps/tasks/app.ts), so a file open -// in both is one doc. Its code is loaded when the first sheet opens, not with the board. +// A TASK OPENS IN A SHEET AT THE RIGHT OF THE BOARD (`?task=<path>`). Its TITLE AND PROPERTIES are +// edited there through the board's own changes (`board.change`), as a card's move: shown at once +// on the card and on every open board, and one commit a moment later. A changed title renames +// nothing: the file's path is the task's identity. Its TEXT is shown as the file has it. The +// board has no editor for it: write it with git, or ask an agent. -const PROCESSOR_PACKAGES = ["yjs", "diff", "node-diff3"]; -let editorAsked; -/** The editor's module and the processors' facet spec, asked for once. A failure is asked again - * at the next sheet. */ -function editorOf() { - editorAsked ||= (async () => { - const [kit, answer, manifestText] = await Promise.all([ - import("@iterate-com/ui/components/docs-editor/docs-editor"), - fetch("/processors.json"), - itx.repos.get(CODE_REPO).readFile("package.json"), - ]); - if (!answer.ok) throw new Error(`/processors.json answered ${answer.status}`); - const processors = await answer.json(); - const manifest = JSON.parse(manifestText || "{}"); - const pins = PROCESSOR_PACKAGES.map( - (name) => `${name}@${manifest.dependencies?.[name] || "none"}`, - ); - const me = principal?.email || principal?.actor || "someone"; - return { - DocEditor: kit.DocEditor, - DocSession: kit.DocSession, - user: { name: me, email: me, color: kit.cursorColor(me) }, - // the same spec and the same name as the Docs page's (apps/docs/public/app.js) - facetSpec: (className) => ({ - className, - mainModule: processors.mainModule, - source: ["itx", ["cd", "/"], "repos", ["get", CODE_REPO], ["modules"]], - cacheKey: `docs-processors:${processors.version}:${pins.join(",")}`, - }), - }; - })(); - editorAsked.catch(() => { - editorAsked = undefined; - }); - return editorAsked; -} - /** The board's link with one task open, and the same link with none. */ const taskHref = (path) => { const next = new URLSearchParams(location.search); @@ -1673,73 +1506,13 @@ `; } -/** One open task: its head (the title and the properties), its saving line, and its text. */ +/** One open task: its head (the title and the properties), its saving line, and its file's text. */ function TaskBody({ task, columns, dimensions, save, move }) { - // A DOC'S SESSION IS OF ONE SESSION OF THE PAGE'S ITX: its context and its subscriptions end - // with that socket, and the kit's "Try again" syncs through the context it has. A publish of the - // mind, or a deploy, cuts the socket for a few seconds. So the sheet makes a new DocSession at - // each new session of the page (`epoch`), which opens the doc again by itself. WHAT THAT COSTS: - // keys typed after the cut and before the new session is live were never sent, and are lost - // (the editor is read-only while it opens, so the loss is the cut's own second or two). - // `text` is what the editor shows until it is live: the file as the board has it at that moment. - const { epoch } = useSyncExternalStore(pageSession.subscribe, pageSession.get, pageSession.get); - const [opened, setOpened] = useState({ epoch, text: task.source }); - if (opened.epoch !== epoch) setOpened({ epoch, text: task.source }); - const [editor, setEditor] = useState(null); - const [attempt, setAttempt] = useState(0); - useEffect(() => { - let current = true; - editorOf().then( - (kit) => current && setEditor({ kit }), - (error) => current && setEditor({ error: wordsOf(error) }), - ); - return () => { - current = false; - }; - }, [attempt]); - const session = useMemo( - () => - editor?.kit - ? new editor.kit.DocSession({ - itx, - repo: REPO, - path: task.path, - kind: "markdown", - text: opened.text, - user: editor.kit.user, - facetSpec: editor.kit.facetSpec, - commentOnly: false, - }) - : null, - [editor, task.path, opened], - ); return html` <div class="task-sheet-body"> <${TaskHead} task=${task} columns=${columns} dimensions=${dimensions} move=${move} /> - <p class="task-saving" role="status"> - <${PropertiesSaving} save=${save} /> - ${session && html`<${TextSaving} session=${session} />`} - </p> - ${ - session - ? html`<${TaskText} session=${session} DocEditor=${editor.kit.DocEditor} />` - : editor?.error - ? html` - <p class="tasks-note" role="alert"> - Couldn't open the editor: ${editor.error}${" "} - <button - class="tasks-link" - onClick=${() => { - setEditor(null); - setAttempt(attempt + 1); - }} - > - Try again - </button> - </p> - ` - : html`<p class="tasks-note">Opening the editor…</p>` - } + <p class="task-saving" role="status"><${PropertiesSaving} save=${save} /></p> + <pre class="task-text">${task.source}</pre> </div> `; } @@ -1758,84 +1531,6 @@ </span> `; return html`<span class="task-saving-part"><${CheckIcon} />Title and properties: saved</span>`; -} - -/** Where the text stands: it is the doc's, saved by the doc's processor. */ -function TextSaving({ session }) { - const { status } = useSyncExternalStore(session.subscribe, session.state, session.state); - const words = { - opening: "Text: opening…", - editing: - "Text: typed, not in the repo yet (it is saved within a minute, or when the sheet closes)", - saved: "Text: saved", - "save-failed": `Text: not saved: ${status.message}`, - disconnected: "Text: the connection was lost; opening again…", - unavailable: "Text: cannot be edited now", - }[status.kind]; - const pending = status.kind === "editing" || status.kind === "opening"; - const failed = status.kind === "save-failed" || status.kind === "unavailable"; - return html` - <span - class="task-saving-part" - data-pending=${pending || undefined} - data-failed=${failed || undefined} - > - ${pending ? html`<${Spinner} />` : failed ? html`<${TriangleAlertIcon} />` : html`<${CheckIcon} />`}${words} - </span> - `; -} - -/** The task's text in the Docs editor. */ -function TaskText({ session, DocEditor }) { - // TAB IN THE EDITOR. The editor takes Tab for itself (it indents the line), as a text editor - // does. For a person who goes through the sheet with Tab that is a trap, and a harmful one: the - // cursor of an editor just entered is on the file's first line, which is the frontmatter's - // fence. So Tab passes THROUGH an editor that the keyboard brought the focus to, until the - // person types or clicks in it: from then on Tab is the editor's. The handlers are on the way - // down to the editor (capture), so the editor never sees a Tab that passes. - const passing = useRef(false); - const byPointer = useRef(false); - const inEditor = (event) => - event.target instanceof Element && Boolean(event.target.closest(".cm-content")); - return html` - <div - class="task-text" - onPointerDownCapture=${() => { - byPointer.current = true; - passing.current = false; - }} - onFocusCapture=${(event) => { - if (!inEditor(event)) return; - passing.current = !byPointer.current; - byPointer.current = false; - }} - onKeyDownCapture=${(event) => { - byPointer.current = false; - if (!inEditor(event)) return; - // not prevented: the browser moves the focus on, which is what Tab does elsewhere - if (event.key === "Tab" && passing.current) event.stopPropagation(); - else if (!["Shift", "Control", "Alt", "Meta"].includes(event.key)) passing.current = false; - }} - > - <${DocEditor} - session=${session} - listHref=${taskHref(null)} - listLabel="tasks" - editHref=${taskHref(session.options.path)} - onNavigate=${(href) => { - history.pushState(null, "", href); - dispatchEvent(new PopStateEvent("popstate")); - }} - unavailable=${html` - <p> - The task's text is edited through the Docs app's processors in this mind's config repo - (<code>apps/docs/processors/</code>). The title and the properties above do not need - them. - </p> - `} - /> - </div> - `; } /** The task's title and properties, each edited in place. A change is a change of the board: on
M public/manifest.webmanifest
@@ -1,7 +1,7 @@ { "name": "Tasks", "short_name": "Tasks", - "description": "The mind's tasks as a board: the markdown files under tasks/ in its config repo.", + "description": "The mind's tasks as a board: the markdown files under todo/ in its home repo.", "start_url": "/", "display": "browser", "icons": [
M public/tasks-model.js
@@ -1,7 +1,6 @@ // tasks-model.js — A TASK FILE AS A CARD, text in and text out: no network, no page. A task is a -// markdown file under tasks/ in a repo of the mind (the tasks repo, `TASKS_REPO` below, unless a -// board or a caller names another), and what the board knows of it is in the file's frontmatter -// and its first heading: +// markdown file under todo/ in a repo of the mind (`TASKS_DIR` below), and what the board knows of +// it is in the file's frontmatter and its first heading: // // --- // status: in-progress the column (below); `state:` is read too, as the first board wrote it @@ -30,13 +29,10 @@ // hand-written, and a key the board does not know stays where it is. // The page (app.js) and the test (../tasks-model.test.mjs) both load this file as it is. -/** THE TASKS REPO, AND THE FOLDER OF A REPO WHOSE MARKDOWN FILES ARE ITS TASKS. The tasks repo is - * the one that the board shows and `itx.config.followTasks` follows when nobody names a repo. It - * lives in the mind alone (no GitHub mirror), and a commit to it publishes nothing. Any other - * repo of the mind is a board too, by its name: `tasks.<domain>/?repo=<name>` (app.js), and the - * change feed tells of every repo's tasks (../feed.js). Nothing else names these two. */ -export const TASKS_REPO = "/repos/tasks"; -export const TASKS_DIR = "tasks"; +/** THE FOLDER OF A REPO WHOSE MARKDOWN FILES ARE ITS TASKS. It is `todo`, not `tasks`: on a laptop + * the repos of a mind are cloned side by side into the home repo's folder, and there the folder + * `tasks/` is this app's own repo. */ +export const TASKS_DIR = "todo"; /** The board's columns, in order. A task whose status is none of these (or of their other * spellings below) gets a column of its own after them. */ @@ -233,7 +229,7 @@ humanAsk: [valueOf(lines, "human-ask", true) ?? valueOf(lines, "human_ask", true) ?? []] .flat() .filter(Boolean), - /** the folders between tasks/ and the file: "" for a task at the top */ + /** the folders between todo/ and the file: "" for a task at the top */ folder, source, }; @@ -441,9 +437,9 @@ /** WHERE AN AGENT'S CHAT IS IN THE DASH: the Dash's own address of the agent at this context path, * with no origin ("/agents/agents/claude/x"), or null when the value is no context path (a card - * whose `agent:` is a plain name has no chat to open). The encoding is that of - * apps/dash/links.ts `dashLinks(apex).agent`, which is what `itx.config.dashLink` answers: a path - * that a URL's pathname can carry goes in the pathname, any other in `?contextPath=`. */ + * whose `agent:` is a plain name has no chat to open). The encoding is the Dash's own + * (@iterate-com/ui `dashPaths`): a path that a URL's pathname can carry goes in the pathname, any + * other in `?contextPath=`. */ export function agentChatPath(agent) { const path = String(agent ?? "").trim(); if (!path.startsWith("/") || path === "/") return null; @@ -761,7 +757,7 @@ const wantedColumns = statuses.length > 0 ? new Set(statuses.map(columnOf)) : null; return tasks.filter((task) => { if (wantedColumns && !wantedColumns.has(task.column)) return false; - // oxlint-disable-next-line iterate/simple-truthiness-check -- "" is the folder at the top of tasks/, null is no folder asked for + // "" is the folder at the top of todo/, null is no folder asked for if (folder !== null && task.folder !== folder && !task.folder.startsWith(`${folder}/`)) return false; for (const { id } of named)
M tasks-model.test.mjs
@@ -1,5 +1,5 @@ // tasks-model.test.mjs — the board's reading and writing of a task file (public/tasks-model.js). -// Run it with `node --test apps/tasks/`. +// Run it from the repo's root with `node --test tasks-model.test.mjs`. import assert from "node:assert/strict"; import { test } from "node:test"; import { @@ -33,7 +33,7 @@ test("a file with frontmatter is a card with its status, tags, size and owner", () => { const task = parseTask( - "tasks/cloud/board-filters.md", + "todo/cloud/board-filters.md", "---\nstatus: in-progress\nsize: large\ntags: [board, ui]\nowner: jonas\n---\n\n# Board filters\n\nText.\n", ); assert.equal(task.title, "Board filters"); @@ -46,25 +46,25 @@ }); test("a file with no frontmatter is a task in Todo, titled by its heading or its name", () => { - assert.equal(parseTask("tasks/a.md", "# Ship it\n").column, "todo"); - assert.equal(parseTask("tasks/a.md", "# Ship it\n").title, "Ship it"); + assert.equal(parseTask("todo/a.md", "# Ship it\n").column, "todo"); + assert.equal(parseTask("todo/a.md", "# Ship it\n").title, "Ship it"); assert.equal( - parseTask("tasks/2026-11-19-board-filters.md", "No heading.\n").title, + parseTask("todo/2026-11-19-board-filters.md", "No heading.\n").title, "Board filters", ); - assert.equal(parseTask("tasks/a.md", "").folder, ""); + assert.equal(parseTask("todo/a.md", "").folder, ""); }); test("the title is the frontmatter's, before the heading; a heading in a code fence is no title", () => { assert.equal( - parseTask("tasks/a.md", '---\ntitle: "From: the top"\n---\n# Heading\n').title, + parseTask("todo/a.md", '---\ntitle: "From: the top"\n---\n# Heading\n').title, "From: the top", ); - assert.equal(parseTask("tasks/a.md", "```\n# not this\n```\n\n# This\n").title, "This"); + assert.equal(parseTask("todo/a.md", "```\n# not this\n```\n\n# This\n").title, "This"); }); test("the older key `state:` and a block list of labels are read", () => { - const task = parseTask("tasks/a.md", "---\nstate: in-review\nlabels:\n - one\n - two\n---\n"); + const task = parseTask("todo/a.md", "---\nstate: in-review\nlabels:\n - one\n - two\n---\n"); assert.equal(task.column, "in-review"); assert.deepEqual(task.tags, ["one", "two"]); }); @@ -102,8 +102,8 @@ test("a status of its own gets a column of its own, after the five", () => { const tasks = tasksOf({ - "tasks/a.md": "---\nstatus: blocked\n---\n# A\n", - "tasks/b.md": "---\nstatus: done\n---\n# B\n", + "todo/a.md": "---\nstatus: blocked\n---\n# A\n", + "todo/b.md": "---\nstatus: done\n---\n# B\n", }); assert.deepEqual( columnsOf(tasks).map((column) => column.id), @@ -139,7 +139,7 @@ "---\r\nstatus: done\r\n---\r\nBody\r\n", ); assert.equal( - parseTask("tasks/a.md", setStatus("# T\n", "waiting: on Misha")).status, + parseTask("todo/a.md", setStatus("# T\n", "waiting: on Misha")).status, "waiting: on Misha", ); }); @@ -147,45 +147,45 @@ test("what was set is what is read", () => { for (const status of ["backlog", "todo", "in-progress", "in-review", "done", "blocked"]) assert.equal( - parseTask("tasks/a.md", setStatus("---\ntags: [a]\n---\n# T\n", status)).column, + parseTask("todo/a.md", setStatus("---\ntags: [a]\n---\n# T\n", status)).column, status, ); }); -test("a new task is a file under tasks/ named by its title, never over another", () => { +test("a new task is a file under todo/ named by its title, never over another", () => { assert.deepEqual(newTask({ title: "Ship the Tour!" }), { - path: "tasks/ship-the-tour.md", + path: "todo/ship-the-tour.md", content: "---\nstatus: todo\n---\n\n# Ship the Tour!\n", }); - const taken = ["tasks/cloud/ship.md", "tasks/cloud/ship-2.md"]; + const taken = ["todo/cloud/ship.md", "todo/cloud/ship-2.md"]; assert.equal( newTask({ title: "Ship", folder: "cloud", status: "done", taken }).path, - "tasks/cloud/ship-3.md", + "todo/cloud/ship-3.md", ); - assert.equal(newTask({ title: " " }).path, "tasks/new-task.md"); - assert.equal(newTask({ title: "x", folder: "../../Etc" }).path, "tasks/etc/x.md"); + assert.equal(newTask({ title: " " }).path, "todo/new-task.md"); + assert.equal(newTask({ title: "x", folder: "../../Etc" }).path, "todo/etc/x.md"); }); -test("only markdown under tasks/ is a task", () => { - assert.equal(isTaskPath("tasks/a.md"), true); - assert.equal(isTaskPath("tasks/deep/er/a.markdown"), true); - assert.equal(isTaskPath("tasks/proof.cjs"), false); +test("only markdown under todo/ is a task", () => { + assert.equal(isTaskPath("todo/a.md"), true); + assert.equal(isTaskPath("todo/deep/er/a.markdown"), true); + assert.equal(isTaskPath("todo/proof.cjs"), false); assert.equal(isTaskPath("backlog/a.md"), false); - assert.equal(isTaskPath("apps/tasks/README.md"), false); + assert.equal(isTaskPath("apps/todo/README.md"), false); }); test("the filter is every word, any of the tags, and a folder with those beneath it", () => { const tasks = tasksOf({ - "tasks/a.md": "---\ntags: [ui]\n---\n# Board filters\n", - "tasks/cloud/b.md": "---\ntags: [cloud]\nowner: misha\n---\n# Cloud arcs\n", - "tasks/cloud/designs/c.md": "# Wizard design\n", + "todo/a.md": "---\ntags: [ui]\n---\n# Board filters\n", + "todo/cloud/b.md": "---\ntags: [cloud]\nowner: misha\n---\n# Cloud arcs\n", + "todo/cloud/designs/c.md": "# Wizard design\n", }); const paths = (filter) => filterTasks(tasks, filter).map((task) => task.path); - assert.deepEqual(paths({ query: "board FILT" }), ["tasks/a.md"]); - assert.deepEqual(paths({ query: "misha" }), ["tasks/cloud/b.md"]); - assert.deepEqual(paths({ where: { tags: ["ui", "cloud"] } }), ["tasks/a.md", "tasks/cloud/b.md"]); - assert.deepEqual(paths({ folder: "cloud" }), ["tasks/cloud/b.md", "tasks/cloud/designs/c.md"]); - assert.deepEqual(paths({ folder: "" }), ["tasks/a.md"]); + assert.deepEqual(paths({ query: "board FILT" }), ["todo/a.md"]); + assert.deepEqual(paths({ query: "misha" }), ["todo/cloud/b.md"]); + assert.deepEqual(paths({ where: { tags: ["ui", "cloud"] } }), ["todo/a.md", "todo/cloud/b.md"]); + assert.deepEqual(paths({ folder: "cloud" }), ["todo/cloud/b.md", "todo/cloud/designs/c.md"]); + assert.deepEqual(paths({ folder: "" }), ["todo/a.md"]); assert.deepEqual( counts(tasks, (task) => task.tags), [ @@ -196,12 +196,12 @@ }); const DIMENSIONED = { - "tasks/a.md": + "todo/a.md": "---\nstatus: todo\ntags: [ui, board]\nsize: large\npriority: high\nowner: jonas\n---\n# A\n", - "tasks/b.md": + "todo/b.md": "---\nstatus: done\nlabels: [ui]\nsize: small\nassignee: misha\nagent: /agents/tasks/b\n---\n# B\n", - "tasks/c.md": "---\nstatus: todo\nsize: large\npriority: urgent\nmood: fine\n---\n# C\n", - "tasks/deep/d.md": "# D\n", + "todo/c.md": "---\nstatus: todo\nsize: large\npriority: urgent\nmood: fine\n---\n# C\n", + "todo/deep/d.md": "# D\n", }; test("a card has the dimensions its frontmatter holds, and no other", () => { @@ -265,14 +265,14 @@ // no file with a priority: the board has no priority assert.deepEqual( dimensionsOf( - tasksOf({ "tasks/a.md": "---\nsize: small\n---\n# A\n", "tasks/b.md": "# B\n" }), + tasksOf({ "todo/a.md": "---\nsize: small\n---\n# A\n", "todo/b.md": "# B\n" }), ).map(({ id }) => id), ["size"], ); - assert.deepEqual(dimensionsOf(tasksOf({ "tasks/b.md": "# B\n" })), []); + assert.deepEqual(dimensionsOf(tasksOf({ "todo/b.md": "# B\n" })), []); // a value with no place in the order comes after those that have one const sizes = dimensionsOf( - tasksOf({ "tasks/a.md": "---\nsize: epic\n---\n", "tasks/b.md": "---\nsize: Small\n---\n" }), + tasksOf({ "todo/a.md": "---\nsize: epic\n---\n", "todo/b.md": "---\nsize: Small\n---\n" }), ); assert.deepEqual( sizes[0].values.map(([value]) => value), @@ -283,19 +283,19 @@ test("the filter is one value of each dimension named", () => { const tasks = tasksOf(DIMENSIONED); const paths = (where) => filterTasks(tasks, { where }).map((task) => task.path); - assert.deepEqual(paths({ size: ["large"] }), ["tasks/a.md", "tasks/c.md"]); - assert.deepEqual(paths({ size: ["large"], priority: ["urgent"] }), ["tasks/c.md"]); - assert.deepEqual(paths({ size: ["large", "small"], tags: ["ui"] }), ["tasks/a.md", "tasks/b.md"]); - assert.deepEqual(paths({ owner: ["misha"] }), ["tasks/b.md"]); + assert.deepEqual(paths({ size: ["large"] }), ["todo/a.md", "todo/c.md"]); + assert.deepEqual(paths({ size: ["large"], priority: ["urgent"] }), ["todo/c.md"]); + assert.deepEqual(paths({ size: ["large", "small"], tags: ["ui"] }), ["todo/a.md", "todo/b.md"]); + assert.deepEqual(paths({ owner: ["misha"] }), ["todo/b.md"]); assert.deepEqual(paths({ owner: [] }).length, 4); // the words reach every dimension's values assert.deepEqual( filterTasks(tasks, { query: "urgent" }).map((task) => task.path), - ["tasks/c.md"], + ["todo/c.md"], ); assert.deepEqual( filterTasks(tasks, { query: "agents/tasks" }).map((task) => task.path), - ["tasks/b.md"], + ["todo/b.md"], ); }); @@ -307,18 +307,18 @@ dimensionsOf(tasks).find((each) => each.id === id), ).map((row) => [row.value, row.label, row.tasks.map((task) => task.path)]); assert.deepEqual(rows("size"), [ - ["small", "small", ["tasks/b.md"]], - ["large", "large", ["tasks/a.md", "tasks/c.md"]], - [null, "No size", ["tasks/deep/d.md"]], + ["small", "small", ["todo/b.md"]], + ["large", "large", ["todo/a.md", "todo/c.md"]], + [null, "No size", ["todo/deep/d.md"]], ]); assert.deepEqual(rows("tags"), [ - ["ui", "ui", ["tasks/a.md", "tasks/b.md"]], - ["board", "board", ["tasks/a.md"]], - [null, "No tag", ["tasks/c.md", "tasks/deep/d.md"]], + ["ui", "ui", ["todo/a.md", "todo/b.md"]], + ["board", "board", ["todo/a.md"]], + [null, "No tag", ["todo/c.md", "todo/deep/d.md"]], ]); // a row with no task shown (a filter took them) is left out assert.deepEqual(rows("size", filterTasks(tasks, { where: { owner: ["jonas"] } })), [ - ["large", "large", ["tasks/a.md"]], + ["large", "large", ["todo/a.md"]], ]); }); @@ -332,7 +332,7 @@ '---\nstatus: todo\ntags: ["ui, really"]\n---\n\n# T\n', ); assert.equal( - parseTask("tasks/t.md", newTask({ title: "T", fields: { tags: "ui" } }).content).tags[0], + parseTask("todo/t.md", newTask({ title: "T", fields: { tags: "ui" } }).content).tags[0], "ui", ); assert.equal( @@ -340,34 +340,34 @@ "---\nstatus: todo\n---\n\n# T\n", ); // a status change keeps every dimension's line, and a line the board does not know, byte for byte - const source = DIMENSIONED["tasks/c.md"]; + const source = DIMENSIONED["todo/c.md"]; assert.equal(setStatus(source, "done"), source.replace("status: todo", "status: done")); }); test("changes are applied to the files as they are at the commit, and a commit names each path once", () => { - const files = { "tasks/a.md": "---\nstatus: todo\nsize: small\n---\n# A\n" }; + const files = { "todo/a.md": "---\nstatus: todo\nsize: small\n---\n# A\n" }; const changes = [ - { kind: "status", path: "tasks/a.md", status: "in-progress" }, - { kind: "create", path: "tasks/b.md", content: "---\nstatus: todo\n---\n\n# B\n" }, - { kind: "status", path: "tasks/b.md", status: "done" }, - { kind: "status", path: "tasks/gone.md", status: "done" }, + { kind: "status", path: "todo/a.md", status: "in-progress" }, + { kind: "create", path: "todo/b.md", content: "---\nstatus: todo\n---\n\n# B\n" }, + { kind: "status", path: "todo/b.md", status: "done" }, + { kind: "status", path: "todo/gone.md", status: "done" }, ]; assert.deepEqual(commitOf(files, changes), [ - { path: "tasks/a.md", content: "---\nstatus: in-progress\nsize: small\n---\n# A\n" }, - { path: "tasks/b.md", content: "---\nstatus: done\n---\n\n# B\n" }, + { path: "todo/a.md", content: "---\nstatus: in-progress\nsize: small\n---\n# A\n" }, + { path: "todo/b.md", content: "---\nstatus: done\n---\n\n# B\n" }, ]); assert.equal( messageOf(changes.slice(0, 3)), - "tasks: 2 changes\n\n- tasks/a.md is in-progress\n- new tasks/b.md is done", + "tasks: 2 changes\n\n- todo/a.md is in-progress\n- new todo/b.md is done", ); - assert.equal(messageOf(changes.slice(0, 1)), "tasks: tasks/a.md is in-progress"); + assert.equal(messageOf(changes.slice(0, 1)), "tasks: todo/a.md is in-progress"); // a card moved and moved back writes nothing assert.deepEqual( - commitOf(files, [changes[0], { kind: "status", path: "tasks/a.md", status: "todo" }]), + commitOf(files, [changes[0], { kind: "status", path: "todo/a.md", status: "todo" }]), [], ); // a file somebody else made first is not written over - assert.equal(applyChange({ "tasks/b.md": "theirs" }, changes[1])["tasks/b.md"], "theirs"); + assert.equal(applyChange({ "todo/b.md": "theirs" }, changes[1])["todo/b.md"], "theirs"); }); // ── what the task sheet writes: a title, a dimension ── @@ -401,16 +401,16 @@ assert.equal(setField(WRITTEN, "mood", "bad"), WRITTEN); assert.equal(setField(WRITTEN, "status", "done"), WRITTEN); // what was written is what is read - assert.deepEqual(parseTask("tasks/a.md", setField(WRITTEN, "tags", ["a b", "c, d", "ui"])).tags, [ + assert.deepEqual(parseTask("todo/a.md", setField(WRITTEN, "tags", ["a b", "c, d", "ui"])).tags, [ "a b", "c, d", "ui", ]); assert.equal( - parseTask("tasks/a.md", setField(WRITTEN, "owner", "Ada: the first")).owner, + parseTask("todo/a.md", setField(WRITTEN, "owner", "Ada: the first")).owner, "Ada: the first", ); - assert.deepEqual(parseTask("tasks/a.md", "---\ntags: [it's, other]\n---\n").tags, [ + assert.deepEqual(parseTask("todo/a.md", "---\ntags: [it's, other]\n---\n").tags, [ "it's", "other", ]); @@ -456,10 +456,10 @@ setTitle(WRITTEN, "Billing, the page"), WRITTEN.replace("# Billing page", "# Billing, the page"), ); - assert.equal(parseTask("tasks/billing-page.md", setTitle(WRITTEN, "New name")).title, "New name"); + assert.equal(parseTask("todo/billing-page.md", setTitle(WRITTEN, "New name")).title, "New name"); assert.equal( - parseTask("tasks/billing-page.md", setTitle(WRITTEN, "New name")).path, - "tasks/billing-page.md", + parseTask("todo/billing-page.md", setTitle(WRITTEN, "New name")).path, + "todo/billing-page.md", ); // `title:` in the frontmatter, when the file has it; the heading below it stays assert.equal( @@ -490,23 +490,23 @@ }); test("a title and a dimension are changes like a status: applied to the file as it is at the commit", () => { - const files = { "tasks/a.md": "---\nstatus: todo\n---\n\n# A\n" }; + const files = { "todo/a.md": "---\nstatus: todo\n---\n\n# A\n" }; const changes = [ - { kind: "title", path: "tasks/a.md", title: "A, renamed" }, - { kind: "field", path: "tasks/a.md", field: "priority", value: "high" }, - { kind: "field", path: "tasks/a.md", field: "tags", value: ["ui"] }, - { kind: "status", path: "tasks/a.md", status: "done" }, - { kind: "field", path: "tasks/gone.md", field: "size", value: "small" }, + { kind: "title", path: "todo/a.md", title: "A, renamed" }, + { kind: "field", path: "todo/a.md", field: "priority", value: "high" }, + { kind: "field", path: "todo/a.md", field: "tags", value: ["ui"] }, + { kind: "status", path: "todo/a.md", status: "done" }, + { kind: "field", path: "todo/gone.md", field: "size", value: "small" }, ]; assert.deepEqual(commitOf(files, changes), [ { - path: "tasks/a.md", + path: "todo/a.md", content: "---\nstatus: done\npriority: high\ntags: [ui]\n---\n\n# A, renamed\n", }, ]); // somebody edited the text meanwhile: their line stays, ours are applied to their file const theirs = { - "tasks/a.md": "---\nstatus: todo\nsize: large\n---\n\n# A\n\nTheir new paragraph.\n", + "todo/a.md": "---\nstatus: todo\nsize: large\n---\n\n# A\n\nTheir new paragraph.\n", }; assert.equal( commitOf(theirs, changes)[0].content, @@ -514,17 +514,17 @@ ); assert.equal( messageOf(changes.slice(0, 4)), - "tasks: 4 changes\n\n- tasks/a.md: the title\n- tasks/a.md: priority is high\n- tasks/a.md: tags is ui\n- tasks/a.md is done", + "tasks: 4 changes\n\n- todo/a.md: the title\n- todo/a.md: priority is high\n- todo/a.md: tags is ui\n- todo/a.md is done", ); assert.equal( - messageOf([{ kind: "field", path: "tasks/a.md", field: "size", value: "" }]), - "tasks: tasks/a.md: no size", + messageOf([{ kind: "field", path: "todo/a.md", field: "size", value: "" }]), + "tasks: todo/a.md: no size", ); // a property set and set back writes nothing assert.deepEqual( - commitOf({ "tasks/a.md": WRITTEN }, [ - { kind: "field", path: "tasks/a.md", field: "priority", value: "low" }, - { kind: "field", path: "tasks/a.md", field: "priority", value: "high" }, + commitOf({ "todo/a.md": WRITTEN }, [ + { kind: "field", path: "todo/a.md", field: "priority", value: "low" }, + { kind: "field", path: "todo/a.md", field: "priority", value: "high" }, ]), [], ); @@ -534,7 +534,7 @@ const path = newTask({ title: "The task sheet: a card opens in the board, with the Docs editor and comments", }).path; - assert.equal(path, "tasks/the-task-sheet-a-card-opens-in-the-board-with-the-docs-editor.md"); + assert.equal(path, "todo/the-task-sheet-a-card-opens-in-the-board-with-the-docs-editor.md"); assert.equal(slugify("one two three", 9), "one-two"); assert.equal(slugify("one two three", 7), "one-two"); assert.equal(slugify("one two three", 8), "one-two"); @@ -545,22 +545,22 @@ test("blocked-on and human-ask are read whole, and only an open task that has one needs a person", () => { const asks = parseTask( - "tasks/a.md", + "todo/a.md", "---\nstatus: todo\nhuman-ask: [sign the grant, read it]\nblocked-on: a review, then a deploy\n---\n# A\n", ); assert.deepEqual(asks.humanAsk, ["sign the grant", "read it"]); assert.equal(asks.blockedOn, "a review, then a deploy"); - const oneLine = parseTask("tasks/b.md", "---\nhuman-ask: say yes, or no\n---\n# B\n"); + const oneLine = parseTask("todo/b.md", "---\nhuman-ask: say yes, or no\n---\n# B\n"); assert.deepEqual(oneLine.humanAsk, ["say yes, or no"]); const block = parseTask( - "tasks/c.md", + "todo/c.md", "---\nblocked_on: CI\nhuman-ask:\n - one\n - two\n---\n# C\n", ); assert.deepEqual([block.blockedOn, block.humanAsk], ["CI", ["one", "two"]]); - const none = parseTask("tasks/d.md", "---\nstatus: todo\nhuman-ask:\n---\n# D\n"); + const none = parseTask("todo/d.md", "---\nstatus: todo\nhuman-ask:\n---\n# D\n"); assert.deepEqual([none.blockedOn, none.humanAsk], ["", []]); - const done = parseTask("tasks/e.md", "---\nstatus: done\nhuman-ask: [late]\n---\n# E\n"); - const blocked = parseTask("tasks/f.md", "---\nblocked-on: CI\n---\n# Aa blocked\n"); + const done = parseTask("todo/e.md", "---\nstatus: done\nhuman-ask: [late]\n---\n# E\n"); + const blocked = parseTask("todo/f.md", "---\nblocked-on: CI\n---\n# Aa blocked\n"); assert.deepEqual( needsAPerson([none, done, blocked, oneLine, asks]).map((task) => task.title), ["A", "B", "Aa blocked"], @@ -569,13 +569,13 @@ test("a # in blocked-on or human-ask is a word; after any other key it starts a comment", () => { const task = parseTask( - "tasks/a.md", + "todo/a.md", '---\nstatus: todo # soon\nblocked-on: PR #12 review\nhuman-ask:\n - Merge #99, or wait?\n - "quoted # too"\n---\n# A\n', ); assert.equal(task.status, "todo"); assert.equal(task.blockedOn, "PR #12 review"); assert.deepEqual(task.humanAsk, ["Merge #99, or wait?", "quoted # too"]); - assert.deepEqual(parseTask("tasks/b.md", "---\nhuman-ask: [Sign #7?, read it]\n---\n").humanAsk, [ + assert.deepEqual(parseTask("todo/b.md", "---\nhuman-ask: [Sign #7?, read it]\n---\n").humanAsk, [ "Sign #7?", "read it", ]); @@ -607,7 +607,7 @@ "---\nstatus: todo\nowner: jonas\n---\n\n# A\n\nText.\n\n## Answers\n\n- **Merge #12 now, or wait?** Wait for the deploy. (misha@nustom.com, 2026-11-20 14:50 UTC)\n- **Sign the grant?** (jonas@nustom.com, 2026-11-21 09:05 UTC)\n", ); assert.deepEqual( - [parseTask("tasks/a.md", one).humanAsk, parseTask("tasks/a.md", two).humanAsk], + [parseTask("todo/a.md", one).humanAsk, parseTask("todo/a.md", two).humanAsk], [["Sign the grant?"], []], ); // an ask that the file does not have changes nothing @@ -651,20 +651,20 @@ }); test("an answer is a change like any other: applied to the file as it is at the commit, and named in the message", () => { - const files = { "tasks/a.md": "---\nstatus: todo\nhuman-ask:\n - Sign the grant?\n---\n# A\n" }; - const change = { kind: "answer", path: "tasks/a.md", ask: "Sign the grant?", ...answered }; + const files = { "todo/a.md": "---\nstatus: todo\nhuman-ask:\n - Sign the grant?\n---\n# A\n" }; + const change = { kind: "answer", path: "todo/a.md", ask: "Sign the grant?", ...answered }; const [written] = commitOf(files, [ - { kind: "status", path: "tasks/a.md", status: "in-progress" }, + { kind: "status", path: "todo/a.md", status: "in-progress" }, change, ]); assert.equal( written.content, "---\nstatus: in-progress\n---\n# A\n\n## Answers\n\n- **Sign the grant?** Wait for the deploy. (misha@nustom.com, 2026-11-20 14:50 UTC)\n", ); - assert.equal(messageOf([change]), 'tasks: tasks/a.md: answered "Sign the grant?"'); + assert.equal(messageOf([change]), 'tasks: todo/a.md: answered "Sign the grant?"'); // an ask that somebody else answered meanwhile is gone from the file: the change writes nothing - assert.deepEqual(commitOf({ "tasks/a.md": "---\nstatus: todo\n---\n# A\n" }, [change]), []); - assert.equal(applyChange({}, change)["tasks/a.md"], undefined); + assert.deepEqual(commitOf({ "todo/a.md": "---\nstatus: todo\n---\n# A\n" }, [change]), []); + assert.equal(applyChange({}, change)["todo/a.md"], undefined); }); test("the answers that a task's text keeps are read back as they were written", () => { @@ -700,7 +700,7 @@ assert.deepEqual(answersOf(file), []); }); -const asksOf = (source) => parseTask("tasks/a.md", source).humanAsk; +const asksOf = (source) => parseTask("todo/a.md", source).humanAsk; test("an ask is one more line under human-ask, however the file wrote the key, and is read back as it was", () => { const plain = "---\nstatus: todo\n---\n# A\n"; @@ -772,7 +772,7 @@ "---\nblocked_on: a review\n---\n", ); for (const odd of ["[CI] is red", "[all of it]", '"the deploy"', "'x'"]) - assert.equal(parseTask("tasks/a.md", setBlockedOn(plain, odd)).blockedOn, odd, odd); + assert.equal(parseTask("todo/a.md", setBlockedOn(plain, odd)).blockedOn, odd, odd); }); test("a note is one line under ## Log, after the notes before it", () => { @@ -813,14 +813,14 @@ }); test("an ask, what holds a task and a note are changes like the others, each named in the message", () => { - const files = { "tasks/a.md": "---\nstatus: todo\n---\n# A\n" }; + const files = { "todo/a.md": "---\nstatus: todo\n---\n# A\n" }; const changes = [ - { kind: "status", path: "tasks/a.md", status: "in-progress" }, - { kind: "blocked", path: "tasks/a.md", blockedOn: "PR #12" }, - { kind: "ask", path: "tasks/a.md", ask: "Ship it?" }, + { kind: "status", path: "todo/a.md", status: "in-progress" }, + { kind: "blocked", path: "todo/a.md", blockedOn: "PR #12" }, + { kind: "ask", path: "todo/a.md", ask: "Ship it?" }, { kind: "note", - path: "tasks/a.md", + path: "todo/a.md", note: "Started.", by: "/agents/worker", at: "2026-11-20T15:40:31.000Z", @@ -833,18 +833,18 @@ ); assert.equal( messageOf(changes), - 'tasks: 4 changes\n\n- tasks/a.md is in-progress\n- tasks/a.md: blocked on PR #12\n- tasks/a.md: asks "Ship it?"\n- tasks/a.md: a note', + 'tasks: 4 changes\n\n- todo/a.md is in-progress\n- todo/a.md: blocked on PR #12\n- todo/a.md: asks "Ship it?"\n- todo/a.md: a note', ); assert.equal( - messageOf([{ kind: "blocked", path: "tasks/a.md", blockedOn: "" }]), - "tasks: tasks/a.md: no longer blocked", + messageOf([{ kind: "blocked", path: "todo/a.md", blockedOn: "" }]), + "tasks: todo/a.md: no longer blocked", ); // a kind that the model does not know changes nothing - assert.deepEqual(commitOf(files, [{ kind: "explode", path: "tasks/a.md" }]), []); + assert.deepEqual(commitOf(files, [{ kind: "explode", path: "todo/a.md" }]), []); }); -test("an agent's chat in the Dash: the address that itx.config.dashLink answers, and none for a plain name", () => { - // each address is what the live mind's itx.config.dashLink({ view: "agent", contextPath }) answered on 20 Nov 2026 +test("an agent's chat in the Dash: the Dash's own address of the agent, and none for a plain name", () => { + // each address is what a live mind's Dash gave for the agent on 20 Nov 2026 assert.equal( agentChatPath("/agents/claude/tasks-agent-chat-link-mwp6c8m4-852f95"), "/agents/agents/claude/tasks-agent-chat-link-mwp6c8m4-852f95", @@ -859,20 +859,20 @@ test("filterTasks filters by statuses (normalized column ids)", () => { const tasks = tasksOf({ - "tasks/a.md": "---\nstatus: in-progress\ntags: [onboarding]\n---\n\n# Active\n", - "tasks/b.md": "---\nstatus: todo\ntags: [onboarding]\n---\n\n# Next\n", - "tasks/c.md": "---\nstatus: done\ntags: [onboarding]\n---\n\n# Finished\n", - "tasks/d.md": "---\nstatus: backlog\ntags: [other]\n---\n\n# Later\n", + "todo/a.md": "---\nstatus: in-progress\ntags: [onboarding]\n---\n\n# Active\n", + "todo/b.md": "---\nstatus: todo\ntags: [onboarding]\n---\n\n# Next\n", + "todo/c.md": "---\nstatus: done\ntags: [onboarding]\n---\n\n# Finished\n", + "todo/d.md": "---\nstatus: backlog\ntags: [other]\n---\n\n# Later\n", }); assert.deepEqual( filterTasks(tasks, { where: { tags: ["onboarding"] }, statuses: ["in-progress", "todo"] }).map( (t) => t.path, ), - ["tasks/a.md", "tasks/b.md"], + ["todo/a.md", "todo/b.md"], ); assert.deepEqual( filterTasks(tasks, { statuses: ["completed"] }).map((t) => t.path), - ["tasks/c.md"], + ["todo/c.md"], ); }); @@ -882,15 +882,15 @@ status: "todo", fields: { tags: ["onboarding", "first-sitting"], priority: "high" }, }); - assert.equal(created.path, "tasks/follow-up-with-andy.md"); + assert.equal(created.path, "todo/follow-up-with-andy.md"); assert.match(created.content, /^tags: \[onboarding, first-sitting\]$/m); assert.match(created.content, /^priority: high$/m); }); test("parseTask reads depends-on and depends_on frontmatter", () => { const card = parseTask( - "tasks/onboarding-telemetry.md", - "---\nstatus: todo\ntags: [onboarding]\ndepends-on: [tasks/onboarding-website.md, tasks/onboarding-look.md]\n---\n\n# Telemetry\n", + "todo/onboarding-telemetry.md", + "---\nstatus: todo\ntags: [onboarding]\ndepends-on: [todo/onboarding-website.md, todo/onboarding-look.md]\n---\n\n# Telemetry\n", ); - assert.deepEqual(card.dependsOn, ["tasks/onboarding-website.md", "tasks/onboarding-look.md"]); + assert.deepEqual(card.dependsOn, ["todo/onboarding-website.md", "todo/onboarding-look.md"]); });
A tsconfig.json
@@ -0,0 +1,4 @@ +{ + "extends": "../tsconfig.base.json", + "include": ["**/*.ts"] +}