# Repository Workspace - Tasks ## Phase 1: Backend File APIs - [x] **Task 1.1**: Create git file utilities - Create `src/utils/git_files.py` - `list_tree()` - list files in directory using `git ls-tree` - `get_file_content()` - get file content using `git show` - `list_branches()` - list branches using `git branch` - `commit_file()` - commit file changes using `git add` + `git commit` - Add tests - [x] **Task 1.2**: Add file listing endpoint - Add `GET /projects/{id}/repositories/{id}/files` to git_repositories.py - Query params: branch, path - Returns FileTreeEntry list - Handle errors (missing branch, missing path) - [x] **Task 1.3**: Add file content endpoint - Add `GET /projects/{id}/repositories/{id}/files/content` to git_repositories.py - Query params: branch, path - Returns FileContent with language detection - Detect binary files - [x] **Task 1.4**: Add branches endpoint - Add `GET /projects/{id}/repositories/{id}/branches` to git_repositories.py - Returns branch list with default branch marked - [x] **Task 1.5**: Add file update endpoint - Add `POST /projects/{id}/repositories/{id}/files/content` to git_repositories.py - Body: path, branch, content, commit_message, author info - Create commit with changes - Return commit hash ## Phase 2: Project List Navigation - [x] **Task 2.1**: Make project list clickable - Update ProjectsPage to link to workspace - Route: `/projects/:projectId` - Remove placeholder, use workspace - [x] **Task 2.2**: Update app navigation - Ensure project routes are correct - Add breadcrumb or back button ## Phase 3: Workspace Page Shell - [x] **Task 3.1**: Create RepoWorkspace page - Create `pages/repo-workspace.tsx` - Layout: Sidebar + Main Content - Fetch project repos on load - Select first repo by default - [x] **Task 3.2**: Create RepoSelector component - Dropdown to switch between project repos - Show active repo name - Update URL when switching - [x] **Task 3.3**: Create BranchSelector component - Dropdown to switch branches - Show active branch - Mark default branch - Fetch branches from API ## Phase 4: File Browser - [x] **Task 4.1**: Create FileTree component - Recursive tree view - Expandable/collapsible folders - File icons by extension - Click to open file - Active file highlight - Fetch tree data from API - [x] **Task 4.2**: Add file tree loading - Load root on repo/branch change - Lazy load subdirectories - Show loading state ## Phase 5: File Viewer - [x] **Task 5.1**: Create FileViewer component - Display file content - Line numbers - Syntax highlighting (prismjs or similar) - Breadcrumb navigation - Show file metadata (size, last commit) - [x] **Task 5.2**: Add edit mode - Toggle between view/edit - Textarea for editing - Save button (calls update API) - Cancel button - Commit message input ## Phase 6: Integration & Polish - [x] **Task 6.1**: Sync URL state - Repo ID in URL - Branch in URL - Path in URL - Parse on load, update on change - [x] **Task 6.2**: Add error handling - Repo not found - Branch not found - File not found - Binary files - Network errors - [x] **Task 6.3**: Add CSS styles - Workspace layout - File tree styles - File viewer styles - Sidebar styles - Responsive design - [x] **Task 6.4**: Run quality gates - Backend: ruff, mypy, pytest - Frontend: typecheck, lint, build ## Phase 7: Route Updates - [x] **Task 7.1**: Update router - `/projects/:projectId` → RepoWorkspace (default) - Move old project details to `/projects/:projectId/details` or remove - Keep `/projects/:projectId/repositories` for repo management - [x] **Task 7.2**: Update navigation - Project list links to workspace - Add "Manage Repositories" link in workspace