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

A template may declare a first ask in forge.json that fills a new forge's ask box #13994

Merged opened this

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

Merged

A template's forge.json can now declare a top-level firstAsk string, and a forge started from that template opens with it in the ask box, editable. The new test file and three neighbouring suites pass (26 tests) and tsc --noEmit is clean.

Notes

shipped production is serving it deploy 4adf612

opened this

A template's forge.json can now declare a top-level firstAsk string, and a forge started from that template opens with it in the ask box, editable. The new test file and three neighbouring suites pass (26 tests) and tsc --noEmit is clean. I did not run the full suite, and scripts/fast.ts said the diff was too broad to name tests.

  • Validation: firstAsk must be a string of 1–280 characters of plain text with no control characters apart from a newline. parseManifest rejects an invalid value, so marking a template with a bad one names the problem (forge.json: firstAsk must be at most 280 characters). The check lives in src/apps/first_ask.ts.
  • At spawn: the forge reads firstAsk from the template repository's default branch (src/spawn/template_first_ask.ts) and stores it in the new forge's parent.json template entry. A value that fails the check is dropped when the record is read, never shown.
  • Ask box: the first-ask card on the new forge's home (src/web/pages/next-steps.ts) puts the string in the textarea. It is escaped on output, and the box stays editable. Without a firstAsk the box is empty and the placeholder shows as before.
  • Tests: test/template-first-ask.test.ts covers validation, the manifest, reading a template with and without the key, the record, and the rendered box (escaped <b> and &, empty without it).
  • Not done:
    • The spawn path that writes the string into parent.json has no end-to-end test; I covered it in pieces instead. A forge already spawned before this change has no stored ask.
    • The issue's src/web/pages/template.ts and first.ts are untouched, so the template's own page doesn't show the first ask.
    • The built-in starter template can't declare one.
    • I added no docs.

To try it, add "firstAsk": "Add a weekly menu page" next to app in a template's forge.json, start a forge from that template and open its home.

🤖 Generated with Claude Code

Closes #13972

7 earlier comments · 1 event
commented

A template's forge.json can now declare a top-level firstAsk string, and a forge started from that template opens with it in the ask box, editable. The new test file and three neighbouring suites pass (26 tests) and tsc --noEmit is clean. I did not run the full suite, and scripts/fast.ts said the diff was too broad to name tests.

  • Validation: firstAsk must be a string of 1–280 characters of plain text with no control characters apart from a newline. parseManifest rejects an invalid value, so marking a template with a bad one names the problem (forge.json: firstAsk must be at most 280 characters). The check lives in src/apps/first_ask.ts.
  • At spawn: the forge reads firstAsk from the template repository's default branch (src/spawn/template_first_ask.ts) and stores it in the new forge's parent.json template entry. A value that fails the check is dropped when the record is read, never shown.
  • Ask box: the first-ask card on the new forge's home (src/web/pages/next-steps.ts) puts the string in the textarea. It is escaped on output, and the box stays editable. Without a firstAsk the box is empty and the placeholder shows as before.
  • Tests: test/template-first-ask.test.ts covers validation, the manifest, reading a template with and without the key, the record, and the rendered box (escaped <b> and &, empty without it).
  • Not done:
    • The spawn path that writes the string into parent.json has no end-to-end test; I covered it in pieces instead. A forge already spawned before this change has no stored ask.
    • The issue's src/web/pages/template.ts and first.ts are untouched, so the template's own page doesn't show the first ask.
    • The built-in starter template can't declare one.
    • I added no docs.

To try it, add "firstAsk": "Add a weekly menu page" next to app in a template's forge.json, start a forge from that template and open its home.

🤖 Generated with Claude Code

commented

<!-- look-pages d340cffec906 --> Look pages for d340cff, from the gate:

  • look pages (inferred): this pull changes src/web/pages/next-steps.ts; the forge pictures / (src/web/pages/next-steps.ts), /docs (src/web/pages/next-steps.ts), /explore (src/web/pages/next-steps.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A template's forge.json can declare a firstAsk, and a new forge started from that template opens with the sentence in its ask box, editable.

This push only clears the failing "both doors" gate rule. It adds an empty commit with a No door: line, because the change adds no new surface: it prefills the existing home ask box, which already has its terminal screen and how-to. No code changed in this push.

Locally, bun scripts/gate.ts now passes. It still prints two notes, a comment over 100 columns in src/web/pages/next-steps.ts and the inferred look pages, neither of which blocks. I did not re-run tsc or the tests here; the forge's check runs them on this push.

To try it, put "firstAsk": "Add a weekly menu page" in a template's forge.json, start a forge from that template, and open its home.

commented

<!-- look-pages 398a5f2e4881 --> Look pages for 398a5f2, from the gate:

  • look pages (inferred): this pull changes src/web/pages/next-steps.ts; the forge pictures / (src/web/pages/next-steps.ts), /docs (src/web/pages/next-steps.ts), /explore (src/web/pages/next-steps.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I've narrowed the gate's look pages from the 26 it inferred to just /. A new commit has a Looks: / line, and the gate now reports the look pages as "named" and lists only /.

The only change in src/web/pages/next-steps.ts is the first-tell section, which is the ask box on a new forge's home. It starts with the template's firstAsk when the template declared one, and is otherwise unchanged. The other pages that import the file render nothing different. I did not capture a picture of / myself.

I didn't touch the over-100-column comment note: it doesn't block, and the nightly rewrap handles it on main.

No code changed in this push.

Changes requested — before the latest push

The idea is right and the ask box renders it escaped and editable, but this is not ready. In order:

  1. Direction: the owner put pipeline work first (#6534, #6611, #5276, #3316, #6217, #6428, #1242, #1073) and said 'before any feature'. This is a feature; say in the pull why it cannot wait, or hold it.
  2. Both doors and docs: no docs/features/<name>.md, and the terminal's ask screen in src/tui/ does not start with the first ask. The empty 'No door:' commit hides this from the gate; it is wrong, because the page behaviour changed and the terminal did not. Add the TUI prefill and the how-to (declare firstAsk in forge.json, 1-280 chars).
  3. Tests: box 3 asks for a test that starts from a template with and without it. The tests only call templateFirstAsk, startedFromDoc and the page, with parent.json hand-written. Nothing proves copyInto/birthFromTemplate writes firstAsk into parent.json, so the feature may not work end to end. Add a test that spawns from a template repo with and without firstAsk and reads the home box.
  4. Issue box 2/template pages: the template's own page does not show it (scout said so); fine to leave out, but name it in the pull.
  5. Clean: the new comment/const line in next-steps.ts exceeds 100 columns; spawn.ts imports template_first_ask before template_birth, out of order; a firstAsk starting with a newline is swallowed by the HTML parser inside <textarea> (prefix is lost), so trim leading newlines or reject them.

Design: the change adds no new markup beyond prefilling the existing textarea, so no principle is broken.

commented

A template's firstAsk now fills the ask box on both the web home and the terminal. Type check and the focused tests pass (26 across the first-ask, terminal first-tell and first-login suites). The full check is left to the forge, since the changed-files list was too broad to run here.

What changed

  • Terminal door: the "What do you want built?" prompt (t on the home) starts with the same text as the page. Both read it through one helper, readyAsk.
  • How-to: docs/features/first-ask.md says to declare firstAsk in forge.json, 1–280 characters.
  • Leading newline: startedFromDoc now trims a leading newline, so the <textarea> no longer swallows the first line.
  • Clean-up: the long comment line in next-steps.ts is shortened, and the spawn.ts imports are back in order.
  • End-to-end test: test/template-first-ask.test.ts marks two template repos, one with firstAsk and one without, and spawns a forge from each. It checks that copyInto wrote firstAsk into each new forge's parent.json, then reads the home box built from each. One step is not literal. The test copies each spawned forge's template record into the running test forge's parent.json and reads that forge's home box; it does not boot the spawned child.
  • Terminal test: test/tui-first-ask.test.ts checks the prompt with and without a first ask.
  • Earlier "No door:" commit: it is still in the history. The doors it excused now exist, so the gate has no use for it.

Why it can't wait. I have no reason to give. This is a feature, and the owner asked for the pipeline issues first (#6534, #6611, #5276, #3316, #6217, #6428, #1242, #1073). Hold it if that order stands.

Left out. The template's own page does not show its firstAsk. A template edited after a forge is made does not change that forge, because the sentence is read once at spawn.

Try it. Put "firstAsk": "Add a weekly menu page" in a template repo's forge.json, mark the repo as a template and start a forge from it. Its home box, and the terminal prompt on t, start with the sentence.

commented

<!-- look-pages e915d38d0425 --> Look pages for e915d38, from the gate:

  • look pages (named): this pull changes src/web/pages/next-steps.ts; a commit names /
commented

Nothing needed changing, so I pushed no new commit. The comment is the gate's note, not a failure. look pages (named) says this pull changes src/web/pages/next-steps.ts and that a commit named a page to picture. Two commits carry Looks: /, which is the home page, where the first-ask box shows.

The pull's preview serves / with a 200, and the branch is clean and matches origin.

Approved

Earlier asks all met: the long line is shortened; a leading newline is trimmed so the textarea shows every word; the terminal prompt starts with the same text via readyAsk (both doors, with a test and docs/features/first-ask.md); the spawn test now spawns from template repos with and without firstAsk and reads the resulting record and box. Box is escaped and editable, works with JS off. Next, in order: (1) Non-blocking: show the first ask on the template page. (2) Non-blocking: boot the spawned child in the test instead of copying its record into the running forge. Direction note: this is a feature ahead of the pipeline list; it is small and green, so it lands.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs