Prompt generator workflow
Prompt generator workflow
What this area does
The prompt generator is the user-facing prompt authoring surface. It supports prompt listing, creation, editing, version history, and activation, and it can also generate a prompt draft from an uploaded document.
It is a separate system from the admin prompt library. Both deal with prompts, but they use different API lanes and serve different user roles.
Route family
/prompt-generator— prompt list / landing route./prompt-generator/new— prompt creation route.
Primary implementation
The main route and editor pieces live in src/pages/promptgenerator/:
PromptListRoutePromptCreateRoutePromptGenerator.cssPromptEditorPromptSidebarPromptDetailPanelPromptVersionHistoryPromptSaveModalPromptCreatePanel
Service coupling
The workflow uses promptService as its backend contract.
Important prompt lanes
- Bulk-upload lane: create/update/delete via
/api/create-prompt/,/api/update-prompt/:id/,/api/delete-prompt/:id/, and related bulk upload endpoints. - v1 authenticated lane: list/create/update/delete/version-history/activate via
/api/prompt/,/api/prompt/:uid/,/versions/, and/activate/.
The repository intentionally keeps these lanes distinct because they do not serve the same store or lifecycle.
Prompt lifecycle
- List prompts.
- Create or open a draft.
- Optionally generate a prompt from an uploaded document.
- Save the prompt.
- View version history.
- Activate a previous version or edit the active version.
Invariants
- The v1 UUID-based route family is the canonical backend for the main prompt lifecycle.
- Prompt creation forms validate required text fields before submission.
- Bulk upload is parallelized and reports partial success/failure counts.
- Version history is newest-first and is treated as the authoritative audit trail.
Evidence-backed tests
tests/contract/promptService.test.js proves the service contract for:
- prompt listing and response normalization,
- bulk create/update/delete request shapes,
- document-to-prompt FormData generation,
- v1 prompt listing and creation,
- version history and activation,
- validation errors for missing fields.
Extension surface
When changing prompt-generation behavior, the useful change order is:
- update the prompt page or editor component,
- update
promptService, - extend the contract test with the exact request shape,
- update the admin prompt-library docs separately if the admin surface is affected.