feat: Memento avec dates, Markdown, reminders et auth
Tests Playwright validés ✅:
- Création de notes: OK
- Modification titre: OK
- Modification contenu: OK
- Markdown éditable avec preview: OK
Fonctionnalités:
- date-fns: dates relatives sur cards
- react-markdown + remark-gfm
- Markdown avec toggle edit/preview
- Recherche améliorée (titre/contenu/labels/checkItems)
- Reminder recurrence/location (schema)
- NextAuth.js + User/Account/Session
- userId dans Note (optionnel)
- 4 migrations créées
Ready for production + auth integration
This commit is contained in:
@@ -37,6 +37,27 @@ function parseNote(dbNote) {
|
||||
};
|
||||
}
|
||||
|
||||
// Helper to parse note with lightweight format (no images, truncated content)
|
||||
function parseNoteLightweight(dbNote) {
|
||||
return {
|
||||
id: dbNote.id,
|
||||
title: dbNote.title,
|
||||
content: dbNote.content.length > 200 ? dbNote.content.substring(0, 200) + '...' : dbNote.content,
|
||||
color: dbNote.color,
|
||||
type: dbNote.type,
|
||||
isPinned: dbNote.isPinned,
|
||||
isArchived: dbNote.isArchived,
|
||||
hasImages: !!dbNote.images,
|
||||
imageCount: dbNote.images ? JSON.parse(dbNote.images).length : 0,
|
||||
labels: dbNote.labels ? JSON.parse(dbNote.labels) : null,
|
||||
hasCheckItems: !!dbNote.checkItems,
|
||||
checkItemsCount: dbNote.checkItems ? JSON.parse(dbNote.checkItems).length : 0,
|
||||
reminder: dbNote.reminder,
|
||||
createdAt: dbNote.createdAt,
|
||||
updatedAt: dbNote.updatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
// Create MCP server
|
||||
const server = new Server(
|
||||
{
|
||||
@@ -118,7 +139,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
},
|
||||
{
|
||||
name: 'get_notes',
|
||||
description: 'Get all notes from Memento',
|
||||
description: 'Get all notes from Memento (lightweight format: titles, truncated content, no images to reduce payload size)',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -131,6 +152,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
type: 'string',
|
||||
description: 'Search query to filter notes',
|
||||
},
|
||||
fullDetails: {
|
||||
type: 'boolean',
|
||||
description: 'Return full note details including images (warning: large payload)',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -323,11 +349,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
],
|
||||
});
|
||||
|
||||
// Use lightweight format by default, full details only if requested
|
||||
const parsedNotes = args.fullDetails
|
||||
? notes.map(parseNote)
|
||||
: notes.map(parseNoteLightweight);
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: JSON.stringify(notes.map(parseNote), null, 2),
|
||||
text: JSON.stringify(parsedNotes, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user