Skip to content

Commit 751e12f

Browse files
committed
Initial commit: git-scope MVP - TUI for managing git repos
0 parents  commit 751e12f

File tree

21 files changed

+3080
-0
lines changed

21 files changed

+3080
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Binaries
2+
/dist
3+
/build
4+
/bin
5+
/git-scope
6+
7+
# Logs and temp files
8+
*.log
9+
*.tmp
10+
*.swp
11+
*~
12+
13+
# Cache
14+
.git-scope-cache.json
15+
16+
# IDE
17+
.idea/
18+
.vscode/
19+
*.iml
20+
21+
# OS
22+
.DS_Store
23+
Thumbs.db

README.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# git-scope
2+
3+
> A fast TUI to see the status of all git repositories on your machine.
4+
5+
![Status](https://img.shields.io/badge/status-MVP-blue)
6+
![Go Version](https://img.shields.io/badge/go-1.22-00ADD8)
7+
8+
## Overview
9+
10+
**git-scope** is a terminal-based dashboard that helps you manage multiple git repositories. It scans your configured directories, shows you which repos have uncommitted changes, and lets you jump into your editor with a single keystroke.
11+
12+
### Features
13+
14+
- 🔍 **Scan** configured directories for git repos
15+
- 📊 **Dashboard** showing branch, dirty files, and last commit
16+
- ⌨️ **Keyboard-driven** navigation
17+
- 🚀 **Jump** into your editor from the TUI
18+
-**Fast** concurrent scanning with goroutines
19+
20+
## Installation
21+
22+
### From Source
23+
24+
```bash
25+
go install github.com/bharath/git-scope/cmd/git-scope@latest
26+
```
27+
28+
Or clone and build:
29+
30+
```bash
31+
git clone https://github.com/bharath/git-scope.git
32+
cd git-scope
33+
go build -o git-scope ./cmd/git-scope
34+
```
35+
36+
## Usage
37+
38+
### Launch TUI Dashboard
39+
40+
```bash
41+
git-scope
42+
# or
43+
git-scope tui
44+
```
45+
46+
### Scan and Output JSON
47+
48+
```bash
49+
git-scope scan
50+
```
51+
52+
### Configuration
53+
54+
Create a config file at `~/.config/git-scope/config.yml`:
55+
56+
```yaml
57+
# Directories to scan for git repos
58+
roots:
59+
- ~/code
60+
- ~/projects
61+
- ~/work
62+
63+
# Directories to ignore
64+
ignore:
65+
- node_modules
66+
- .next
67+
- dist
68+
- build
69+
- target
70+
- .venv
71+
- vendor
72+
73+
# Editor to open repos (default: code)
74+
editor: code
75+
```
76+
77+
## Keyboard Shortcuts
78+
79+
| Key | Action |
80+
|-----|--------|
81+
| `↑/↓` or `j/k` | Navigate repos |
82+
| `Enter` | Open repo in editor |
83+
| `r` | Rescan directories |
84+
| `q` | Quit |
85+
86+
## Dashboard Columns
87+
88+
| Column | Description |
89+
|--------|-------------|
90+
| Repo | Repository name |
91+
| Path | File path (truncated) |
92+
| Branch | Current branch |
93+
| Stg | Staged file count |
94+
| Unst | Unstaged file count |
95+
| Untrk | Untracked file count |
96+
| Last Commit | Last commit timestamp |
97+
98+
## Roadmap
99+
100+
- [ ] Caching for faster startup
101+
- [ ] Fuzzy search filter
102+
- [ ] Sort by different columns
103+
- [ ] Quick actions (pull, push)
104+
- [ ] Background file watcher
105+
106+
## Tech Stack
107+
108+
- **Go** - Fast, compiled binary
109+
- **Bubbletea** - TUI framework
110+
- **Lipgloss** - Terminal styling
111+
- **Bubbles** - TUI components
112+
113+
## License
114+
115+
MIT

cmd/git-scope/main.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"log"
7+
"os"
8+
9+
"github.com/bharath/git-scope/internal/config"
10+
"github.com/bharath/git-scope/internal/scan"
11+
"github.com/bharath/git-scope/internal/tui"
12+
)
13+
14+
const version = "0.1.0"
15+
16+
func usage() {
17+
fmt.Fprintf(os.Stderr, `git-scope v%s — A fast TUI to see the status of all git repositories
18+
19+
Usage:
20+
git-scope [command]
21+
22+
Commands:
23+
(default) Launch TUI dashboard
24+
scan Scan configured roots and print repos (JSON)
25+
tui Launch TUI dashboard (same as default)
26+
help Show this help
27+
28+
Flags:
29+
`, version)
30+
flag.PrintDefaults()
31+
}
32+
33+
func main() {
34+
flag.Usage = usage
35+
configPath := flag.String("config", config.DefaultConfigPath(), "Path to config file")
36+
flag.Parse()
37+
38+
// Default command is "tui" if no args provided
39+
cmd := "tui"
40+
if flag.NArg() >= 1 {
41+
cmd = flag.Arg(0)
42+
}
43+
44+
// Handle help early
45+
if cmd == "help" || cmd == "-h" || cmd == "--help" {
46+
usage()
47+
return
48+
}
49+
50+
// Load configuration
51+
cfg, err := config.Load(*configPath)
52+
if err != nil {
53+
log.Fatalf("failed to load config: %v", err)
54+
}
55+
56+
switch cmd {
57+
case "scan":
58+
repos, err := scan.ScanRoots(cfg.Roots, cfg.Ignore)
59+
if err != nil {
60+
log.Fatalf("scan error: %v", err)
61+
}
62+
if err := scan.PrintJSON(os.Stdout, repos); err != nil {
63+
log.Fatalf("print error: %v", err)
64+
}
65+
66+
case "tui", "":
67+
if err := tui.Run(cfg); err != nil {
68+
log.Fatalf("tui error: %v", err)
69+
}
70+
71+
default:
72+
fmt.Fprintf(os.Stderr, "unknown command: %s\n\n", cmd)
73+
usage()
74+
os.Exit(1)
75+
}
76+
}

configs/config.example.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Git-Scope Configuration
2+
# Copy this file to ~/.config/git-scope/config.yml
3+
4+
# Root directories to scan for git repositories
5+
roots:
6+
- ~/code
7+
- ~/projects
8+
9+
# Directories to ignore during scanning
10+
ignore:
11+
- node_modules
12+
- .next
13+
- dist
14+
- build
15+
- target
16+
- .venv
17+
- vendor
18+
19+
# Editor to open repos in (default: code)
20+
# Options: code, idea, nvim, vim, etc.
21+
editor: code

0 commit comments

Comments
 (0)