Files
mcpctl/.taskmaster/tasks/task_043.md

42 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

# Task ID: 43
**Title:** Add regenerate-summary API endpoint
**Status:** done
**Dependencies:** 42 ✓
**Priority:** medium
**Description:** Create POST /api/v1/prompts/:id/regenerate-summary endpoint to force re-generation of summary and chapters for a prompt.
**Details:**
1. Add route in `/src/mcpd/src/routes/prompts.ts`:
```typescript
fastify.post('/api/v1/prompts/:id/regenerate-summary', async (request, reply) => {
const { id } = request.params as { id: string };
const prompt = await promptService.findById(id);
if (!prompt) {
return reply.status(404).send({ error: 'Prompt not found' });
}
const { summary, chapters } = await summaryService.generateSummary(prompt.content);
const updated = await promptService.updateSummary(id, summary, chapters);
return reply.send(updated);
});
```
2. Add `updateSummary(id, summary, chapters)` method to PromptRepository and PromptService
3. Return the updated prompt with new summary/chapters in response
**Test Strategy:**
- Unit test: POST to valid prompt ID regenerates summary
- Unit test: Returns updated prompt with new summary/chapters
- Unit test: 404 for non-existent prompt ID
- Unit test: Uses LLM when available, regex fallback otherwise
- Integration test: End-to-end regeneration updates database