The board's files are in /repos/task-board, and a laptop's folder starts from this repo
Misha Kaletsky, 2026-11-25 21:48 UTC · df6c9dd3404021945ed6eb5f8fbd3705773534e6 · parent 9814333
11 files changed
- A .gitignore
- M AGENTS.md
- M README.md
- A check.sh
- A clone.sh
- M package.json
- A pnpm-lock.yaml
- M tests/worker.test.mjs
- A tokens.sh
- M tsconfig.json
- M worker.ts
A .gitignore
@@ -0,0 +1,1 @@ +node_modules/
M AGENTS.md
@@ -14,7 +14,7 @@ | `/repos/dash` | the Dash, on `dash.<domain>`, for members | | `/repos/tasks` | the Tasks board, on `tasks.<domain>`, for members | | `/repos/git` | the git app: every repo as a git remote at `git.<domain>/repos/<name>` | -| `/repos/home` | the folder the repos are cloned into on a laptop. Its `todo/` holds the task files | +| `/repos/task-board` | the task files, under `todo/`, and nothing else. The mind makes it empty at its first publish | | `/repos/kernel` | the platform. Only a deploy changes what runs of it | ## Imports across repos @@ -57,17 +57,17 @@ `worker.ts` runs its `mind/worker-updated` case again. - A change across two repos is two pushes. When the code between them does not load, the mind keeps running the last set that did. -- A push to `/repos/home` publishes nothing: no code is loaded from it. +- A push to `/repos/task-board` publishes nothing: no code is loaded from it. - A push to `/repos/kernel` changes nothing until the stack is deployed again. - To go back, move a repo's `main` back. From inside the mind, commit with `repo.commitFiles({ message, parent: await repo.tip(), changes: [{ path, content }] })`, where `repo = itx.repos.get("/repos/<name>")`. Read a file with `await repo.readFile(path)`. From a -laptop, push to `https://git.<domain>/repos/<name>` (the README of `/repos/home` says how). +laptop, push to `https://git.<domain>/repos/<name>` (this repo's README says how). Nothing checks a push. Before you push, run the type-checker and the tests, or ask the person who -has the repos on a laptop to run them (the README of `/repos/home`). +has the repos on a laptop to run them (this repo's README). ## Proposing a change @@ -108,7 +108,7 @@ ## Tasks -A task is a markdown file under `todo/` of `/repos/home`. Its frontmatter holds `status`, `tags`, +A task is a markdown file under `todo/` of `/repos/task-board`. Its frontmatter holds `status`, `tags`, `size`, `priority`, `owner` and `agent`; its first heading is its title. The board on `tasks.<domain>` shows and moves them. To take or finish a task, commit its file.
M README.md
@@ -12,3 +12,76 @@ ```ts const git = gitApp({ icon, public: ["/repos/stdlib"] }); ``` + +## On a laptop + +The mind's repos sit side by side in one folder, each under its own name, as they do in the mind +(`/repos/<name>`). This repo is where that folder starts: + +```sh +git clone https://git.<domain>/repos/config <folder>/config +<folder>/config/clone.sh +``` + +`clone.sh` clones the kernel and each repo that `package.json` names, from beside this repo's +address, and installs them. Add the name of any other repo you want: `clone.sh task-board`. A repo +that is not public needs a token (see "Push"). + +``` +<folder>/ + config/ this repo + kernel/ the platform. Only a deploy changes what runs of it. + stdlib/ the agent, what worker.ts calls, and what every repo is checked and tested with + dash/ the Dash app + tasks/ the Tasks app + git/ the git app: it serves git.<domain> +``` + +How they link: + +- A file imports a file of another repo by the repo's name: + `import { init } from "@repos/stdlib/init.ts"`. The importing repo's `package.json` lists it, + `"@repos/stdlib": "../stdlib"`: the folder next door. So the folder names are part of the code. + Keep them. +- This repo's `package.json` lists every repo a mind is born with beside its kernel and its + config. +- `iterate/*` and `zod` come from the kernel. Worker code uses no npm package. +- Each repo stands alone once its neighbours are beside it: `pnpm install` in its folder links + them and brings its tools, and `pnpm typecheck` and `pnpm test` check it. + +## Check before you push + +Nothing checks a push. Run this first: + +```sh +./check.sh +``` + +It type-checks and tests this repo and each repo it imports from. + +## Push + +```sh +./tokens.sh <domain> +``` + +Then paste one line for each repo, `<name> <token>`, and press Ctrl-D. For each, the script sets +the repo's `origin` to `https://git.<domain>/repos/<name>` and stores the token as that repo's +password. A token is for one repo, so git is told to keep one password for each +(`credential.https://git.<domain>.useHttpPath true`). + +A member mints the tokens in the mind. Run this there, with the `run` tool of the mind's MCP +server or with `iterate itx run --mind <domain> --file mint.js`. Its answer is the lines to paste. + +```js +const lines = []; +for (const name of ["kernel", "stdlib", "dash", "tasks", "git", "config", "task-board"]) { + const repo = await itx.cfArtifacts.get(`/repos/${name}`); + const token = await repo.createToken("write", 365 * 24 * 60 * 60); + lines.push(`${name} ${token.plaintext}`); +} +return lines.join("\n"); +``` + +A token is a password: do not put it in a file of a repo. Anyone who holds one can push to that +repo, and force-push its `main`.
A check.sh
@@ -0,0 +1,21 @@ +#!/bin/sh +# check.sh — type-checks and tests this repo and each repo its code imports from, as they are in +# the folders beside it. Nothing checks a push, so run this before one: +# +# ./check.sh +# +# Each repo checks itself (`pnpm typecheck`, `pnpm test` in its folder); this runs them all, in +# the order package.json names them, and stops at the first that fails. +set -eu +cd "$(dirname "$0")" + +named=$(node -p 'Object.keys(require("./package.json").dependencies).filter((name) => name.startsWith("@repos/")).map((name) => name.slice("@repos/".length)).join(" ")') + +for name in $named; do + echo "== $name" + pnpm -C "../$name" typecheck + pnpm -C "../$name" test +done +echo "== this repo" +pnpm typecheck +pnpm test
A clone.sh
@@ -0,0 +1,32 @@ +#!/bin/sh +# clone.sh — the repos this config needs, cloned beside it and installed, so that a laptop holds +# them side by side as the mind does. +# +# git clone https://git.<domain>/repos/config <folder>/config +# <folder>/config/clone.sh +# +# Which repos: each one that package.json names as the folder next door +# ("@repos/stdlib": "../stdlib"), the kernel, whose SDK every repo is type-checked against, and +# any more that are named after the command (`clone.sh task-board`). Where from: beside the +# address this repo was cloned from. A mind is born the same way, from the same list. +# +# Then it installs: the kernel's own packages, and in each other repo its tools and the links to +# its neighbours. A repo that is here already is left as it is, and installed again. +set -eu +cd "$(dirname "$0")" + +origin=$(git remote get-url origin) +base="${origin%/*}" +named=$(node -p 'Object.keys(require("./package.json").dependencies).filter((name) => name.startsWith("@repos/")).map((name) => name.slice("@repos/".length)).join(" ")') + +for name in kernel $named "$@"; do + if [ -d "../$name/.git" ]; then + echo "$name: here already" + else + git clone "$base/$name" "../$name" + fi +done + +pnpm -C ../kernel install +for name in $named; do pnpm -C "../$name" install; done +pnpm install
M package.json
@@ -3,10 +3,20 @@ "private": true, "type": "module", "main": "worker.ts", + "scripts": { + "typecheck": "tsc -p .", + "test": "node --test tests/*.test.mjs" + }, "dependencies": { "@repos/dash": "../dash", "@repos/git": "../git", "@repos/stdlib": "../stdlib", "@repos/tasks": "../tasks" + }, + "devDependencies": { + "@cloudflare/workers-types": "^5.20261103.1", + "iterate": "link:../kernel/core/lib", + "typescript": "^7.0.2", + "zod": "4.6.5" } }
A pnpm-lock.yaml
@@ -0,0 +1,257 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@repos/dash': + specifier: ../dash + version: link:../dash + '@repos/git': + specifier: ../git + version: link:../git + '@repos/stdlib': + specifier: ../stdlib + version: link:../stdlib + '@repos/tasks': + specifier: ../tasks + version: link:../tasks + devDependencies: + '@cloudflare/workers-types': + specifier: ^5.20261103.1 + version: 5.20261124.2 + iterate: + specifier: link:../kernel/core/lib + version: link:../kernel/core/lib + typescript: + specifier: ^7.0.2 + version: 7.0.2 + zod: + specifier: 4.6.5 + version: 4.6.5 + +packages: + + '@cloudflare/workers-types@5.20261124.2': + resolution: {integrity: sha512-zgpqEeenF5zm6Riayxxt5GQZUPGGxw6OgDEVISnFoojBx/13wR0F14/SXiQpH+vsSlp+sT5jgMgF+7Kfsm253w==} + + '@typescript/typescript-aix-ppc64@7.0.2': + resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==} + engines: {node: '>=16.20.0'} + cpu: [ppc64] + os: [aix] + + '@typescript/typescript-darwin-arm64@7.0.2': + resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [darwin] + + '@typescript/typescript-darwin-x64@7.0.2': + resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [darwin] + + '@typescript/typescript-freebsd-arm64@7.0.2': + resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [freebsd] + + '@typescript/typescript-freebsd-x64@7.0.2': + resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [freebsd] + + '@typescript/typescript-linux-arm64@7.0.2': + resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [linux] + + '@typescript/typescript-linux-arm@7.0.2': + resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==} + engines: {node: '>=16.20.0'} + cpu: [arm] + os: [linux] + + '@typescript/typescript-linux-loong64@7.0.2': + resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==} + engines: {node: '>=16.20.0'} + cpu: [loong64] + os: [linux] + + '@typescript/typescript-linux-mips64el@7.0.2': + resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==} + engines: {node: '>=16.20.0'} + cpu: [mips64el] + os: [linux] + + '@typescript/typescript-linux-ppc64@7.0.2': + resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==} + engines: {node: '>=16.20.0'} + cpu: [ppc64] + os: [linux] + + '@typescript/typescript-linux-riscv64@7.0.2': + resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==} + engines: {node: '>=16.20.0'} + cpu: [riscv64] + os: [linux] + + '@typescript/typescript-linux-s390x@7.0.2': + resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==} + engines: {node: '>=16.20.0'} + cpu: [s390x] + os: [linux] + + '@typescript/typescript-linux-x64@7.0.2': + resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [linux] + + '@typescript/typescript-netbsd-arm64@7.0.2': + resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [netbsd] + + '@typescript/typescript-netbsd-x64@7.0.2': + resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [netbsd] + + '@typescript/typescript-openbsd-arm64@7.0.2': + resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [openbsd] + + '@typescript/typescript-openbsd-x64@7.0.2': + resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [openbsd] + + '@typescript/typescript-sunos-x64@7.0.2': + resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [sunos] + + '@typescript/typescript-win32-arm64@7.0.2': + resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [win32] + + '@typescript/typescript-win32-x64@7.0.2': + resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [win32] + + typescript@7.0.2: + resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} + engines: {node: '>=16.20.0'} + hasBin: true + + zod@4.6.5: + resolution: {integrity: sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==} + +snapshots: + + '@cloudflare/workers-types@5.20261124.2': {} + + '@typescript/typescript-aix-ppc64@7.0.2': + optional: true + + '@typescript/typescript-darwin-arm64@7.0.2': + optional: true + + '@typescript/typescript-darwin-x64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-x64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm@7.0.2': + optional: true + + '@typescript/typescript-linux-loong64@7.0.2': + optional: true + + '@typescript/typescript-linux-mips64el@7.0.2': + optional: true + + '@typescript/typescript-linux-ppc64@7.0.2': + optional: true + + '@typescript/typescript-linux-riscv64@7.0.2': + optional: true + + '@typescript/typescript-linux-s390x@7.0.2': + optional: true + + '@typescript/typescript-linux-x64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-sunos-x64@7.0.2': + optional: true + + '@typescript/typescript-win32-arm64@7.0.2': + optional: true + + '@typescript/typescript-win32-x64@7.0.2': + optional: true + + typescript@7.0.2: + optionalDependencies: + '@typescript/typescript-aix-ppc64': 7.0.2 + '@typescript/typescript-darwin-arm64': 7.0.2 + '@typescript/typescript-darwin-x64': 7.0.2 + '@typescript/typescript-freebsd-arm64': 7.0.2 + '@typescript/typescript-freebsd-x64': 7.0.2 + '@typescript/typescript-linux-arm': 7.0.2 + '@typescript/typescript-linux-arm64': 7.0.2 + '@typescript/typescript-linux-loong64': 7.0.2 + '@typescript/typescript-linux-mips64el': 7.0.2 + '@typescript/typescript-linux-ppc64': 7.0.2 + '@typescript/typescript-linux-riscv64': 7.0.2 + '@typescript/typescript-linux-s390x': 7.0.2 + '@typescript/typescript-linux-x64': 7.0.2 + '@typescript/typescript-netbsd-arm64': 7.0.2 + '@typescript/typescript-netbsd-x64': 7.0.2 + '@typescript/typescript-openbsd-arm64': 7.0.2 + '@typescript/typescript-openbsd-x64': 7.0.2 + '@typescript/typescript-sunos-x64': 7.0.2 + '@typescript/typescript-win32-arm64': 7.0.2 + '@typescript/typescript-win32-x64': 7.0.2 + + zod@4.6.5: {}
M tests/worker.test.mjs
@@ -1,8 +1,8 @@ // tests/worker.test.mjs — the mind's wiring (../worker.ts): which hostname goes where and who is // let in, what a mail and a publish do. The class is the real one, loaded as the mind loads it -// (../../mind-loader.mjs), with a fake `itx` that records what it is asked. +// (testing/mind-loader.mjs of /repos/stdlib), with a fake `itx` that records what it is asked. // Run it from the repo's root with `node --test "tests/*.test.mjs"`. -import "../../mind-loader.mjs"; +import "@repos/stdlib/testing/mind-loader.mjs"; import assert from "node:assert/strict"; import { existsSync, readFileSync } from "node:fs"; import { test } from "node:test"; @@ -40,11 +40,11 @@ ); }); -test("tasks.<domain> tells its page which repo the board shows: /repos/home", async () => { +test("tasks.<domain> tells its page which repo the board shows: /repos/task-board", async () => { const mind = mindAt("example.com"); mind.config.auth = { ...mind.config.auth, require: () => null }; const board = await mind.config.fetch(new Request("https://tasks.example.com/board.json")); - assert.deepEqual(await board.json(), { repo: "/repos/home" }); + assert.deepEqual(await board.json(), { repo: "/repos/task-board" }); }); test("git.<domain> is the git app's, with no guard before it: it serves its own files to anyone, and no repo, since none is public", async () => { @@ -149,7 +149,7 @@ // the Dash reads the file from /repos/config by this path assert.equal(existsSync(repoFile(kinds.agent)), true); // a mind born from this config has no such repo yet: it is made empty, and making it again is nothing - assert.deepEqual(mind.made, ["/repos/home"]); + assert.deepEqual(mind.made, ["/repos/task-board"]); }); test("an event that is no case's still reaches the hooks that look at every event", async () => {
A tokens.sh
@@ -0,0 +1,33 @@ +#!/bin/sh +# tokens.sh — gives git a push token for repos of this mind, and points each at the mind's git app. +# +# ./tokens.sh <domain> +# +# Then paste one line for each repo, its name, a space and its token, and press Ctrl-D. The +# README says how a member mints the tokens. +# +# For each line it does three things: +# - the repo's remote `origin` becomes https://git.<domain>/repos/<name>. The repo is the folder +# of that name beside this one. +# - git is told to keep a password for each repo's address, not one for the whole host: a token +# is for one repo, and git would send the first repo's token for every other. +# - the token goes to git's credential helper (on a Mac, the keychain) as that repo's password. +set -eu + +domain="${1:?give the domain of the mind, such as example.org}" +cd "$(dirname "$0")/.." +host="git.$domain" + +git config --global "credential.https://$host.useHttpPath" true + +while read -r name token; do + url="https://$host/repos/$name" + if git -C "$name" remote get-url origin >/dev/null 2>&1; then + git -C "$name" remote set-url origin "$url" + else + git -C "$name" remote add origin "$url" + fi + printf 'protocol=https\nhost=%s\npath=repos/%s\nusername=x\npassword=%s\n\n' \ + "$host" "$name" "$token" | git credential approve + echo "$name: origin is $url, token kept" +done
M tsconfig.json
@@ -1,4 +1,4 @@ { - "extends": "../tsconfig.base.json", + "extends": "@repos/stdlib/tsconfig.base.json", "include": ["**/*.ts"] }
M worker.ts
@@ -30,9 +30,10 @@ const icon = () => mindIcon(profileFiles); const dash = dashApp({ icon }); -// The Tasks board shows the markdown files under todo/ of this repo. No code is loaded from -// it, so package.json does not list it: the publish hook below makes it. -const TASKS_REPO = "/repos/home"; +// The Tasks board shows the markdown files under todo/ of this repo, which holds nothing else. +// No code is loaded from it, so package.json does not list it and it is cloned from nowhere: +// the publish hook below makes it, empty, and the board's first task is its first commit. +const TASKS_REPO = "/repos/task-board"; const tasks = tasksApp({ repo: TASKS_REPO, icon }); // git.<domain>/repos/<name>, for git and for a browser. A repo listed in `public`, by its path // (`"/repos/stdlib"`), is for anyone to read and clone, with its pulls. None is listed: a new