You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ go run . -o json
51
51
### Core Flow
52
52
1.**Configuration Loading** (`internal/config`): Loads defaults → reads `~/.config/reposcan/config.toml` → applies CLI flags (in that order of precedence)
3.**Git State Checking** (`internal/gitx`): Concurrently checks each repo using a worker pool (`gitxConcurrent.go`) to gather branch, uncommitted files, ahead/behind counts
54
+
3.**VCS State Checking** (`internal/vcs`): Concurrently checks each repo using registered VCS providers to gather branch, uncommitted files, ahead/behind counts, and VCS-specific metadata
55
55
4.**Filtering** (`cmd/reposcan/rootCmd.go`): Applies `OnlyFilter` (all/dirty/uncommitted/unpushed/unpulled) to determine which repos to include in output
56
56
5.**Rendering** (`internal/render`): Outputs results in chosen format (stdout table/json, interactive TUI, or file output)
57
57
@@ -60,7 +60,9 @@ go run . -o json
60
60
-**`cmd/reposcan`**: CLI entry point, Cobra command setup, flag parsing, orchestration of the scan→filter→render pipeline
61
61
-**`internal/config`**: Configuration types, validation, defaults, TOML loading. The `Config` struct in `types.go` is the central configuration object
62
62
-**`internal/scan`**: Filesystem walking with `filepath.WalkDir`, directory ignore matching using `doublestar` globs, git repo detection
63
-
-**`internal/gitx`**: Git operations via `exec.Command`. `gitFunctions.go` wraps individual git commands (status, branch, rev-list). `gitxConcurrent.go` implements worker pool pattern for parallel repo checking
63
+
-**`internal/vcs`**: VCS provider registry, repository metadata, and worker pool for parallel repo state checking across supported VCS types
64
+
-**`internal/vcs/git`**: Git provider implementation and Git command wrappers for state checks, push, pull, and fetch operations
65
+
-**`internal/vcs/jj`**: Jujutsu provider implementation for detecting and checking jj repositories
64
66
-**`internal/render`**: Three render paths:
65
67
-`stdout`: Plain table (using `charmbracelet/lipgloss`) or JSON output
66
68
-`file`: Writes JSON reports to disk
@@ -75,10 +77,10 @@ Values are merged in this order (later overrides earlier):
75
77
3. CLI flags
76
78
77
79
### Concurrency Model
78
-
The `gitx.GetGitRepoStatesConcurrent` function uses a worker pool pattern:
80
+
The `vcs.GetRepoStatesConcurrent` function uses a worker pool pattern:
79
81
- Creates buffered channels for jobs and results
80
82
- Spawns `maxWorkers` goroutines (default: 8)
81
-
- Each worker pulls repo paths from the jobs channeland checks git state
83
+
- Each worker pulls discovered repositories from the jobs channel, resolves the matching VCS provider, and checks repo state
82
84
- Results are collected, sorted by path, and returned
83
85
84
86
### TUI Architecture (`internal/render/tui`)
@@ -106,7 +108,7 @@ The `filter` function in `rootCmd.go` applies `OnlyFilter` after all repos are d
106
108
`scan.FindGitRepos` collects warnings (e.g., permission denied) but continues walking. Warnings are included in `ScanReport.Warnings`.
107
109
108
110
### Git Command Wrapper
109
-
`gitx.RunGitCommand` uses `git -C <dir>` to run commands in a specific directory without changing the process's working directory. Stderr is captured but only used for error detection—stdout is returned.
111
+
`git.RunGitCommand` uses `git -C <dir>` to run commands in a specific directory without changing the process's working directory. Stderr is captured but only used for error detection—stdout is returned.
0 commit comments