sync-worktrees 3.1.0 → 3.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.
- package/README.md +39 -0
- package/dist/index.js +589 -211
- package/dist/index.js.map +4 -4
- package/dist/mcp-server.js +576 -179
- package/dist/mcp-server.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -380,6 +380,45 @@ rm -rf .diverged/2024-01-15-feature-x
|
|
|
380
380
|
|
|
381
381
|
This ensures you never lose work due to force pushes while keeping your worktrees in sync with upstream.
|
|
382
382
|
|
|
383
|
+
### Sparse Checkout
|
|
384
|
+
|
|
385
|
+
For monorepos where you only need a subset of folders, set `sparseCheckout` per repository entry. The tool runs `git worktree add --no-checkout`, configures sparse-checkout, then materializes only the included paths. The same repository can be listed multiple times under different `name`s with different sparse patterns to build domain-grouped layouts.
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
export default {
|
|
389
|
+
repositories: [
|
|
390
|
+
{
|
|
391
|
+
name: "roulette-game-client",
|
|
392
|
+
repoUrl: "https://github.com/acme/casino-monorepo.git",
|
|
393
|
+
worktreeDir: "/Users/me/game-clients/roulette",
|
|
394
|
+
sparseCheckout: { include: ["game-client"] },
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: "roulette-autocue",
|
|
398
|
+
repoUrl: "https://github.com/acme/casino-monorepo.git",
|
|
399
|
+
worktreeDir: "/Users/me/autocues/roulette",
|
|
400
|
+
sparseCheckout: { include: ["autocue"] },
|
|
401
|
+
// bareRepoDir: ".bare/roulette-autocue", // pin to make config reorder-proof
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
};
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Modes:**
|
|
408
|
+
|
|
409
|
+
- `cone` (default): pass folder names in `include`. Fast and recommended.
|
|
410
|
+
- `no-cone`: pass gitignore-style patterns including `!negation`. Required for `exclude` and any `!`-prefixed include.
|
|
411
|
+
|
|
412
|
+
If you set `exclude` or use `!`-prefixed patterns while `mode: "cone"` is explicit, the tool auto-promotes to `no-cone` and logs a warning.
|
|
413
|
+
|
|
414
|
+
**Duplicate `repoUrl` handling:**
|
|
415
|
+
|
|
416
|
+
The first entry per `repoUrl` keeps the URL-derived bare path (`.bare/<repo-slug>`). Subsequent duplicate entries auto-derive `bareRepoDir` from `name` (`.bare/<name>`) so they do not collide. Pin `bareRepoDir` explicitly on duplicate entries if you want config order to be irrelevant.
|
|
417
|
+
|
|
418
|
+
**Narrowing safety:**
|
|
419
|
+
|
|
420
|
+
When a sync would narrow an existing worktree's sparse patterns (remove a previously included path), it first checks the worktree is clean. If there are uncommitted changes, unpushed commits, or in-progress operations, the sparse update is skipped with a warning. Clean or stash local changes to apply the narrower patterns.
|
|
421
|
+
|
|
383
422
|
## Requirements
|
|
384
423
|
|
|
385
424
|
- Node.js >= 22.0.0
|