@imfelixyeung/git-swarm 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -1
- package/dist/cli.js +12037 -7506
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
-
#
|
|
1
|
+
# git-swarm
|
|
2
2
|
|
|
3
3
|
Manage multiple Git repositories with ease.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install --global @imfelixyeung/git-swarm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Once installed, `git-swarm` is available as a Git subcommand:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git swarm [global options] <command> [options]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Navigate to a parent directory containing multiple Git repositories, then run any command. `git-swarm` automatically discovers all repos nested below the current directory.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# List all discovered repos
|
|
23
|
+
git swarm list
|
|
24
|
+
|
|
25
|
+
# Check the status of every repo
|
|
26
|
+
git swarm status
|
|
27
|
+
|
|
28
|
+
# Pull from remotes across all repos
|
|
29
|
+
git swarm pull
|
|
30
|
+
|
|
31
|
+
# Checkout a branch everywhere
|
|
32
|
+
git swarm checkout feature/my-branch
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
| Command | Description |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `list` | List all discovered Git repositories |
|
|
41
|
+
| `status` | Show working tree status for all repos |
|
|
42
|
+
| `pull [remote] [branch]` | Pull from remotes across all repos |
|
|
43
|
+
| `fetch [--prune]` | Fetch from remotes across all repos |
|
|
44
|
+
| `checkout <branch>` | Switch to a branch across all repos |
|
|
45
|
+
| `grep <pattern>` | Run `git grep` across all repos |
|
|
46
|
+
| `find-branch <branch>` | Search all repos for a branch by name |
|
|
47
|
+
| `remote` | List remotes for each repo |
|
|
48
|
+
| `exec <command...>` | Run an arbitrary shell command in every repo |
|
|
49
|
+
|
|
50
|
+
## Global Options
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
| Option | Description |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `--where <query>` | Filter repos using a URL query-string syntax |
|
|
56
|
+
| `--parallel <count>` | Run operations in parallel (default: 1) |
|
|
57
|
+
|
|
58
|
+
### Filtering with `--where`
|
|
59
|
+
|
|
60
|
+
Use `--where` to selectively target repos based on branch, clean/dirty state, or remote attributes:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Only repos on the main branch
|
|
64
|
+
git swarm --where "branch=main" status
|
|
65
|
+
|
|
66
|
+
# Only dirty repos with a GitHub remote
|
|
67
|
+
git swarm --where "clean=false&remote.provider=github" status
|
|
68
|
+
|
|
69
|
+
# Only repos owned by a specific user
|
|
70
|
+
git swarm --where "remote.owner=imfelixyeung" pull
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Available filter keys:
|
|
74
|
+
|
|
75
|
+
<!-- prettier-ignore -->
|
|
76
|
+
| Key | Description |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `branch` | Current branch name |
|
|
79
|
+
| `clean` | Whether the working tree is clean (`true`/`false`) |
|
|
80
|
+
| `remote.provider` | Remote provider (`github`, `gitlab`, `bitbucket`) |
|
|
81
|
+
| `remote.owner` | Repository owner |
|
|
82
|
+
| `remote.name` | Repository name |
|
|
83
|
+
| `remote.host` | Remote host |
|
|
84
|
+
| `remote.ref` | Full remote URL |
|
|
85
|
+
|
|
86
|
+
### Parallel Execution
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run fetch across 4 repos at a time
|
|
90
|
+
git swarm --parallel 4 fetch
|
|
91
|
+
|
|
92
|
+
# Run arbitrary commands in parallel
|
|
93
|
+
git swarm --parallel 8 exec "git reset --hard origin/main"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Find which repos have a specific branch
|
|
100
|
+
git swarm find-branch release/v2
|
|
101
|
+
|
|
102
|
+
# Search for a pattern across all repos
|
|
103
|
+
git swarm grep "TODO"
|
|
104
|
+
|
|
105
|
+
# Run a command in every repo
|
|
106
|
+
git swarm exec "git clean -fd"
|
|
107
|
+
|
|
108
|
+
# Fetch and prune stale remote-tracking branches
|
|
109
|
+
git swarm fetch --prune
|
|
110
|
+
|
|
111
|
+
# Only pull repos that are behind their upstream
|
|
112
|
+
git swarm --where "branch=main&clean=true" pull
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Install dependencies
|
|
119
|
+
bun install
|
|
120
|
+
|
|
121
|
+
# Build
|
|
122
|
+
bun run build
|
|
123
|
+
|
|
124
|
+
# Develop (build with watch mode)
|
|
125
|
+
bun run dev
|
|
126
|
+
|
|
127
|
+
# Typecheck
|
|
128
|
+
bun run typecheck
|
|
129
|
+
|
|
130
|
+
# Lint and format
|
|
131
|
+
bun run biome
|
|
132
|
+
|
|
133
|
+
# CI checks
|
|
134
|
+
bun run ci
|
|
135
|
+
|
|
136
|
+
# Test
|
|
137
|
+
bun test
|
|
138
|
+
```
|