Commit Graph

18 Commits

  • feat: add projects page route and navigation link
    - Add GET /projects route in server.js with authentication check
    - Serve projects.html when authenticated, redirect to login otherwise
    - Add navigation header to both landing page and projects page
    - Include Sessions, Projects navigation links with active state styling
    - Add logout button to navigation header
    - Style navigation with dark theme matching existing design
    - Make navigation responsive for mobile devices
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add database migration script for projects
    Add migration script to backfill existing sessions into projects:
    - Scans session files from Claude Sessions directory
    - Extracts unique project names from metadata.project field
    - Creates projects with random icons and colors
    - Links sessions to their respective projects in database
    - Provides detailed progress reporting and summary
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add session context menu for project reassignment
    Implemented smart suggestions UI with visual indicators for moving sessions between projects.
    
    Features:
    - Right-click context menu on session rows
    - Fetches smart project suggestions from API
    - Displays top 3 suggestions with match scores and reasons
    - Visual indicators: 🎯 (90+), 📂 (50-89), 💡 (10-49)
    - "Open in IDE" option for quick navigation
    - "Show All Projects" modal for full project list
    - "Move to Unassigned" to remove project association
    - Smooth animations and hover effects
    - Click outside to close menu
    - Responsive design for mobile devices
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: group sessions by project on landing page
    - Add loadSessionsAndProjects() to fetch sessions and projects in parallel
    - Store projects in window.projectsMap for quick lookup
    - Group sessions by projectId, separating assigned and unassigned
    - Render collapsible project sections with icon, name, and session count
    - Add toggleProjectSection() to collapse/expand sections (▼/▶)
    - Display project badges on sessions when assigned to a project
    - Unassigned sessions shown in separate section at bottom
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add projects page JavaScript functionality
    Implement complete JavaScript functionality for the projects management page:
    
    - State management for projects array and current editing project
    - loadProjects() - Fetch projects from /api/projects
    - renderProjects(filter) - Render project cards with search/filter support
    - setupEventListeners() - Wire up all interactive elements
    - openProject(projectId) - Navigate to sessions page for selected project
    - openProjectModal(project) - Open modal for create/edit operations
    - closeProjectModal() - Close modal and reset form
    - handleProjectSubmit(e) - Validate and save project data
    - showProjectMenu(projectId, event) - Display context menu
    - deleteProject(projectId) - Soft delete with confirmation
    - openRecycleBinModal() - Display deleted projects
    - restoreProject(projectId) - Restore from recycle bin
    - permanentDeleteProject(projectId) - Delete forever with confirmation
    - escapeHtml(text) - XSS prevention for user-generated content
    - formatDate(dateString) - Human-readable relative timestamps
    - showToast(message, type) - Toast notifications with animations
    
    Features:
    - Async/await for all API calls
    - Comprehensive error handling
    - Real-time search filtering
    - Context menu for project actions
    - Responsive modal system
    - Toast notifications for user feedback
    - Keyboard shortcuts (Escape to close)
    - Click outside to close menus/modals
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add projects page styles
    Add comprehensive CSS styles for the projects management page including:
    - Page layout with responsive header
    - Projects grid with auto-fill layout (300px min cards)
    - Project cards with hover effects and stats
    - Modal styles for create/edit and recycle bin
    - Form elements with proper styling
    - Button styles (primary/secondary)
    - Context menu for card actions
    - Recycle bin items with restore/delete actions
    - Empty state styling
    - Responsive design for mobile devices
    - Scrollbar styling
    
    Uses CSS variables from existing style.css for consistency.
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add smart project suggestions endpoint
    Added GET /api/projects/suggestions endpoint that provides intelligent
    project suggestions based on session context. The endpoint:
    
    - Takes sessionId as a required query parameter
    - Retrieves session from in-memory or historical sessions
    - Calculates scores for each project using multiple criteria:
      * Directory match (90 points): session workingDir === project path
      * Subdirectory match (50 points): session workingDir starts with project path
      * Used today (20 points): project lastActivity < 1 day ago
      * Used this week (10 points): project lastActivity < 7 days ago
      * Name similarity (15 points): overlap between session dir name and project name
    
    - Returns top 3 scored suggestions with reasons
    - Also returns all projects sorted alphabetically
    - Filters out projects with zero scores from suggestions
    - Handles missing sessions with appropriate error responses
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • fix: correct route path, fix race condition, add persistence for active sessions
    - Fix route path from /api/sessions/:id/move to /claude/api/claude/sessions/:id/move
    - Fix race condition by fetching session once and storing isActiveSession flag
    - Add database persistence for active session metadata changes
    - Ensures consistency between in-memory and database state
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add session move endpoint and project-session cascading delete
    - Add sessions table to database with projectId and deletedAt columns
    - Create POST /api/sessions/:id/move endpoint to reassign sessions
    - Update DELETE /api/projects/:id to cascade soft-delete to sessions
    - Support moving sessions between projects or to unassigned state
    - Handle both active (in-memory) and historical sessions
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add soft delete, restore, permanent delete, and recycle bin endpoints
    - Add DELETE /api/projects/:id - Soft delete project (sets deletedAt)
    - Add POST /api/projects/:id/restore - Restore from recycle bin
    - Add DELETE /api/projects/:id/permanent - Permanent delete
    - Add GET /api/recycle-bin - List deleted items sorted by deletedAt DESC
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • fix: add input validation and fix unique constraint
    Fixed code quality issues from Task 2 review:
    
    1. Added ID validation in PUT endpoint:
       - Validates req.params.id is a valid positive integer
       - Returns 400 for invalid IDs (non-numeric, negative, zero, decimals)
       - Prevents SQL injection attempts
    
    2. Added path validation in POST and PUT endpoints:
       - Validates projectPath is absolute path
       - Normalizes and resolves paths
       - Detects and blocks path traversal attempts (e.g., ../../../etc)
       - Returns 400 for invalid paths
    
    3. Fixed UNIQUE constraint in database schema:
       - Removed UNIQUE constraint from name column
       - Allows creating projects with same name as deleted projects
       - Application-level duplicate checking remains for active projects
       - Added table migration to drop and recreate schema
    
    Files modified:
    - server.js: Added validateProjectId() and validateProjectPath() helpers
    - services/database.js: Removed UNIQUE constraint, added migration
    
    All validation tested and working correctly.
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add project CRUD API endpoints (SQLite)
    Added three new API endpoints for managing projects using SQLite:
    
    - GET /api/projects - Lists all active projects (deletedAt IS NULL)
      * Sorts by lastActivity DESC
      * Returns id, name, description, icon, color, path, sessionCount, createdAt, lastActivity
    
    - POST /api/projects - Creates new project
      * Required fields: name, path
      * Optional fields: description, icon (default '📁'), color (default '#4a9eff')
      * Validates required fields and checks for duplicate names
      * Returns 201 status on success
    
    - PUT /api/projects/:id - Updates existing project
      * Allows updating: name, description, icon, color, path
      * Only updates projects where deletedAt IS NULL
      * Returns 404 if project not found
      * Validates duplicate names on name change
    
    All endpoints use synchronous better-sqlite3 API with parameterized queries.
    SessionCount set to 0 for now (will be implemented in Task 3).
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • feat: add SQLite database and projects table schema
    - Install better-sqlite3 package for persistent storage
    - Create database service with projects table schema
    - Add indexes on deletedAt and name for efficient queries
    - Support soft-delete with deletedAt timestamp
    - Export database instance for use in server.js
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  • Initial commit: Obsidian Web Interface for Claude Code
    - Full IDE with terminal integration using xterm.js
    - Session management with local and web sessions
    - HTML preview functionality
    - Multi-terminal support with session picker
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>