This commit is contained in:
Your Name committed 2026-06-28 21:34:58 -04:00
1 parent 3965f4f4da
commit 70877882b0
82 files changed
+4353 -186

No files matched your search

+24 -18
View File
@@ -1,29 +1,35 @@
# Project: update_category_image
# Project: Premium Mega Menu
## Architecture
- Database Schema: `Category` model in Prisma has an `imageUrl` field.
- Backend API: `apps/backend/src/routes/categories.ts` handles category operations.
- MCP Server: `apps/mcp-server/index.ts` exposes MCP tools to agents.
- **Database Schema**: Update `Menu` and `MenuItem` models in Prisma schema (`apps/backend/prisma/schema.prisma`) to support `rootImage`, `columnImage`, and `hoverImage` fields.
- **Backend API**: `apps/backend/src/routes/menus.ts` handles saving and loading the menu tree payload and database fields.
- **MCP Server**: `apps/mcp-server/index.ts` and tool suite handles querying, modifying, and auditing menu structure.
- **Admin Panel UI**: `apps/admin/src/pages/MenuManagerPage.tsx` and `apps/spa/src/components/DesktopMegaMenu.tsx` / `MobileDrawer.tsx` allow configuring and rendering the 3-image layout.
- **Storefront UI**: `apps/website/src/components/navigation/DesktopMegaMenu.tsx` / `MobileDrawer.tsx` render the 3-image layout using `next/image` with lazy loading and fade-in micro-animations.
## Milestones
| # | Name | Scope | Dependencies | Status |
|---|------|-------|-------------|--------|
| M1 | Backend Implementation | Expose `PATCH /api/categories/:id/image` in `apps/backend/src/routes/categories.ts` | None | DONE |
| M2 | MCP Tool Implementation | Add `update_category_image` tool schema and handler in `apps/mcp-server/index.ts` | M1 | DONE |
| M3 | Verification & Auditing | Compile the monorepo, test the tool end-to-end, and run Forensic Auditor. | M2 | DONE |
| M1 | E2E Testing Track | Create requirement-driven E2E tests for the 3-image mega menu layout. | None | PLANNED |
| M2 | DB & Backend Updates | Prisma migration, backend routes & schemas, and MCP tools updates. | None | PLANNED |
| M3 | Storefront & Admin UI | Implement admin configuration UI and Next.js storefront image rendering. | M2 | PLANNED |
| M4 | E2E & Adversarial Hardening | Pass E2E tests, add adversarial tests, run integrity audit. | M1, M3 | PLANNED |
## Interface Contracts
### Backend API
- `PATCH /api/categories/:id/image`
- Body: `{ imageUrl: string }`
- Response: Updated Category object
### Database Schema
- `Menu` model: `rootImage String?`
- `MenuItem` model: `columnImage String?`, `hoverImage String?`
### MCP Tool Schema
- Name: `update_category_image`
- Input Schema:
- `id`: number (required)
- `imageUrl`: string (required)
### MegaMenuPayload Type Definitions
- `MegaMenuPayload`: `{ rootImage?: string; ... }`
- `MenuColumn`: `{ columnImage?: string; ... }`
- `MenuLink`: `{ hoverImage?: string; ... }`
## Code Layout
- Backend routes: `apps/backend/src/routes/categories.ts`
- MCP server: `apps/mcp-server/index.ts`
- **Database**: `apps/backend/prisma/schema.prisma`
- **Shared Types**: `packages/types/index.ts`
- **Backend Routes**: `apps/backend/src/routes/menus.ts`
- **MCP Server**: `apps/mcp-server/menu-tools.ts`, `apps/mcp-server/menu-toolkit.ts`
- **Admin UI**: `apps/admin/src/pages/MenuManagerPage.tsx`
- **SPA UI**: `apps/spa/src/components/DesktopMegaMenu.tsx`, `apps/spa/src/components/MobileDrawer.tsx`, `apps/spa/src/store/menuStore.ts`
- **Website UI**: `apps/website/src/components/navigation/DesktopMegaMenu.tsx`, `apps/website/src/components/navigation/menuTypes.ts`