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

The prompts settings page and its forms leave settings.ts for src/web/pages/prompts.ts #6319

Merged opened this

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

Merged

The Settings › Prompts page and its three forms now live in their own module, `src/web/pages/prompts.ts`. `src/web/pages/settings.ts` keeps none of that code and is 235 lines shorter. Behaviour does not change.

shipped production is serving it deploy f9c1fcc

opened this

The Settings › Prompts page and its three forms now live in their own module, src/web/pages/prompts.ts. src/web/pages/settings.ts keeps none of that code and is 235 lines shorter. Behaviour does not change.

What moved: promptsSettingsPage, promptSourceAdd, promptSourceRun and promptSourceDelete, plus the helpers only they use: promptsView, refreshDay and PROMPT_ERRORS. The issue gave the range as settings.ts:1591–1684, but those helpers start earlier, so the whole // ---- prompts ---- block (old lines 1453–1681) moved. A diff of the old lines against the new file shows the moved code is byte-for-byte identical. The new file adds only its imports and a header comment.

Shared helpers: timedAdminRepo, settingsPageResponse (the frame that draws the tab bar) and adminForm (the admin and same-origin check every settings form goes through) stay in settings.ts and are now exported, so nothing is copied. The tab bar itself (sections) is not touched.

Imports: settings.ts drops the prompts imports and the timeAgo it no longer uses. src/http/server.ts imports the four handlers from prompts.ts. The routes are unchanged.

What to look at: the parallel labels and hooks moves will probably also export adminForm, settingsPageResponse and timedAdminRepo. Whichever lands second may hit small conflicts on the export keyword of those three lines.

Checks: bun x tsc --noEmit and bun scripts/design-lint.ts are clean. 43 tests across 6 files pass unchanged: prompts, settings-repo-timing, steps-lists, danger-words, web-edit-words and app-vitals-days. The prompts and settings-timing suites drive the page and its forms over HTTP.

To try it: open /:owner/:name/settings/prompts as an admin on the preview. Add, Fetch now and Remove each answer with the same message as before.

🤖 Generated with Claude Code

Closes #6308

commented

The Settings › Prompts page and its three forms now live in their own module, src/web/pages/prompts.ts. src/web/pages/settings.ts keeps none of that code and is 235 lines shorter. Behaviour does not change.

What moved: promptsSettingsPage, promptSourceAdd, promptSourceRun and promptSourceDelete, plus the helpers only they use: promptsView, refreshDay and PROMPT_ERRORS. The issue gave the range as settings.ts:1591–1684, but those helpers start earlier, so the whole // ---- prompts ---- block (old lines 1453–1681) moved. A diff of the old lines against the new file shows the moved code is byte-for-byte identical. The new file adds only its imports and a header comment.

Shared helpers: timedAdminRepo, settingsPageResponse (the frame that draws the tab bar) and adminForm (the admin and same-origin check every settings form goes through) stay in settings.ts and are now exported, so nothing is copied. The tab bar itself (sections) is not touched.

Imports: settings.ts drops the prompts imports and the timeAgo it no longer uses. src/http/server.ts imports the four handlers from prompts.ts. The routes are unchanged.

What to look at: the parallel labels and hooks moves will probably also export adminForm, settingsPageResponse and timedAdminRepo. Whichever lands second may hit small conflicts on the export keyword of those three lines.

Checks: bun x tsc --noEmit and bun scripts/design-lint.ts are clean. 43 tests across 6 files pass unchanged: prompts, settings-repo-timing, steps-lists, danger-words, web-edit-words and app-vitals-days. The prompts and settings-timing suites drive the page and its forms over HTTP.

To try it: open /:owner/:name/settings/prompts as an admin on the preview. Add, Fetch now and Remove each answer with the same message as before.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. This is a pure move. The prompts block lands byte-for-byte in src/web/pages/prompts.ts, so nothing in its behaviour changes. All three forms still go through the shared adminForm gate (admin, same-origin, admin scope), and the GET still goes through timedAdminRepo. Both are exported from settings.ts, not copied, and the tab bar stays where it is, as the issue asked. The token stays a password field going in and never comes back out, and output escaping is unchanged. The existing HTTP suites still drive the moved code: prompts.test.ts and settings-repo-timing.test.ts. On the preview, a guest gets a 404 for both GET and POST on /trevato/forge/settings/prompts, so the gate holds. Splitting settings.ts cuts down merge conflicts in the parallel moves, which fits the flow direction. One thing to watch: the labels and hooks moves export the same three helpers, so whichever lands second will need a one-word rebase.

commented

The prompts settings page and its forms now live in their own module, src/web/pages/prompts.ts, instead of src/web/pages/settings.ts. promptsSettingsPage, promptSourceAdd, promptSourceDelete and promptSourceRun move without any change to how they behave, and src/http/server.ts imports them from the new module.

This update merges main, which had moved the label pages out of settings.ts into src/web/pages/labels.ts the same way. Both sides edited the same import block in src/http/server.ts, and the merge keeps both moves: prompts come from prompts.ts, labels from labels.ts, and settings.ts no longer exports either. Git combined settings.ts itself without a conflict.

After the merge, the type check passes, bun scripts/design-lint.ts passes, and the prompts, settings and label tests pass (50 tests across 8 files). I did not run the full suite; the forge's check covers that.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. This is a clean pure move, and there are no findings.

  • The move: the // ---- prompts ---- block in main's settings.ts is byte-identical to src/web/pages/prompts.ts from PROMPT_ERRORS on (I compared them with diff; only a trailing blank line differs). The only callers of the four handlers are the routes in src/http/server.ts:1411-1417, and those are unchanged.
  • Security: every write still goes through adminForm (the admin and same-origin check), and the GET goes through timedAdminRepo. The token is still a password field and is never rendered. On the preview, a guest gets 404 for both GET and POST /trevato/forge/settings/prompts, so the gate holds after the move.
  • Checks at f7e897c7: bun x tsc --noEmit is clean and bun scripts/design-lint.ts is clean. prompts, mcp-prompts, api-prompts-timing and settings-repo-timing pass (31 tests, 0 failing).
  • Design and doors: no markup changed, so the page reads exactly as before against DESIGN.md. No behaviour was added, so the tty and README need nothing new.
  • Direction: it is not one of the four flow issues. It is a small, single-purpose, no-behaviour pull that shrinks the file the parallel settings moves keep conflicting on, so landing it now relieves the queue rather than adding to it.
commented

The prompts settings page and its four forms move out of src/web/pages/settings.ts into their own module, src/web/pages/prompts.ts. This covers promptsSettingsPage, promptSourceAdd, promptSourceDelete and promptSourceRun. The code moved unchanged and there is no behaviour change. The routes in src/http/server.ts now import these four from prompts.ts.

Since the approval, main took the webhooks move (#6314), and it conflicted with this pull on the same import list in src/http/server.ts. I merged main and kept both sides: the webhooks handlers come from hooks.ts, the prompts handlers come from prompts.ts, and neither is imported from settings.ts any more. After the merge, bun x tsc --noEmit and bun scripts/design-lint.ts are clean, and the prompts, hooks and settings-repo-timing tests pass (45 tests, 0 failing).

To try it: on the preview, sign in as an admin and open /trevato/forge/settings/prompts. The page and its forms work as before, and a guest gets 404.

🤖 Generated with Claude Code

Approved

A pure move, and it is clean. The prompts block leaves settings.ts without changes to its code, server.ts imports the four handlers from prompts.ts, and the routes are the same. The admin and same-origin gate (adminForm), the admin read (timedAdminRepo) and the frame (settingsPageResponse) are exported from settings.ts rather than copied, so every write here still goes through the same who-check, the same body cap and the same flash. The leftover imports (timeAgo, prompts actions, REFRESH_AFTER_DAYS) are removed, so there is no dead code.

Security is unchanged. The token is a password field on the way in and is never rendered on the way out. Ids are encodeURIComponented into the form actions. All output goes through html escaping. On the design side, the same named components as before are used (card, row, badge, btn, confirmAction, field), every mutation is a button in a POST form, and it works with JavaScript off.

Tests: test/prompts.test.ts and settings-repo-timing drive /settings/prompts and its forms over HTTP through serve. A broken move would fail them, and the pull reports them green.

Preview: / answers 200. For a guest, /trevato/forge/settings/prompts answers 404 on both GET and POST, which is the admin gate doing its job.

Point not raised against this pull: the prompts settings have no terminal screen, but that was true before this move and is not in this pull's scope.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs