Problem
Several page/components call fetch('/api/...') inline, bypassing the documented service-layer convention (client/src/services/README.md):
client/src/pages/PromptManager.jsx — 13+ raw /api/prompts*//api/providers calls; no apiPrompts.js exists.
client/src/pages/VideoGen.jsx:876, client/src/pages/ImageGen.jsx:621,628,766, client/src/components/settings/LocalSetupPanel.jsx:57,123,150, client/src/components/writers-room/StagePromptModelPicker.jsx:33,34,68, client/src/components/apps/tabs/GsdTab.jsx:256,264,265.
Approach (decided)
Create client/src/services/apiPrompts.js (register in api.js barrel + README) for the prompts/providers calls; move each other site to its relevant existing/new apiX.js. (VideoGen's site can land with the VideoGen split issue to avoid double-touching that file.)
Acceptance
- No inline
/api/ fetch in the listed files; calls go through services/; client tests pass.
Found by the /do:better audit (2026-07-21). Deferred from automated remediation because it is a large/high-churn structural change best landed deliberately rather than auto-merged.
Problem
Several page/components call
fetch('/api/...')inline, bypassing the documented service-layer convention (client/src/services/README.md):client/src/pages/PromptManager.jsx— 13+ raw/api/prompts*//api/providerscalls; noapiPrompts.jsexists.client/src/pages/VideoGen.jsx:876,client/src/pages/ImageGen.jsx:621,628,766,client/src/components/settings/LocalSetupPanel.jsx:57,123,150,client/src/components/writers-room/StagePromptModelPicker.jsx:33,34,68,client/src/components/apps/tabs/GsdTab.jsx:256,264,265.Approach (decided)
Create
client/src/services/apiPrompts.js(register inapi.jsbarrel + README) for the prompts/providers calls; move each other site to its relevant existing/newapiX.js. (VideoGen's site can land with the VideoGen split issue to avoid double-touching that file.)Acceptance
/api/fetchin the listed files; calls go throughservices/; client tests pass.Found by the /do:better audit (2026-07-21). Deferred from automated remediation because it is a large/high-churn structural change best landed deliberately rather than auto-merged.