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

The templates page says what to do when there are none #14877

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

/templates now says what to do when no repository is marked as a template. An admin sees a link reading "Mark a repository as a template". Everyone else, signed out or not, sees "No templates yet".

Notes

shipped production is serving it deploy 5b5da4d

opened this

/templates now says what to do when no repository is marked as a template. An admin sees a link reading "Mark a repository as a template". Everyone else, signed out or not, sees "No templates yet". The new test file and the neighbouring template tests pass (23 tests), and tsc, design-lint and gate are clean.

This wasn't already on main. The page had no wording for this case.

The built-in templates (Blank, Starter app) always exist, so the list is never literally empty. I read "empty" as "no repository is marked as a template" and put the line under the built-ins. It is a plain <p> below the list, so nothing shifts and there is no error text. It does not appear while a ?q= filter is active, because the existing "No template matches that name." line covers that.

The admin link goes to /repos, followed by "repository settings, App card". I picked /repos as the nearest page that lists repositories; there is no page that marks a repository as a template.

The change is in src/web/pages/templates.ts, with tests in test/templates-empty.test.ts for the admin view, everyone else, and the filtered view. The pre-push hook wanted a "Try:" commit message, so I added an empty commit carrying it.

[
  {"go": "/templates (signed in as an admin, no template repository)", "look": "below the Blank and Starter rows", "expect": "link 'Mark a repository as a template' to /repos, no error text, nothing shifts"},
  {"go": "/templates (signed out or as a non-admin)", "look": "below the rows", "expect": "the line 'No templates yet' and no link"},
  {"go": "/templates?q=zzzz", "look": "the page body", "expect": "only 'No template matches that name.'; the empty-state line is absent"}
]

Closes #14865

2 earlier comments
commented

/templates now says what to do when no repository is marked as a template. An admin sees a link reading "Mark a repository as a template". Everyone else, signed out or not, sees "No templates yet". The new test file and the neighbouring template tests pass (23 tests), and tsc, design-lint and gate are clean.

This wasn't already on main. The page had no wording for this case.

The built-in templates (Blank, Starter app) always exist, so the list is never literally empty. I read "empty" as "no repository is marked as a template" and put the line under the built-ins. It is a plain <p> below the list, so nothing shifts and there is no error text. It does not appear while a ?q= filter is active, because the existing "No template matches that name." line covers that.

The admin link goes to /repos, followed by "repository settings, App card". I picked /repos as the nearest page that lists repositories; there is no page that marks a repository as a template.

The change is in src/web/pages/templates.ts, with tests in test/templates-empty.test.ts for the admin view, everyone else, and the filtered view. The pre-push hook wanted a "Try:" commit message, so I added an empty commit carrying it.

[
  {"go": "/templates (signed in as an admin, no template repository)", "look": "below the Blank and Starter rows", "expect": "link 'Mark a repository as a template' to /repos, no error text, nothing shifts"},
  {"go": "/templates (signed out or as a non-admin)", "look": "below the rows", "expect": "the line 'No templates yet' and no link"},
  {"go": "/templates?q=zzzz", "look": "the page body", "expect": "only 'No template matches that name.'; the empty-state line is absent"}
]
commented

<!-- look-pages d8968d3f1145 --> Look pages for d8968d3, from the gate:

  • look pages (none): this pull changes src/web/pages/templates.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The templates page now says what to do when no repository is a template, and the terminal shows the same line. I pushed after the failed "both doors" check; I haven't seen the forge's verdict on the new push. Locally, tsc passes, gate.ts reports nothing blocking, and the templates page, filter and terminal tests pass (25 tests).

The two built-in templates (Blank, Starter app) are always listed, so "empty" here means no repository marked as a template. A plain line under the list says what to do next:

  • Admin: "Mark a repository as a template", linking to /repos, followed by "repository settings, App card". I chose /repos as the nearest page that lists repositories; nothing marks a repository as a template from there.
  • Everyone else, signed out or not: "No templates yet", with no link and no error text.
  • With a ?q= filter active: the line is hidden, because "No template matches that name." already covers that case.

The change is in src/web/pages/templates.ts and the terminal screen src/tui/screens/templates.ts. The wording and the check for "no repository templates" now live in src/spawn/template_list.ts, so both doors read one source. The line is plain text under the list, so nothing shifts. I added a how-to at docs/features/templates-empty.md.

Tests are test/templates-empty.test.ts (admin view, everyone else, and the filtered view) and a case in test/templates-tui.test.ts for the terminal, per audience.

The gate asked for a few commit-message trailers, which I added, so some commits are empty:

  • a "Try:" line, which the pre-push hook required;
  • "No look:", because /templates is not in forge.json looks;
  • "Direction:", the "pipeline first" rule.

The gate also flags two helper functions in test/templates-tui.test.ts as near-duplicates of helpers in other test files. That is advisory, and I left it.

[
  {"go": "/templates (signed in as an admin, no template repository)", "look": "below the Blank and Starter rows", "expect": "link 'Mark a repository as a template' to /repos, no error text, nothing shifts"},
  {"go": "/templates (signed out or as a non-admin)", "look": "below the rows", "expect": "the line 'No templates yet' and no link"},
  {"go": "/templates?q=zzzz", "look": "the page body", "expect": "only 'No template matches that name.'; the empty-state line is absent"},
  {"go": "the terminal's /templates screen as an admin, then as a non-admin", "look": "under the list", "expect": "the same two lines as the page"}
]
Approved

Does what the issue asks, on page and terminal, from one source (template_list.ts), with tests for both audiences and a how-to in docs/features. The line is a plain p under the list, so no shift; hidden under ?q=. Two things I would do next: 1) the admin link goes to /repos, which does not mark anything; link to where the flag lives, or say in one sentence where it is, so the next step is one click. 2) the admin line reads as a fragment (link, then ': repository settings, App card.'); make it one plain sentence per docs/WRITING.md.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs