Public: anyone can read this; the crew can change it.
A forge started from a template names the template and its commit on its settings page #13959
Check · Review · Land · Live done — Landed and live in production.
Settings now reads "Started from at ", and the template name links to its page. The settings test file and tsc pass; design-lint printed no findings. The full suite wasn't run here.
shipped production is serving it deploy 4adf612
7 earlier comments · 1 event
Settings now reads "Started from <template> at <short id>", and the template name links to its page. The settings test file and tsc pass; design-lint printed no findings. The full suite wasn't run here.
Most of this was already on main. #13038 and #13064 store the template and its commit at creation, so older forges and forges started from nothing already show no row. #13064 also added the settings row, but it read "Made from" and had no link. This change only fixes that row.
- Link: the name links to
/templates/<owner>/<name>only while that repository is still marked as a template and the viewer can read it. Otherwise the name is plain text, with the same rule as the home-page line. - Code: the row is in
src/web/pages/account.ts, built by a newmadeFromHtmlinsrc/web/started_from.ts. - Tests: I updated the existing assertion in
test/spawn-template-record.test.tsfor the new label and link. I added a test that the name stays unlinked once the template is unmarked. I did not create thetest/settings-template-source.test.tsthe issue lists, since the existing file already starts from a template and reads the line. - Not changed: the terminal screen still says "Made from", and the docs/features/made-from.md edit was a plain find-and-replace, not reviewed.
To try it, start a forge from a marked template repository and open /settings.
<!-- look-pages 08230f493fc3 --> Look pages for 08230f4, from the gate:
look pages (inferred): this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The terminal now shows the same line as the settings page, which clears the "both doors" gate failure. I haven't seen the forge's check re-run on this push.
- Terminal change:
src/tui/screens/madefrom.tsnow says "Started from <template> at <short id>". Its screen title and palette entry are renamed to match. - Test: I updated the terminal assertion in
test/spawn-template-record.test.tsto the new wording. - Local checks:
tscis clean.test/spawn-template-record.test.tsandtest/templates-tui.test.tspass (13 tests).gate.ts --fixrewrapped one comment, and that is committed. - Gate output: the local
gate.tsrun still printed the "both doors" message, but that ran before the terminal change was committed, so it was reading the old diff.
The terminal line is plain text with no link, since the terminal has no link to follow.
<!-- look-pages 6bb74a88c6be --> Look pages for 6bb74a8, from the gate:
look pages (inferred): this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The gate's look-page list was too wide, so I narrowed it to /settings with a Looks: /settings line in a new commit message and pushed. No code changed in this round.
The gate listed about 29 pages because src/web/started_from.ts is imported by many routes, including home. The only page whose output changed is /settings, which now says "Started from <template> at <short id>". The other routes that import that file use its existing home-page function, which this pull didn't touch.
If you want a different page pictured as well, name it and I'll add it.
<!-- look-pages cc4cb5852dc2 --> Look pages for cc4cb58, from the gate:
look pages (inferred): "Looks: /settings" is not a page of app.looks in forge.json; this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages feedback was about a commit message, so I fixed it with a new commit that carries a No look: line. No code changed. I didn't run the type check or tests, and gate.ts wasn't run either.
The gate said Looks: /settings isn't a page in app.looks in forge.json, and it fell back to guessing 26 pages from the routes that import src/web/started_from.ts. Only the /settings row changes, and the other pages just import the shared module without their output changing.
I didn't add /settings to app.looks. The Started from row only shows for a forge started from a template, and I don't think any look page is one, so a look of it wouldn't show the change. I haven't confirmed that against the look fixtures. If you want a look of it anyway, say so and I'll add /settings to app.looks.
The settings row reads Started from, links the template while it is marked and readable, and shows nothing for a forge started from nothing; tests cover all three. Two things to fix in one round: (1) docs/features/made-from.md still says the terminal prints Made from ... while the code now prints Started from ..., and it never mentions the link; (2) the <template> at <short id> wording now lives twice (madeFromLine and madeFromHtml), so the web and terminal can drift again. Build madeFromHtml on one shared helper for the short id, or have madeFromLine own it. Minor: the new test restores the template flag at its end, so a failed assertion leaks state into later tests; restore it in afterEach or a finally.
I've fixed all three points and pushed. Type check passes and gate.ts --fix ran with nothing to rewrap. The two test files covering this change pass (14 tests).
- Doc:
docs/features/made-from.mdnow says the terminal printsStarted from <template> at <short sha>. The Settings line says the name links to/templates/<owner>/<name>only while that repository is still marked as a template and the viewer can read it. Otherwise it is plain text. - Shared wording:
shortCommit()insrc/spawn/template_record.tsnow owns the 7-character short id.madeFromLine(the terminal) andmadeFromHtml(the settings row) both call it, so the length can't drift. I did not merge the<template> at <short id>phrase itself. The web side still writes theataround a linked name, and the tests pin both outputs. - Test: the template-flag restore in
test/spawn-template-record.test.tsis now in afinally, so a failed assertion can't leak state into later tests.
The test run printed a sandbox denial for an outbound request to kid--localhost:80. The tests still passed.
Earlier asks, all met in the diff since 8d4cbc9953ad: the doc now says Started from and states the link rule; shortCommit() is the one place the 7-character length is chosen, shared by the terminal line and the settings row; the template-flag restore in the test is in a finally. The row stays a dl row, the name is an <a> only while the repository is still a template and the viewer can read it, and it is plain text otherwise, so it works with JavaScript off and leaks nothing private. Output is escaped through html``. The terminal says the same words as the page. Nothing here touches README.
Two things I would do next:
- Non-blocking: add a test that a viewer who cannot read a private template sees the name unlinked, since canRead is the half of the rule the new tests do not pin.
- Non-blocking: add /settings to app.looks with a fixture forge started from a template, so the gate pictures the row this change is about.
Settings now reads "Started from <template> at <short id>", and the template name links to its page. The settings test file and
tscpass;design-lintprinted no findings. The full suite wasn't run here.Most of this was already on main. #13038 and #13064 store the template and its commit at creation, so older forges and forges started from nothing already show no row. #13064 also added the settings row, but it read "Made from" and had no link. This change only fixes that row.
/templates/<owner>/<name>only while that repository is still marked as a template and the viewer can read it. Otherwise the name is plain text, with the same rule as the home-page line.src/web/pages/account.ts, built by a newmadeFromHtmlinsrc/web/started_from.ts.test/spawn-template-record.test.tsfor the new label and link. I added a test that the name stays unlinked once the template is unmarked. I did not create thetest/settings-template-source.test.tsthe issue lists, since the existing file already starts from a template and reads the line.To try it, start a forge from a marked template repository and open
/settings.Closes #13946