CI / typecheck + build (turbo) (push) Canceled after 0s
Complete UI/UX overhaul, not just style changes:
Layout:
- Dark-mode-first (near-black #08090a canvas, whiteOpacity borders)
- Sticky header with brand + nav + theme toggle
- Sticky sidebar (xl+) with hierarchical doc tree
- Main content in max-w-3xl centered column
- Inter font system (via @font-face + CSS vars)
- Font feature settings cv01/ss03 for Linear-geometric Inter
Components rewritten in Linear aesthetic:
- Homepage: editorial-style doc listing with tags, section headers
- Doc page: breadcrumb-style nav links, metadata bar (author/date/tags),
clean prose, Related + History sections
- TOC: rehype-slug heading anchors + github-slugger matching
- Create/Edit: inline form with Linear-style inputs/buttons
- Login: centered card-style, brand-indigo CTA button
- Docs index: sectioned listing with tag previews
- Search: dark-themed search with result cards + snippets
- ThemeToggle: system-default + localStorage persistence
Typography:
- prose with custom Tailwind classes matching Linear's:
headings #f7f8f8 font-light, body #d0d6e0,
links #7170ff with hover #828fff,
code blocks #191a1b bg with #23252a border
New deps: rehype-slug (heading anchors), github-slugger (TOC matching)
Files: layout.tsx (overhaul), page.tsx, create/, login/, docs/,
[section]/[...slug]/page.tsx, Sidebar.tsx, ThemeToggle.tsx,
TOC.tsx, DocForm.tsx, Markdown.tsx, Search page
3.7 KiB
3.7 KiB
MCPedia Phase 11 — CRUD + Auth + Web UI
STATUS: ✅ ALL DONE (committed f8b525d, CI+Deploy success)
Plan (spec BEFORE implementation, per user rule)
Scope: 4 areas
- CRUD: Create/Read/Update/Delete documents from web UI + MCP
- Authentication: MCP/API writes (x-webhook-secret), Web CRUD (cookie-based ADMIN_PASSWORD)
- Web + Agent access: Web forms + MCP write tools
- UI/UX: Edit forms, TOC, dark mode
Requirements:
- Source of truth = filesystem (markdown files in content/{section}/{slug}.md)
- DB mirrors disk (documents, document_chunks, document_revisions tables)
- Single indexing path: indexContentFile in @mcpedia/core
- Auth: MCP/API writes use WEBHOOK_SECRET; Web uses ADMIN_PASSWORD cookie
- Slug rules: [a-z0-9][a-z0-9/_-]*, no //, no .. traversal
- No breaking existing features (32 original tests still green)
- UI/UX: edit button on doc pages, ?edit=1 inline form, /create page, login, TOC, dark mode
Implementation
Backend
packages/parser: addedstringifyFile()(writes markdown with frontmatter)packages/core:createDocument,updateDocument,deleteDocument(file I/O + DB + revision + chunks)apps/api: tRPC CRUD routers (requireWriteAuth), fixedrequireWriteAuthenv-constant bug (now usesctx.expectedSecretinjected fromcreateApp(deps))apps/mcp: 3 new write tools (create_document,update_document,delete_document) gated byx-webhook-secret
Web UI
apps/web/app/api/auth/login/route.ts: POST login → verify ADMIN_PASSWORD, setmcpedia_admincookieapps/web/app/api/docs/route.ts: POST (create)apps/web/app/api/docs/[...slug]/route.ts: PUT (update), DELETE (delete)apps/web/app/components/DocForm.tsx: shared create/edit formapps/web/app/create/page.tsx: create formapps/web/app/login/page.tsx: login formapps/web/app/[section]/[...slug]/page.tsx:?edit=1inline edit, TOC, dark mode, Edit buttonapps/web/app/docs/page.tsx: docs index listingapps/web/app/components/TOC.tsx: auto-generated TOC from h2/h3 headingsapps/web/app/components/ThemeToggle.tsx: dark mode toggle (localStorage + system default)
New deps (minimal — only for UX):
rehype-slug(heading anchors for TOC links)github-slugger(matching slug algorithm for TOC client-side)
Gotchas (learned the hard way)
- tRPC fetch adapter expects input directly as JSON body, NOT JSON-RPC envelope
- requireWriteAuth compared
ctx.webhookSecret !== WEBHOOK_SECRET(module-level env constant) — untestable. Fixed:ctx.webhookSecret !== ctx.expectedSecret(injected per-app via deps). - Next.js catch-all routes:
[...slug]/edit/is INVALID (catch-all must be last). Used?edit=1query param instead. - Next.js App Router: PUT/DELETE on
/api/docs/route.tsdoesn't match/api/docs/{slug}— need dynamic route/api/docs/[...slug]/route.ts. @env.exampleshould be updated.ADMIN_PASSWORDmust be set in VPS.env(deployed separately).
Verification
- Typecheck: ✅ 4/4 apps green
- Tests: ✅ 40 tests green (32 original + 8 new), no DB/Redis
- Build: ✅ web compiled
- CI: ✅ success → Deploy: ✅ success
- Live: all 9 endpoints 200, 13 MCP tools live, CRUD e2e verified (login → create → view → delete via cookie auth), MCP create_document verified via header auth
- Test docs cleaned up (404 confirmed)
Commits
57f9001feat: Phase 11 — CRUD + auth + web UI1dd16ebfeat(web): Phase 11 UI/UX — TOC, dark mode toggle, /docs index98437cbfix(web): /api/docs accepts cookie OR header (not both required)8ed8c67fix(web): split PUT/DELETE into /api/docs/[...slug]/route.tsf8b525dchore: remove test docs