|
13 | 13 | - **Transparent wrapper**: Alias `brewlock` to `brew` and use Homebrew normally |
14 | 14 | - **Automatic version tracking**: Every install/uninstall/upgrade updates `brew.lock` |
15 | 15 | - **Version-locked bundle install**: Install packages with version verification |
16 | | -- **Full package support**: Tracks formulae, casks, taps, and Mac App Store apps |
| 16 | +- **Full package support**: Tracks formulae, casks, taps (with commit SHAs), and Mac App Store apps |
| 17 | +- **JSONC format**: Human-readable lock file with comment support |
| 18 | +- **Custom tap URLs**: Tracks custom tap repository URLs for reproducibility |
17 | 19 |
|
18 | 20 | ## Installation |
19 | 21 |
|
@@ -136,22 +138,104 @@ export BREWLOCK=/path/to/your/brew.lock |
136 | 138 | export BREWLOCK="$HOME/dotfiles/brew.lock" |
137 | 139 | ``` |
138 | 140 |
|
139 | | -The lock file uses standard Brewfile syntax with added version information: |
| 141 | +The lock file uses JSONC (JSON with Comments) format, organized by package type: |
| 142 | + |
| 143 | +```jsonc |
| 144 | +{ |
| 145 | + "version": 1, |
| 146 | + "tap": { |
| 147 | + "homebrew/core": { |
| 148 | + "commit": "a1b2c3d4e5f6...", |
| 149 | + "official": true |
| 150 | + }, |
| 151 | + "homebrew/cask": { |
| 152 | + "commit": "f6e5d4c3b2a1...", |
| 153 | + "official": true |
| 154 | + }, |
| 155 | + "shipworthyai/brewlock": { |
| 156 | + "url": "https://github.com/ShipWorthyAI/brewlock.git", |
| 157 | + "commit": "abc123def456..." |
| 158 | + } |
| 159 | + }, |
| 160 | + "brew": { |
| 161 | + "git": { |
| 162 | + "version": "2.52.0", |
| 163 | + "installed": ["2.52.0", "2.51.0"], |
| 164 | + "revision": 1, |
| 165 | + "tap": "homebrew/core", |
| 166 | + "pinned": false, |
| 167 | + "dependencies": ["gettext", "pcre2"], |
| 168 | + "sha256": "c19806bab...", |
| 169 | + "installed_as_dependency": false, |
| 170 | + "installed_on_request": true |
| 171 | + }, |
| 172 | + "node": { |
| 173 | + "version": "21.5.0", |
| 174 | + "tap": "homebrew/core", |
| 175 | + "installed_on_request": true |
| 176 | + } |
| 177 | + }, |
| 178 | + "cask": { |
| 179 | + "docker": { |
| 180 | + "version": "4.26.1,123456", |
| 181 | + "tap": "homebrew/cask", |
| 182 | + "sha256": "0a55468...", |
| 183 | + "auto_updates": true |
| 184 | + }, |
| 185 | + "visual-studio-code": { |
| 186 | + "version": "1.85.1", |
| 187 | + "tap": "homebrew/cask", |
| 188 | + "auto_updates": true |
| 189 | + } |
| 190 | + }, |
| 191 | + "mas": { |
| 192 | + "Xcode": { |
| 193 | + "id": 497799835, |
| 194 | + "version": "15.2" |
| 195 | + } |
| 196 | + } |
| 197 | +} |
| 198 | +``` |
140 | 199 |
|
141 | | -```ruby |
142 | | -# brewlock v1 |
143 | | -tap "homebrew/cask" |
144 | | -tap "homebrew/bundle" |
| 200 | +### Lock File Fields |
145 | 201 |
|
146 | | -brew "git", version: "2.43.0" |
147 | | -brew "node", version: "21.5.0" |
148 | | -brew "python@3.11", version: "3.11.7_1" |
| 202 | +#### Tap Fields |
149 | 203 |
|
150 | | -cask "docker", version: "4.26.1" |
151 | | -cask "visual-studio-code", version: "1.85.1" |
| 204 | +| Field | Description | |
| 205 | +|-------|-------------| |
| 206 | +| `url` | Custom GitHub repo URL (for non-official taps) | |
| 207 | +| `commit` | Git commit SHA for reproducibility | |
| 208 | +| `official` | Whether this is an official Homebrew tap | |
152 | 209 |
|
153 | | -mas "Xcode", id: 497799835, version: "15.2" |
154 | | -``` |
| 210 | +#### Brew (Formula) Fields |
| 211 | + |
| 212 | +| Field | Description | |
| 213 | +|-------|-------------| |
| 214 | +| `version` | Linked (active) version | |
| 215 | +| `installed` | All installed versions in Cellar (if multiple) | |
| 216 | +| `revision` | Formula revision (e.g., distinguishes `2.43.0` from `2.43.0_1`) | |
| 217 | +| `tap` | Source tap (e.g., `homebrew/core`) | |
| 218 | +| `pinned` | Whether the formula is pinned | |
| 219 | +| `dependencies` | Direct dependencies | |
| 220 | +| `sha256` | Platform-specific bottle SHA256 for verification | |
| 221 | +| `installed_as_dependency` | Whether installed as a dependency of another package | |
| 222 | +| `installed_on_request` | Whether user explicitly installed it | |
| 223 | + |
| 224 | +#### Cask Fields |
| 225 | + |
| 226 | +| Field | Description | |
| 227 | +|-------|-------------| |
| 228 | +| `version` | Installed cask version | |
| 229 | +| `tap` | Source tap (e.g., `homebrew/cask`) | |
| 230 | +| `sha256` | Download SHA256 for verification | |
| 231 | +| `auto_updates` | Whether the app self-updates | |
| 232 | + |
| 233 | +#### Mac App Store (mas) Fields |
| 234 | + |
| 235 | +| Field | Description | |
| 236 | +|-------|-------------| |
| 237 | +| `id` | App Store ID (required for installation) | |
| 238 | +| `version` | Installed app version | |
155 | 239 |
|
156 | 240 | ## How It Works |
157 | 241 |
|
@@ -199,16 +283,16 @@ bun run build:release |
199 | 283 | ``` |
200 | 284 | brewlock/ |
201 | 285 | src/ |
202 | | - index.ts # CLI entry point |
203 | | - parser.ts # Command parser |
204 | | - executor.ts # Brew command executor |
205 | | - lock-manager.ts # Lock file read/write |
| 286 | + index.ts # CLI entry point |
| 287 | + parser.ts # Command parser |
| 288 | + executor.ts # Brew command executor |
| 289 | + lock-manager.ts # Lock file read/write (JSONC format) |
206 | 290 | version-resolver.ts # Version querying |
207 | | - bundle-handler.ts # Bundle install with versions |
208 | | - types.ts # Shared type definitions |
| 291 | + bundle-install.ts # Bundle install with versions |
| 292 | + types.ts # Shared type definitions |
209 | 293 | tests/ |
210 | | - mocks/ # Test mocking utilities |
211 | | - *.test.ts # Test files |
| 294 | + mocks/ # Test mocking utilities |
| 295 | + *.test.ts # Test files |
212 | 296 | package.json |
213 | 297 | tsconfig.json |
214 | 298 | ``` |
|
0 commit comments