Files
stack/MINDMAP_MIGRATION.md
Jason Woltje d54714ea06 feat: add chat components from jarvis frontend
- Migrated Chat.tsx with message handling and UI structure
- Migrated ChatInput.tsx with character limits and keyboard shortcuts
- Migrated MessageList.tsx with thinking/reasoning display
- Migrated ConversationSidebar.tsx (simplified placeholder)
- Migrated BackendStatusBanner.tsx (simplified placeholder)
- Created components/chat/index.ts barrel export
- Created app/chat/page.tsx placeholder route

These components are adapted from jarvis-fe but not yet fully functional:
- API calls placeholder (need to wire up /api/brain/query)
- Auth hooks stubbed (need useAuth implementation)
- Project/conversation hooks stubbed (need implementation)
- Imports changed from @jarvis/* to @mosaic/*

Next steps:
- Implement missing hooks (useAuth, useProjects, useConversations, useApi)
- Wire up backend API endpoints
- Add proper TypeScript types
- Implement full conversation management
2026-01-29 21:47:00 -06:00

119 lines
3.5 KiB
Markdown

# Mindmap Components Migration - Phase 3
**Status:** ✅ Complete (with notes)
**Commit:** `aa267b5` - "feat: add mindmap components from jarvis frontend"
**Branch:** `feature/jarvis-fe-migration`
## Completed Tasks
### 1. ✅ Directory Structure Created
```
apps/web/src/components/mindmap/
├── controls/
│ ├── ExportButton.tsx
│ └── NodeCreateModal.tsx
├── hooks/
│ └── useGraphData.ts
├── nodes/
│ ├── BaseNode.tsx
│ ├── ConceptNode.tsx
│ ├── IdeaNode.tsx
│ ├── ProjectNode.tsx
│ └── TaskNode.tsx
├── index.ts
├── MermaidViewer.tsx
├── MindmapViewer.tsx
└── ReactFlowEditor.tsx
```
### 2. ✅ Components Copied
All mindmap components have been successfully migrated:
- **Main viewers:** ReactFlowEditor, MindmapViewer, MermaidViewer
- **Node types:** BaseNode, ConceptNode, TaskNode, IdeaNode, ProjectNode
- **Controls:** NodeCreateModal, ExportButton
- **Hooks:** useGraphData (with KnowledgeNode, KnowledgeEdge types)
### 3. ✅ Barrel Export Created
`components/mindmap/index.ts` exports all components and types for clean imports
### 4. ✅ Route Created
- Created `/mindmap` page at `apps/web/src/app/mindmap/page.tsx`
- Includes proper metadata and layout
### 5. ✅ Dependencies Added
- Copied `lib/auth-client.ts` (BetterAuth integration)
- Created `lib/api.ts` (session management utilities)
## Import Updates
No `@jarvis/*` imports were present in the mindmap components - they were already using relative paths and `@/lib/*` aliases, which are compatible with the Mosaic structure.
## Type Adaptations
The mindmap uses its own `KnowledgeNode` and `KnowledgeEdge` types, which are specific to the knowledge graph feature and not part of the general Mosaic entity types (Task, Project, etc. from `@mosaic/shared`). This is correct as the mindmap represents a different data model.
## Known Issues & Next Steps
### Missing Package Dependencies
The build currently fails due to missing packages required by `auth-client.ts`:
```
better-auth
better-auth/react
better-auth-credentials-plugin
better-auth-credentials-plugin/client
```
**Resolution:** These packages need to be added to the workspace:
```bash
pnpm add better-auth better-auth-credentials-plugin
```
### ReactFlow Dependencies
Verify that `@xyflow/react` is installed:
```bash
pnpm add @xyflow/react
```
### Mermaid Dependency
Verify that `mermaid` is installed:
```bash
pnpm add mermaid
```
## Testing Checklist
Once dependencies are installed:
- [ ] Build completes without errors
- [ ] Navigate to `/mindmap` route
- [ ] Create a knowledge node
- [ ] Verify ReactFlow interactive editor renders
- [ ] Test Mermaid diagram view
- [ ] Test export functionality
- [ ] Verify node type rendering (Concept, Task, Idea, Project)
## API Integration
The mindmap components expect a backend knowledge graph API at:
- Base URL: `process.env.NEXT_PUBLIC_API_URL` (default: http://localhost:8000)
- Endpoints:
- `GET /api/v1/knowledge/graph` - Fetch graph data
- `GET /api/v1/knowledge/mermaid` - Fetch Mermaid diagram
- `POST /api/v1/knowledge/nodes` - Create node
- `PUT /api/v1/knowledge/nodes/:id` - Update node
- `DELETE /api/v1/knowledge/nodes/:id` - Delete node
- `POST /api/v1/knowledge/edges` - Create edge
- `DELETE /api/v1/knowledge/edges` - Delete edge
- `GET /api/v1/knowledge/graph/statistics` - Get statistics
## Files Changed
- 15 files added
- 1,758 insertions
- No deletions
## Git Info
```
Branch: feature/jarvis-fe-migration
Commit: aa267b5
Pushed: Yes
```