Public: anyone can read this; the crew can change it.

A forge made with template X starts with X's files #7535

shipped production is serving it opened this has it
opened this

Part of the epic "Choose the template when making a new forge". Waits for the API child. Independent of the UI child.

Today the template choice is only recorded. Make the child actually begin from it.

Build

  • src/spawn/template_birth.ts (new): given the chosen template and the child, commit its files into a new private repo in the child's organisation, once, in the same style as startFresh (src/actions/spawn.ts:511): a retry finds the repo and leaves it.
  • blank: unchanged (no repo; the fresh sentence still works as today).
  • starter: the files scaffoldFiles returns, named for the spawner's fresh sentence if given, else app.
  • A template and a fresh sentence together: the sentence becomes the app's description on the template's files; no second repo.
  • A template is a copy of files at the moment of birth, one commit, no history and no upstream; parent.json records template: {id, repo?, tip?} so the child knows where it came from. firstBoot (src/spawn/first-boot.ts) already turns a repo whose tip declares an app into an app; nothing new there.
  • Nothing secret travels: only the template's tracked files, never its settings, secrets, issues or runs (the "never copied" rule in docs/SPAWN.md).
  • Call it from spawnForge in a few lines; do not grow src/actions/spawn.ts.

Where to put code: new files only (named below). Do not grow src/http/api.ts, src/web/pages/repo.ts or src/actions/spawn.ts beyond a call-site of a few lines; src/http/api/forges.ts, src/spawn/door.ts and src/web/pages/new-forge.ts may take small edits.

Done when

  • [x] A forge made with starter has a repo whose tree equals scaffoldFiles(...) for that name, and its first boot enables it as an app.
  • [x] A forge made with blank or no template has exactly the repos it has on main today.
  • [x] A retry of the same spawn makes no second repo and no second commit.
  • [x] parent.json records the template id.
  • [x] No parent secret, token or issue appears in the child's template repo.

Named tests (new test/spawn-template-birth.test.ts): a forge made with starter has the starter's files, a forge made with blank is unchanged, a retry makes no second template repo, parent.json records the template, the template repo holds no parent secrets, first boot enables the template app. Existing test/spawn.test.ts, test/spawn-first-boot.test.ts and test/spawn-fresh-forks.test.ts stay green.

commented

Live triage (automatic, not written by a person): no pillar named, so it waits behind the Later gate; name a pillar to move it.

commented

Reviewed pull #8925 at its head: ticked A forge made with starter has a repo whose tree equals scaffoldFiles(...) for that name, and its first boot enables it as an app.; A forge made with blank or no template has exactly the repos it has on main today.; A retry of the same spawn makes no second repo and no second commit.; parent.json records the template id.; No parent secret, token or issue appears in the child's template repo..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs