@imfelixyeung/git-swarm 0.1.2 → 0.3.0

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.
Files changed (4) hide show
  1. package/README.md +45 -14
  2. package/dist/cli.js +83 -18877
  3. package/dist/cli.js.map +162 -0
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -48,42 +48,73 @@ git swarm checkout feature/my-branch
48
48
  | `find-branch <branch>` | Search all repos for a branch by name |
49
49
  | `remote` | List remotes for each repo |
50
50
  | `exec <command...>` | Run an arbitrary shell command in every repo |
51
+ | `doctor` | Run diagnostics |
51
52
 
52
53
  ## Global Options
53
54
 
54
55
  <!-- prettier-ignore -->
55
56
  | Option | Description |
56
57
  |---|---|
57
- | `--where <query>` | Filter repos using a URL query-string syntax |
58
+ | `--where <expression>` | Filter repos using a JEXL expression |
58
59
  | `--parallel <count>` | Run operations in parallel (default: 1) |
60
+ | `--no-progress` | Disable the progress bar (defaults to enabled only when stdout is a TTY) |
59
61
 
60
62
  ### Filtering with `--where`
61
63
 
62
- Use `--where` to selectively target repos based on branch, clean/dirty state, or remote attributes:
64
+ Use `--where` to selectively target repos with a [JEXL](https://www.npmjs.com/package/jexl) expression evaluated against each repo's context:
63
65
 
64
66
  ```bash
65
67
  # Only repos on the main branch
66
- git swarm --where "branch=main" status
68
+ git swarm --where 'branch == "main"' status
67
69
 
68
70
  # Only dirty repos with a GitHub remote
69
- git swarm --where "clean=false&remote.provider=github" status
71
+ git swarm --where 'clean == false && remote.provider == "github"' status
70
72
 
71
73
  # Only repos owned by a specific user
72
- git swarm --where "remote.owner=imfelixyeung" pull
74
+ git swarm --where 'remote.owner == "imfelixyeung"' pull
75
+
76
+ # Only repos that are ahead of their upstream by at least 2 commits
77
+ git swarm --where 'ahead >= 2' push
78
+
79
+ # Only repos on a feature branch, not touching main
80
+ git swarm --where '"feature/" in branch && branch != "main"' status
81
+
82
+ # Only repos that have a branch named feature/cool
83
+ git swarm --where '"feature/cool" in branches' status
84
+
85
+ # Only repos with a tracking branch for origin/main
86
+ git swarm --where '"remotes/origin/main" in branches' status
87
+
88
+ # Only repos whose remote is hosted under github.com/imfelixyeung
89
+ git swarm --where 'remote.host == "github.com" && remote.owner == "imfelixyeung"' pull
73
90
  ```
74
91
 
75
- Available filter keys:
92
+ Available context fields:
76
93
 
77
94
  <!-- prettier-ignore -->
78
- | Key | Description |
95
+ | Field | Description |
79
96
  |---|---|
80
- | `branch` | Current branch name |
81
- | `clean` | Whether the working tree is clean (`true`/`false`) |
82
- | `remote.provider` | Remote provider (`github`, `gitlab`, `bitbucket`) |
83
- | `remote.owner` | Repository owner |
84
- | `remote.name` | Repository name |
97
+ | `name` | Repository directory name |
98
+ | `path` | Repository path relative to the swarm root |
99
+ | `branch` | Current branch name, or `null` when detached |
100
+ | `branches` | Names of all branches, including remote-tracking branches |
101
+ | `localBranches` | Names of all local branches |
102
+ | `detached` | Whether HEAD is detached |
103
+ | `clean` | Whether the working tree is clean |
104
+ | `stagedFiles` | Number of staged files |
105
+ | `modifiedFiles` | Number of modified files |
106
+ | `untrackedFiles` | Number of untracked files |
107
+ | `ahead` | Commits ahead of the upstream |
108
+ | `behind` | Commits behind the upstream |
109
+ | `hasUpstream` | Whether an upstream is configured |
110
+ | `remote.provider` | Remote host provider (`github`, `gitlab`, `bitbucket`, `other`, or `null`) |
85
111
  | `remote.host` | Remote host |
86
- | `remote.ref` | Full remote URL |
112
+ | `remote.owner` | Repository owner |
113
+ | `remote.repo` | Repository name |
114
+
115
+ The `remote.*` fields describe the `origin` remote when present, otherwise the first remote. Fields that require `git status` (branch, divergence, worktree counts, ...), the branch lists, and the `remote.*` fields are only fetched when the expression references them.
116
+
117
+ Use JEXL operators: `==`, `!=`, `<`, `<=`, `>`, `>=`, `&&`, `||`, `!`, and `in` for substring checks on strings (for example `'"issue" in branch'`) or membership checks on arrays (for example `'"feature/cool" in branches'`).
87
118
 
88
119
  ### Parallel Execution
89
120
 
@@ -111,7 +142,7 @@ git swarm exec "git clean -fd"
111
142
  git swarm fetch --prune
112
143
 
113
144
  # Only pull repos that are behind their upstream
114
- git swarm --where "branch=main&clean=true" pull
145
+ git swarm --where 'branch == "main" && clean' pull
115
146
  ```
116
147
 
117
148
  ## Development