Minimal repo browser UI (README + file list) (SZ-82)
rk@tigase.net opened 6 days ago

Description: Expose a simple Git file browser for each project, allowing the user to:

  • • View the repo tree (top-level for now)
  • • Read the contents of README.md or similar
  • • Access this via a “View Repo” button or tab in the Project UI

This will:

  • • Add a new API endpoint to list files and read file contents
  • • Add a minimal UI panel in the Project page to render files (like README)

Acceptance Criteria:

  • • Each project has a basic “Repo” section showing top-level files
  • • Clicking a file shows its contents (read-only)
  • • README renders as markdown (if exists)
  • rk@tigase.net commented 6 days ago

    Subtasks:

    • • Backend: GET /api/projects/{id}/repo/files → List files
    • • Backend: GET /api/projects/{id}/repo/file?path=README.md → File contents
    • • Frontend: Add repo tab or inline section in ProjectDetails
    • • Render README contents in a Markdown viewer (if present)
    • • Fallback message if repo is empty
  • rk@tigase.net commented 3 days ago

    Repo Browser (JGit-based): Detailed Work Estimate

    Release: 1.9
    Feature: Project-level Git repository browser (read-only)
    Backend: JGit
    UI: Minimal, project-scoped browser
    Total Estimate: 8 hours


    Scope Reminder (Baseline)

    • Default branch only
    • Snapshot at HEAD
    • Read-only
    • Directory listing + raw text file view
    • No syntax highlighting
    • No diffs, history, blame, or branch switching

    This estimate assumes the current JGit-based controller implementation as the starting point.


    Detailed Work Breakdown

    1. Backend Hardening & Refinement (2.0 hours)

    Objective: Make the existing JGit controller production-safe for 1.9.

    • Normalize branch resolution logic
      • Handle refs/heads/* vs symbolic refs
      • Clear error semantics when branch not found
    • Guardrails
      • File size limits for /contents/raw
      • Binary file detection (fail fast)
    • Path handling
      • Prevent path traversal edge cases
      • Clean handling of root vs subdirectory paths
    • Logging & error mapping
      • Map JGit exceptions → HTTP responses
      • Add minimal structured logs

    Estimate: 2.0h


    2. JGit Backend Unit Tests (3.0 hours)

    Objective: Add focused unit tests validating Git traversal logic.

    • Test setup
      • Create temporary Git repositories in tests
      • Programmatically commit files and directories using JGit
    • Test cases
      • List root directory contents
      • Navigate into subdirectories
      • Fetch raw file content
      • Missing file / missing path
      • Invalid branch
    • Infrastructure
      • Temp directory cleanup
      • Isolate test repositories per test

    Notes:

    • Tests target Git logic, not HTTP wiring
    • Use lightweight JUnit + JGit, no Spring context where avoidable

    Estimate: 3.0h


    3. REST API Wiring & Validation (1.0 hour)

    Objective: Ensure controller behavior is predictable and stable.

    • Validate request parameters (path, branch)
    • Confirm default-branch fallback logic
    • Ensure correct HTTP status codes:
      • 200 OK
      • 404 Not Found
      • 400 Bad Request (where applicable)
    • Add minimal controller-level tests if needed

    Estimate: 1.0h


    4. Frontend: Minimal Repo Browser UI (1.5 hours)

    Objective: Provide a clean, usable repo browser without UI excess.

    • Add “Repository” tab / button in Project view
    • Directory listing view
      • Files vs directories
      • Click to navigate
    • File viewer
      • Monospace text
      • Scrollable container
    • Basic error display

    Estimate: 1.5h


    5. Integration, Manual Testing & Polish (0.5 hours)

    Objective: Validate end-to-end flow and remove rough edges.

    • Manual testing on a real project repo
    • Verify branch defaults
    • Check large file and error behavior
    • Minor UI polish (spacing, labels)

    Estimate: 0.5h


    Summary

    AreaTime
    Backend hardening2.0h
    JGit unit tests3.0h
    REST validation1.0h
    Frontend minimal UI1.5h
    Integration & polish0.5h
    Total8h

    Rationale for 8h Estimate

    • Core JGit logic already exists
    • Risk profile is low
    • Unit tests are the main remaining “real work”
    • UI is intentionally minimal

    This estimate reflects implementation, not exploration.


  • rk@tigase.net commented 3 days ago
    rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout wolnosc
    Switched to branch 'wolnosc'
    Your branch is up to date with 'origin/wolnosc'.
    rksuma@Ramakrishnans-MacBook-Pro sztab % git pull --rebase
    Already up to date.
    rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout -b feature/repo-browser-jgit
    Switched to a new branch 'feature/repo-browser-jgit'
    rksuma@Ramakrishnans-MacBook-Pro sztab %
    
  • rk@tigase.net changed state to 'In Progress' 3 days ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 3 days ago
issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Version
none
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-82
Please wait...
Page is in error, reload to recover