Skip to content

MarkJamesHoward/TGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

116 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TGit - Git Wrapper with Activity Tracking

CLI Tests

TGit is a CLI tool that wraps Git commands, passing them through to Git while sending activity tracking data to an API. It includes a real-time web dashboard to visualize team activity, with tenant isolation for multi-team support.

Who Benefits from TGit

  1. Single user on a single machine with multiple repositories
  • If you regularly switch between repos, TGit helps you stay tidy by showing repo state and recent activity.
  • This makes it easier to decide what to commit, what to clean up, and when to remove temporary/test branches.
  1. Single user across multiple machines
  • TGit provides the same visibility across your devices (for example, laptop and desktop).
  • Before changing files, you can see where work already happened, reducing duplicate work and merge conflicts.
  1. Teams in a company (including managers)
  • Developers can share a tenant and see who is working on what in real time.
  • Managers get a live, lightweight view of current team activity across repositories.

Project Structure

TGit/
β”œβ”€β”€ cli/                    # CLI application
β”‚   β”œβ”€β”€ Program.cs          # CLI wrapper entrypoint
β”‚   └── TGit.csproj         # .NET project file (CLI)
β”œβ”€β”€ api/                    # ASP.NET Core Web API
β”‚   β”œβ”€β”€ Controllers/        # API endpoints
β”‚   β”œβ”€β”€ Services/           # Storage services (JSON, SQL)
β”‚   β”œβ”€β”€ Models/             # Data models
β”‚   └── TGitApi.csproj
β”œβ”€β”€ dashboard/              # Astro.js static web dashboard
β”‚   β”œβ”€β”€ src/pages/          # Dashboard UI
β”‚   └── package.json
β”œβ”€β”€ winget/                 # Winget package manifests
└── .github/workflows/     # CI/CD
    β”œβ”€β”€ release.yml         # CLI release (tag-triggered)
    β”œβ”€β”€ azure-api-deploy.yml    # API deploy to Azure App Service
    └── dashboard.yml       # Dashboard deploy to Azure Static Web App

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     POST /api/GitActivity     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  tgit   β”‚ ──────────────────────────────>β”‚   API       β”‚
β”‚  CLI    β”‚                                β”‚  (Azure     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                β”‚  App Svc)   β”‚
                                           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  GET /api/Users                   β”‚
β”‚  Dashboard  β”‚ <β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  (Azure     β”‚   (polls every 2 seconds)
β”‚  Static App)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • CLI (tgit) β€” wraps git commands, sends activity data to the API
  • API (tgit-api.azurewebsites.net) β€” ASP.NET Core API, stores data in JSON files or Azure SQL
  • Dashboard (tgit.app) β€” Astro site, polls the API and displays team activity

Installation

CLI Tool

Install via winget (recommended)

winget install MarkJamesHoward.TGit

Or build and install manually

cd TGit/cli
dotnet pack -c Release -o ../nupkg
dotnet tool install --global --add-source ../nupkg TGit

Usage

Use tgit exactly like you would use git:

tgit status
tgit add .
tgit commit -m "Your message"
tgit push

TGit Commands

tgit --config                    Show current configuration
tgit --config tenant             Show current tenant ID
tgit --config tenant <name>      Set tenant ID for data isolation
tgit --clear                   Delete all tracking data for your tenant
tgit --help                    Show help message
tgit --version                 Show version information

Tenant Configuration

Each TGit installation gets a unique tenant ID on first run. All users sharing the same tenant ID can see each other's activity on the dashboard.

# Set a shared tenant for your team
tgit --config tenant mycompany

# View your current tenant
tgit --config tenant

Clearing Data

To delete all tracked data for your tenant:

tgit --clear

Tracked Commands

The following git commands trigger activity tracking: status, add, commit, checkout, switch, restore, reset, merge, rebase, cherry-pick, revert, stash, pull, push, fetch, clone

Configuration

Environment Variables

CLI (used by the tgit command):

Variable Description Default
TGIT_CLI_API_URL Base URL of the API (the CLI appends /api/GitActivity) https://tgit-api.azurewebsites.net
TGIT_TENANT Override tenant ID (takes precedence over config) Auto-generated
TGIT_DEBUG Set to 1 to enable verbose debug output Not set

Dashboard (used at build time by the Astro dashboard):

Variable Description Default
PUBLIC_TGIT_DASHBOARD_API_URL Base URL of the API (the dashboard appends /api/users) https://tgit-api.azurewebsites.net

Dashboard

View your team's activity at tgit.app. Enter your tenant ID to see activity for your team.

The dashboard polls the API every 2 seconds and shows:

  • Active users and their current branches
  • Modified files per repository
  • Time since last activity

API Endpoints

Method Endpoint Description
POST /api/GitActivity Record git activity
DELETE /api/GitActivity?tenant=xxx Delete all data for a tenant
GET /api/Users?tenant=xxx Get all users for a tenant
GET /api/Users?tenant=xxx&active=true Get active users only
GET /swagger Swagger UI

Activity Payload

{
  "timestamp": "2026-01-30T12:00:00Z",
  "userName": "John Doe",
  "userEmail": "john@example.com",
  "repoName": "my-project",
  "branch": "main",
  "remoteUrl": "https://github.com/user/my-project.git",
  "modifiedFiles": [
    {
      "filePath": "src/file.cs",
      "status": "Modified",
      "isStaged": true
    }
  ],
  "machineName": "DESKTOP-ABC123",
  "tenant": "mycompany"
}

Local Development

To run the full stack locally (CLI β†’ API β†’ Dashboard):

1. Start the API

The API uses JSON file storage by default (api/appsettings.json has Storage:Type set to json). In production, the Azure app setting Storage__DataDir overrides the data directory to /home/data for persistence across redeploys. Locally, data is stored in api/data/.

Start the API:

cd api
dotnet run

The API will start on http://localhost:5000.

To use Azure SQL locally instead of JSON, change Storage:Type to sql in api/appsettings.json (requires Azure AD credentials configured).

2. Point the CLI at the local API

$env:TGIT_CLI_API_URL = "http://localhost:5000"
tgit status

Or to run the CLI from source (without installing via NuGet):

dotnet run --project cli -- status

3. Start the Dashboard

$env:PUBLIC_TGIT_DASHBOARD_API_URL = "http://localhost:5000"
cd dashboard
npm run dev

The dashboard will start on http://localhost:4321 and fetch data from your local API.

Debugging

Enable debug output for the CLI:

$env:TGIT_DEBUG = "1"
tgit status

This shows the HTTP request/response details. Tracking errors (non-200 responses, timeouts, connection failures) are always shown on stderr even without debug mode.

Deployment

API (Azure App Service)

Deployed automatically via GitHub Actions when files in api/ change on main.

App Settings:

Setting Description
Storage__Type json (default) or sql
Storage__DataDir Path for JSON storage (use /home/data for persistence on Azure)
Sql__ConnectionString Azure SQL connection string (when using SQL storage)

Dashboard (Azure Static Web App)

Deployed automatically via GitHub Actions when files in dashboard/ change on main.

Build-time environment variable:

  • PUBLIC_TGIT_DASHBOARD_API_URL β€” the API base URL (e.g., https://tgit-api.azurewebsites.net)

CLI Release

Tag a version to trigger a release:

git tag v1.4.0
git push origin v1.4.0

This builds win-x64 and win-arm64 binaries, creates a GitHub release, and submits to winget.

Terraform (Azure)

For Terraform in Docker, set these values in .terraform/azure_secrets.txt:

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_TENANT_ID
  • ARM_SUBSCRIPTION_ID

Then run the commands in .terraform/docker run details.txt to execute init, validate, plan, and apply with --env-file.

About

Provides overview of your pending Git modifications across machines and repos

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors