README: no recipe that returns year-long write tokens from a script; two ways to push that hand out no credential
jonas@nustom.com, 2026-11-26 15:20 UTC · d84e5eb2989855509c0bbc803213a196249dba7b · parent d68dff1
2 files changed
M README.md
@@ -25,7 +25,7 @@ `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"). +that is not public cannot be cloned this way yet (see "Push"). ``` <folder>/ @@ -61,27 +61,48 @@ ## Push -```sh -./tokens.sh <domain> +Plain `git push` to `git.<domain>` needs a credential for the repo, and there is no supported way +yet to give a laptop one. Do not mint an Artifacts token for it in a script: what a script answers +is kept on the mind's log, so a token that a script returns is written down where every agent and +member of the mind reads it, for as long as the token lives. + +If you made tokens with the recipe that stood here before (a year's write tokens, one for each +repo, returned by a script): each still pushes to its repo until it ends, and its text is in the +answer of that script on the mind's log. Cloudflare's Artifacts binding can list and revoke a +repo's tokens (`listTokens`, `revokeToken`), but `itx.cfArtifacts` does not pass those two on +yet. Until it does, treat those tokens as live, and remove them from the laptop's keychain when +you stop using them. + +Until git has a sign-in of its own, a change reaches the mind in one of these ways. Neither hands +anyone a credential. + +**Commit through the mind.** A member's script commits whole files on the tip, with the `run` +tool of the mind's MCP server or with `iterate itx run --mind <domain> --file commit.js`: + +```js +const repo = itx.repos.get("/repos/config"); +const tip = await repo.tip(); +const { commitOid } = await repo.commitFiles({ + message: "Say what changed, and why", + parent: tip, // refused when main moved since you read it + changes: [{ path: "homepage.ts", content: "<the whole new text of the file>" }], +}); +return commitOid; ``` -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 file that goes away is `{ path, delete: true }`. Run `./check.sh` first: the commit publishes +the mind a few seconds later. -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. +**Let the repo pull.** Push your commits to a git host that the mind can read, then have the +mind's repo pull that address's `main`. That `main` must hold the repo's own newest commit (a +fast-forward): when the mind's repo got a commit since you cloned, merge it first, or the pull is +refused. The answer says what it did (`status`): ```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"); +return await itx.repos.get("/repos/config").pull({ remote: "https://<a git host>/<your repo>" }); ``` -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`. +**Not yet: plain git with the mind's sign-in.** The kernel has `npx iterate git setup git.<domain>` +(a credential helper that lends git the CLI's sign-in, so that `git clone` of a repo that is not +public and `git push` work with no token to paste). It is not in a released `iterate` CLI, and the +git app does not read that sign-in yet. This section says so when it does.
D tokens.sh
@@ -1,33 +0,0 @@ -#!/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