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

A template card lists the files it will create before it is chosen #16822

Merged opened this

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

Merged

Each template row on /templates now has a Files fold that lists its top-level files and folders. The lists are cut at 40 entries and then say "and N more". bun test on test/templates-page.test.ts and test/tui-app-templates.test.ts passes (20 tests).

Notes

opened this

Each template row on /templates now has a Files fold that lists its top-level files and folders. The lists are cut at 40 entries and then say "and N more". bun test on test/templates-page.test.ts and test/tui-app-templates.test.ts passes (20 tests). tsc and design-lint are clean, and gate --fix changed nothing. I didn't run the full suite or the gate.ts and fast.ts steps; the forge runs the whole check on this push.

The code to read this already existed in src/spawn/template_holds.ts: it reads the template's tree, caches by the default-branch tip, and /templates already used it. So I extended it rather than adding a module:

  • Limit: HOLDS_FILES_MAX goes from 12 to 40.
  • Fold: the Files row is now a <details data-files> fold in src/web/pages/templates.ts. Its summary reads "N entries" (or "1 entry"), and the names sit inside as <code>. Everything is server-rendered and escaped, so first paint needs no extra request.
  • Fold markup: I used a paragraph of <code> names rather than a <ul>, because design-lint flags bare lists on this page.
  • Terminal: the terminal's App templates screen still shows Files as one joined line, from the same data, so it now gets the 40 limit too.
  • Docs: docs/features/template-holds.md is updated.
  • Tests: two templates cover the list.
    • The starter shows its fold with forge.json inside.
    • A 45-entry repo shows the first 40, "and 5 more" and "45 entries", and f40.txt is absent.
    • A one-file repo shows "1 entry".
    • The existing 12-limit assertions are rewritten for 40.

Left out: a fold on the New forge picker, and a separate card module. The issue named src/web/template_card.ts, but the rows live in templates.ts.

Try it: open /templates and open the Files fold under a template.

[{"go":"/templates","look":"the Files row under Starter app and under any template repository","expect":"a collapsed fold reading 'N entries'; opening it lists the names in code type, and past 40 ends with 'and N more'"}]

The push first failed the pre-push hook because no commit said how to try the change. I added an empty Try: commit, and the push then went through.

🤖 Generated with Claude Code

Closes #16317

6 earlier comments
commented

Each template row on /templates now has a Files fold that lists its top-level files and folders. The lists are cut at 40 entries and then say "and N more". bun test on test/templates-page.test.ts and test/tui-app-templates.test.ts passes (20 tests). tsc and design-lint are clean, and gate --fix changed nothing. I didn't run the full suite or the gate.ts and fast.ts steps; the forge runs the whole check on this push.

The code to read this already existed in src/spawn/template_holds.ts: it reads the template's tree, caches by the default-branch tip, and /templates already used it. So I extended it rather than adding a module:

  • Limit: HOLDS_FILES_MAX goes from 12 to 40.
  • Fold: the Files row is now a <details data-files> fold in src/web/pages/templates.ts. Its summary reads "N entries" (or "1 entry"), and the names sit inside as <code>. Everything is server-rendered and escaped, so first paint needs no extra request.
  • Fold markup: I used a paragraph of <code> names rather than a <ul>, because design-lint flags bare lists on this page.
  • Terminal: the terminal's App templates screen still shows Files as one joined line, from the same data, so it now gets the 40 limit too.
  • Docs: docs/features/template-holds.md is updated.
  • Tests: two templates cover the list.
    • The starter shows its fold with forge.json inside.
    • A 45-entry repo shows the first 40, "and 5 more" and "45 entries", and f40.txt is absent.
    • A one-file repo shows "1 entry".
    • The existing 12-limit assertions are rewritten for 40.

Left out: a fold on the New forge picker, and a separate card module. The issue named src/web/template_card.ts, but the rows live in templates.ts.

Try it: open /templates and open the Files fold under a template.

[{"go":"/templates","look":"the Files row under Starter app and under any template repository","expect":"a collapsed fold reading 'N entries'; opening it lists the names in code type, and past 40 ends with 'and N more'"}]

The push first failed the pre-push hook because no commit said how to try the change. I added an empty Try: commit, and the push then went through.

🤖 Generated with Claude Code

commented

<!-- look-pages 9c40f9e3d92c --> Look pages for 9c40f9e, 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

Each template row on /templates now has a Files fold that lists the template's top-level files and folders. It shows the first 40 and then "and N more". bun test passed on test/templates-page.test.ts and test/tui-app-templates.test.ts, and tsc and design-lint were clean. The forge's check on this pull had failed on its "both doors" rule, and I have pushed a fix for that. I haven't seen it re-run, so the verdict is still open.

The check failed because the pull edits src/web/pages/templates.ts and has no change under src/tui/. I haven't touched src/tui/. The terminal's App templates screen already prints the same Files line from the shared holdsRows, so it now gets the 40-entry limit too. The latest commit says so in a No door: line, and adds Looks: /templates for the look-page warning.

  • Reuse: src/spawn/template_holds.ts already read each template's tree and cached it by the default-branch tip. I raised HOLDS_FILES_MAX from 12 to 40 there instead of adding a module.
  • Fold: src/web/pages/templates.ts renders Files as a <details data-files> with an "N entries" summary. The page is server-rendered with every name escaped, so first paint needs no new request.
  • Tests: they cover the starter, a 45-entry repo (first 40, "and 5 more", f40.txt absent) and a one-file repo. The old 12-limit assertions are rewritten for 40.
  • Left out: a fold on the New forge picker, and a separate card module.

To try it, open /templates and open the Files fold under a template.

[{"go":"/templates","look":"the Files row under Starter app and under any template repository","expect":"a collapsed fold reading 'N entries'; opening it lists the names in code type, and past 40 ends with 'and N more'"}]

🤖 Generated with Claude Code

commented

<!-- look-pages 4074aceb178b --> Look pages for 4074ace, from the gate:

  • look pages (none): "Looks: /templates" is not a page of app.looks in forge.json; 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

I added /templates to app.looks in forge.json, so the gate's Looks: /templates line now names a real page. I pushed it and haven't seen the gate re-run. I only checked that forge.json still parses; I ran no tests for this change.

The gate said /templates wasn't in that list. The page is public and the Files fold shows without signing in, so I added it to looks only, not looksAsOwner.

I disagree with one part of the gate's message. It also says it couldn't trace the route of /settings/security/controls and so couldn't infer a page. That is a fault in the tracer and has nothing to do with this change, so I left it alone.

The Files fold itself is unchanged since the last push: it lists up to 40 entries, then "and N more".

🤖 Generated with Claude Code

commented

I reverted the /templates entry in forge.json and pushed. I haven't seen the preview deploy or the gate re-run, and I ran no tests for this revert; git diff origin/main showed no forge.json change.

The preview failed because app.looks already held the 32 paths the forge allows, so my earlier addition made it 33. In place of the look page, the commit carries a No look: line saying the list is full.

The Files fold is unchanged: it lists up to 40 top-level entries, then "and N more".

If a reviewer wants /templates in the looks, one existing path has to come out to make room. I didn't choose which.

🤖 Generated with Claude Code

commented

Each /templates card now shows its files in a fold, with all five review points addressed except the 360px phone check, which I did not run. tsc, design-lint, gate --fix and test/templates-page.test.ts pass. I did not run the rest of the suite.

  • Empty template: a template with no files now shows "Holds no files." (HOLDS_BLANK) instead of a "0 entries" fold.
  • Wording: the summary reads "N files" ("1 file"), and "and N more" sits inside the fold with the names.
  • One Files row: filesRow and runRows are now split out in src/spawn/template_holds.ts. holdsRows is just the two joined, so the terminal is unchanged. The page uses filesRow's pieces and runRows directly, with no build-and-filter.
  • Semicolons: added on the f39, f40 and README.md expect lines in test/templates-page.test.ts. The tests now expect "45 files" and "1 file".
  • Focus and wrapping:
    • Added styles: .holds summary:focus-visible uses the same 2px solid var(--accent) outline as .why > summary. .files-list has overflow-wrap: anywhere, so the 40 names should wrap and not scroll sideways.
    • Phone check not run: I haven't looked at it on a 360px phone, because the sandbox has no browser. Please check that in the preview.
    • Class names: .holds and .files-list are named in docs/design/areas/templates.md, because design-lint required it.
  • Docs: the long line in docs/features/template-holds.md is rewrapped and now mentions the "N files" fold and the empty case.

I did not add a test for the empty-template case, so the "Holds no files." path is untested. I did not add a test for the new filesRow and runRows helpers either.

No door: the terminal and docs already match, since the terminal shares holdsRows and gets the 40-name limit.

[
  {"go": "/templates", "look": "A repository template's Files row", "expect": "A collapsed fold reading 'N files'; opening it shows the names in code, wrapping, with 'and N more' after them when there are more than 40"},
  {"go": "/templates", "look": "Tab to a fold's summary", "expect": "A visible accent outline appears around the summary"},
  {"go": "/templates", "look": "The blank template", "expect": "'Holds no files.' with no fold"}
]
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs