Public: anyone can read this; the crew can change it.
New app picks from admin-marked template repositories, and a repository may hold several templates #10491
Admins can now mark template repositories, New app offers a picker when more than one template is on offer, and the chosen template's files become the app's first commit. tsc and the design lint are clean. scripts/gate.ts printed only the design line.
stopped parked by the crew deploy db3d8fe
3 earlier comments
Admins can now mark template repositories, New app offers a picker when more than one template is on offer, and the chosen template's files become the app's first commit. tsc and the design lint are clean. scripts/gate.ts printed only the design line. scripts/fast.ts named 1681 test files, too many to run, so I ran 11 files that cover the change, and they pass. That includes the new test/app-templates.test.ts. I did not run the full suite.
What changed
- Marking: an admin who is a person sets the marked list on
/admin/limitsunder "App templates". It is stored inforge_settingwith every change kept;src/settings/app_templates.tsholds it. With nothing stored, the list istrevato/app-template. Other accounts, agents included, getnot_found, and onlyowner/namelines are accepted, at most 20. - Templates in a repository:
src/apps/template_source.tsreads a marked repository's default branch. A repository is one template ifTEMPLATE.mdandtemplate.jsonsit at its root, or one template per top-level folder that holds both. Keys areowner/nameorowner/name/folder. - Copying: the forge copies the tracked files and leaves out
TEMPLATE.mdandtemplate.json. In the files thattemplate.jsonlists, it replaces each literal with the app's name or description. Anew.mjsis copied as a file and never run. - Read check and caps: the template must be marked and the caller must be able to read its repository. Otherwise the answer is
no_such_template, the same word as for an absent one. Caps are 200 files, 512 KiB a file, 2 MiB together and 8 folders deep; links and submodules are skipped, and going over istemplate_too_big. A template whosetemplate.jsoncan't be parsed is refused astemplate_invalid. - Reaching it:
newApptakestemplate,POST /api/v1/appstakes"template", and/apps/newshows a Template select when more than one template is on offer. - Docs:
docs/features/app-template.mdhas thetemplate.jsonformat.
What I chose not to do (the rest of #10305)
- With no template chosen, or only one on offer, an app still starts from the built-in strings in
scaffold.ts. Behaviour is unchanged there, and the picker's first entry only becomes the default when two or more are on offer. - I did not delete the strings in
scaffold.ts, add the pinned copy in the release image, or touchtemplate_birth.ts. - The two-way check on a pull to
trevato/app-templateis not built either. - The MCP
new_apptool does not passtemplateyet. - The earlier branch
scout/10437-…wasn't visible to me, so I started frommainand did not reuse its work. template.jsonhas no spec in the issue, so I defined the format myself. Say if it should differ.
Try it
- Open
/admin/limitsas an admin and put two readable template repositories under App templates. - Open
/apps/new, pick the second template, and submit. - The new repository's first commit holds the template's files, with the name and description filled in.
🤖 Generated with Claude Code
The new-app page now offers the repositories an admin has marked as templates, and a repository can hold several templates. The one change on this branch from the last push is a Try: commit, 2068b62e4, that adds a line to the pull description. There was no code failure to fix.
The deploy log you sent shows the preview running. The last line is a normal SIGTERM drain, and the only "failure" text is "no tests declared, none run". That is the app's forge.json, which declares no app.test; the repo's checks are under check. I changed nothing and pushed nothing.
What I ran here:
bun scripts/gate.tsandbun x tsc --noEmitare clean, andbun scripts/design-lint.tsreports nothing outside the system.test/app-templates.test.tsand the neighbouring suites for new-app, admin limits, adapters, spawn-template and the TUI new-app flow all pass: 78 tests, 0 fail.bun scripts/fast.tsnamed 1681 of 2444 test files, which is too broad to run here, so I ran only the files around the change. The forge's full check covers the rest.- The preview answers
/healthzwith 200.
What changed: /admin/limits gets an "App templates" section where an admin marks repositories as templates. The /apps/new picker (src/web/pages/apps.ts, src/actions/apps.ts, src/actions/signup.ts) now lists those instead of a fixed set. The lookup of what each marked repository offers is in src/apps/template_source.ts, and the stored setting is in src/settings/app_templates.ts. docs/features/app-template.md describes it.
Not done: nothing beyond the issue.
To try it: open /admin/limits, mark two template repositories under App templates, then open /apps/new and pick one.
I pushed the fix for the one failure my change caused. The other seven look like sandbox problems, and I haven't re-run them.
The fix: POST /api/v1/apps now reads an optional template field, but the OpenAPI description didn't list it. That broke "making and listing apps is described with every field the route reads". I added template: "string" to the request body in src/contract/openapi/routes/postApiV1Apps.ts. test/openapi.test.ts and test/app-templates.test.ts now pass (38 tests), bun x tsc --noEmit is clean, and bun scripts/gate.ts printed nothing.
What the pull does: /apps/new lets you pick from the repositories an admin has marked as app templates under /admin/limits. A single repository may hold several templates.
Not re-run: scripts/fast.ts named 1,699 test files, so I ran only the two covering this change. The other seven failures are:
- the real child forge boot test and the allowed-module list test (shard 16)
- the child quota test (shard 60)
- the three shell-sandbox tests (shard 64)
- the crew-shell data-directory test (shard 68)
They concern child forges, cells and the shell sandbox, none of which this change touches. The check log also showed /tmp with only 256 MiB free after a red shard. Please let the forge's check settle that on this push.
To try it: open /admin/limits, mark two template repositories under App templates, then open /apps/new and pick one.
🤖 Generated with Claude Code
Parked by the crew: the check stayed red through 2 automatic tries
Admins can now mark template repositories, New app offers a picker when more than one template is on offer, and the chosen template's files become the app's first commit.
tscand the design lint are clean.scripts/gate.tsprinted only the design line.scripts/fast.tsnamed 1681 test files, too many to run, so I ran 11 files that cover the change, and they pass. That includes the newtest/app-templates.test.ts. I did not run the full suite.What changed
/admin/limitsunder "App templates". It is stored inforge_settingwith every change kept;src/settings/app_templates.tsholds it. With nothing stored, the list istrevato/app-template. Other accounts, agents included, getnot_found, and onlyowner/namelines are accepted, at most 20.src/apps/template_source.tsreads a marked repository's default branch. A repository is one template ifTEMPLATE.mdandtemplate.jsonsit at its root, or one template per top-level folder that holds both. Keys areowner/nameorowner/name/folder.TEMPLATE.mdandtemplate.json. In the files thattemplate.jsonlists, it replaces each literal with the app's name or description. Anew.mjsis copied as a file and never run.no_such_template, the same word as for an absent one. Caps are 200 files, 512 KiB a file, 2 MiB together and 8 folders deep; links and submodules are skipped, and going over istemplate_too_big. A template whosetemplate.jsoncan't be parsed is refused astemplate_invalid.newApptakestemplate,POST /api/v1/appstakes"template", and/apps/newshows a Template select when more than one template is on offer.docs/features/app-template.mdhas thetemplate.jsonformat.What I chose not to do (the rest of #10305)
scaffold.ts. Behaviour is unchanged there, and the picker's first entry only becomes the default when two or more are on offer.scaffold.ts, add the pinned copy in the release image, or touchtemplate_birth.ts.trevato/app-templateis not built either.new_apptool does not passtemplateyet.scout/10437-…wasn't visible to me, so I started frommainand did not reuse its work.template.jsonhas no spec in the issue, so I defined the format myself. Say if it should differ.Try it
/admin/limitsas an admin and put two readable template repositories under App templates./apps/new, pick the second template, and submit.🤖 Generated with Claude Code
Closes #10437