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

Admins mark which repositories are offered as templates for new forges #7536

open not picked up yet opened this
opened this

Part of the epic "Choose the template when making a new forge". Optional; waits for the birth child, so a repo-backed template can be copied.

Today only built-in templates exist. Let a site admin offer any repo on this forge, so the list grows without a release.

Build

  • src/core/forge_templates.ts (new): a table of offered repos (repo_id, title, says, marked_by, marked_at) with a migration, listOffered, offer, withdraw. Admin only. Only a repo the admin can read and whose tip declares an app (parseManifest, as in first-boot.ts).
  • src/spawn/templates.ts includes offered repos as source: "repo", ids repo:<owner>/<name>; a repo made private or deleted after being offered drops out of the list and a spawn naming it is a 422.
  • POST /api/v1/forge-templates {repo, title, says} and DELETE /api/v1/forge-templates/:id, plus MCP offer_template / withdraw_template (admin, rw); put the routes in src/http/api/forge_templates.ts (new), not in api.ts.
  • A small admin control on the repo's settings page lives in src/web/pages/forge-template-setting.ts (new); call it from settings in one line, do not grow repo.ts.
  • Birth (previous child) copies the repo's tracked files at its default-branch tip and records {id, repo, tip}.

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

  • [ ] An admin marks a repo; GET /api/v1/forges/templates and the New forge picker list it with its sentence.
  • [ ] A forge made with it has that repo's files at the tip recorded in parent.json.
  • [ ] A non-admin gets 403; marking a repo with no app manifest is a 422.
  • [ ] A withdrawn, privatised or deleted repo leaves the list, and a spawn naming it is a 422.

Named tests (new test/forge-templates.test.ts): only an admin offers a template, a repo without an app manifest is refused, an offered repo appears in the list and the picker, a forge made from an offered repo has its files at the tip, a withdrawn or private repo drops out.

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs