Skip to content

Feature/git webui integration#245

Closed
mavnezz wants to merge 3 commits intoTimmoth:mainfrom
mavnezz:feature/git-webui-integration
Closed

Feature/git webui integration#245
mavnezz wants to merge 3 commits intoTimmoth:mainfrom
mavnezz:feature/git-webui-integration

Conversation

@mavnezz
Copy link
Contributor

@mavnezz mavnezz commented Mar 6, 2026

Summary

Closes #131

Adds a git status indicator and controls to the web UI header, allowing users to manage their configuration repository directly from the browser — including commit, diff, discard, push, pull, and remote setup.

Architecture

The git module follows Hexagonal Architecture / DDD / CQS / SRP principles:

  • Port: IGitRepository — thin interface for low-level repository access
  • Adapters: LibGit2GitRepository (server) / NullGitRepository (WASM viewer)
  • UseCases (commands): InitRepo, CommitAll, RestoreAll, Push, Pull, AddRemote
  • Queries (reads): GetStatus, GetBranch, GetDiff, GetChangedFiles, GetLog, GetSyncStatus

Uses LibGit2Sharp instead of CLI git — no git binary required in the container.

Features

  • Status indicator — green dot (clean) / amber pulsing dot (dirty) in the header
  • Save button — commits all changes with auto-generated message
  • Save dropdown — view diff (syntax-highlighted) or discard changes (with confirmation)
  • Branch display — shows current branch, clickable to open commit history modal
  • Sync button — manual fetch + push/pull with ahead/behind counters
  • Enable Git — initialize a git repo from the web UI (with confirmation dialog)
  • Add Remote — configure an HTTPS remote URL from the web UI
  • Token auth — supports GIT_TOKEN env var for private repos (Docker/CI friendly)
  • Polling — local status check every 5s (no remote fetch in polling loop)

Screenshots

TODO: Add screenshots of the different states

Configuration

For private repositories, pass a GitHub PAT via environment variable:

docker run -e GIT_TOKEN=ghp_... -p 8080:8080 rackpeek

mavnezz added 3 commits March 6, 2026 09:10
Add a minimal git integration to the web UI that shows the current
branch name, change status, and provides save/diff/discard/history
controls directly in the header.

- GitService wrapping git CLI for status, commit, diff, restore, log
- NullGitService for WASM Viewer where git is not available
- GitStatusIndicator component with auto-polling every 5s
- Branch name clickable to open commit history modal
- Save button with dropdown for diff view and discard
- Color-coded diff output and changed file listing
- Gracefully hidden when git is not installed or not a repo

Ref Timmoth#131
- Add push/pull support with automatic upstream tracking on first push
- Add separate Sync button for manual remote fetch (no auto-polling)
- Add diff viewer modal with color-coded output
- Add discard changes with confirmation prompt
- Add commit history modal via branch name click
- Split save dropdown (diff/discard) from sync dropdown (push/pull)
Replace CLI-based git implementation with LibGit2Sharp native library,
restructure the git module following hexagonal architecture, DDD, CQS
and SRP principles.

Architecture:
- Port: IGitRepository interface for low-level repository access
- Adapter: LibGit2GitRepository (libgit2sharp) and NullGitRepository (WASM)
- UseCases (commands): InitRepo, CommitAll, RestoreAll, Push, Pull, AddRemote
- Queries (reads): GetStatus, GetBranch, GetDiff, GetChangedFiles, GetLog, GetSyncStatus

Features:
- Git init via web UI with confirmation dialog
- Add HTTPS remote via web UI with URL validation (SSH not supported)
- Manual sync button with fetch, push and pull controls
- Sync status display (ahead/behind) with fetch error reporting
- Token-based auth via GIT_TOKEN environment variable for Docker/CI
- 5-second local status polling (no remote fetch in polling loop)

Removed:
- CLI-based GitService, IGitService and NullGitService
@Timmoth
Copy link
Owner

Timmoth commented Mar 7, 2026

Thank you for this contribution!

It looks awesome!! I'm going to just do some final cleanup / testing on this PR #249

Will let you know when it's merged on staging then would love it if you could help test / review.

@Timmoth Timmoth closed this Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Git Integration

2 participants