iterate deploy --repos-from: where a new mind's repos are cloned from, or none
Misha Kaletsky, 2026-11-24 18:20 UTC · 4628e09caa41a05fb07aebb8effc7ed422f6d6ee · parent 49e5ea8
3 files changed
M core/lib/src/cli/cli.ts
@@ -253,6 +253,12 @@ .describe( "Forward each mail to the mind there as it arrived, a verified destination address of the account's Email Routing; none stops it (default: none; for a mind that is there already: the one it has)", ), + reposFrom: z + .string() + .optional() + .describe( + "Where a new mind's repos are cloned from: the address under which a mind serves its repos (https://git.<its domain>/repos); none starts the mind with empty repos, which get their code by pushes (default: iterate's own repos; a mind that is there already keeps the repos it has)", + ), traceSampling: z .string() .optional()
M core/lib/src/cli/deploy.test.ts
@@ -148,6 +148,17 @@ expect(() => deployConfigOf({ ...answers, owner: undefined })).toThrow(/is an email address/); }); +test("a new mind's repos are cloned from the address that --repos-from names, or start empty with none; anything else is refused", () => { + const reposOf = (reposFrom: string) => deployConfigOf({ ...answers, reposFrom }).repos; + expect(reposOf("https://git.ada-labs.com/repos/")).toContainEqual({ + path: "/repos/stdlib", + origin: "https://git.ada-labs.com/repos/stdlib", + }); + // the mind that hosts the source has nowhere to clone from: its repos get their code by pushes + expect(reposOf("none")).toContainEqual({ path: "/repos/stdlib", origin: null }); + expect(() => reposOf("somewhere")).toThrow("--repos-from somewhere is no address"); +}); + const deployed = { stageName: "ada", mindId: "cd".repeat(32),
M core/lib/src/cli/deploy.ts
@@ -83,6 +83,8 @@ mailForwardTo?: string; /** the share of requests whose trace is kept, 0 to 1; `default` is every one (`deployConfigOf`) */ traceSampling?: string; + /** where a new mind's repos are cloned from; `none` starts them empty (`deployConfigOf`) */ + reposFrom?: string; yes?: boolean; buy?: boolean; eraseRecords?: boolean; @@ -152,12 +154,21 @@ * serves each of its public repos to anyone at `https://git.<its domain>/repos/<name>`. */ const SOURCE_OF_REPOS = "https://git.mindlew.com/repos"; -/** THE REPOS A NEW MIND IS BORN WITH, each cloned from iterate's own: the wiring that is the - * mind's code (`config`), the code it imports (`stdlib` and the apps), and `kernel` and `home` - * to read. A mind that is there keeps the list it was deployed with. */ -const STARTING_REPOS = ["home", "kernel", "stdlib", "dash", "tasks", "git", "config"].map( - (name) => ({ path: `/repos/${name}`, origin: `${SOURCE_OF_REPOS}/${name}` }), -); +/** THE REPOS A NEW MIND IS BORN WITH: the wiring that is the mind's code (`config`), the code it + * imports (`stdlib` and the apps), and `kernel` and `home` to read. Each is cloned from + * `reposFrom`, the address under which a mind serves its repos. `none` gives each no origin: + * the mind starts with empty repos, which get their code by pushes. That is how the mind that + * hosts iterate's own source began, since it had nowhere to clone from. */ +function startingRepos(reposFrom: string) { + if (reposFrom !== "none" && !z.url().safeParse(reposFrom).success) + throw new Error( + `--repos-from ${reposFrom} is no address: give the one under which a mind serves its repos (https://git.<its domain>/repos), or none.`, + ); + return ["home", "kernel", "stdlib", "dash", "tasks", "git", "config"].map((name) => ({ + path: `/repos/${name}`, + origin: reposFrom === "none" ? null : `${reposFrom.replace(/\/$/, "")}/${name}`, + })); +} const STARTING_ENTRY = { repo: "/repos/config", module: "worker.ts" }; export function deployConfigOf(answers: { @@ -169,6 +180,7 @@ egressGateway?: string; mailForwardTo?: string; traceSampling?: string; + reposFrom?: string; deployed?: DeployedMind; }) { const { deployed } = answers; @@ -233,7 +245,8 @@ mindId: deployed?.mindId, controlPlaneHostname, ownerEmails, - repos: kept?.repos || STARTING_REPOS, + // a mind that is there keeps the repos it was deployed with: after birth they move by git + repos: kept?.repos || startingRepos(answers.reposFrom || SOURCE_OF_REPOS), entry: kept?.entry || STARTING_ENTRY, topology: deployed?.topology || ("full-cloudflare" as const), alchemy: { ...kept?.alchemy, stageName: deployed?.stageName || stageNameOf(answers.domain) }, @@ -2113,6 +2126,7 @@ egressGateway: input.egressGateway, mailForwardTo: input.mailForwardTo, traceSampling: input.traceSampling, + reposFrom: input.reposFrom, deployed: mind, }); const { controlPlaneHostname } = config;