@gw-tools/gw 0.56.5 → 0.57.0-beta.56.2
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 +26 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -334,15 +334,26 @@ cp dist/packages/gw-tool/gw /usr/local/bin/gw
|
|
|
334
334
|
|
|
335
335
|
On first run, `gw` will automatically detect your git repository root and create a configuration file at `.gw/config.json`. The tool finds the config by walking up the directory tree from your current location, so you can run `gw` commands from anywhere within your repository.
|
|
336
336
|
|
|
337
|
+
**The `.gw/config.json` file is safe to commit to your repository.** It contains only portable settings — no machine-specific paths or runtime state. The `root` field has been removed; gw auto-detects the repository root from the config file location. Runtime state like cleanup timestamps is managed internally and never written to the config file.
|
|
338
|
+
|
|
337
339
|
### Auto-Detection
|
|
338
340
|
|
|
339
341
|
The tool automatically:
|
|
340
342
|
|
|
341
343
|
1. **Searches for existing config**: Walks up from your current directory looking for `.gw/config.json`
|
|
342
|
-
2. **Auto-detects git root**:
|
|
343
|
-
3. **Creates config**: Saves
|
|
344
|
+
2. **Auto-detects git root**: Derives the git root from the config file's location (or detects it if no config exists)
|
|
345
|
+
3. **Creates config**: Saves default settings to `.gw/config.json` in your worktree root
|
|
344
346
|
|
|
345
|
-
|
|
347
|
+
Config is created inside the current worktree so it can be committed to git and shared with your team. This means everyone gets the same `autoCopyFiles`, `hooks`, `defaultBranch`, etc. without each person having to configure it.
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# Initialize and commit (one-time, from any worktree)
|
|
351
|
+
gw init --auto-copy-files .env --post-checkout "pnpm install"
|
|
352
|
+
git add .gw/config.json
|
|
353
|
+
git commit -m "chore: share gw config"
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
If auto-detection fails (rare edge cases), you can manually specify the root:
|
|
346
357
|
|
|
347
358
|
```bash
|
|
348
359
|
gw init --root /path/to/your/repo.git
|
|
@@ -352,7 +363,6 @@ gw init --root /path/to/your/repo.git
|
|
|
352
363
|
|
|
353
364
|
```jsonc
|
|
354
365
|
{
|
|
355
|
-
"root": "/Users/username/Workspace/my-project.git",
|
|
356
366
|
"defaultBranch": "main",
|
|
357
367
|
// Auto-copy these files when creating new worktrees
|
|
358
368
|
"autoCopyFiles": [".env", "components/agents/.env", "components/ui/.vercel/"],
|
|
@@ -365,7 +375,6 @@ gw init --root /path/to/your/repo.git
|
|
|
365
375
|
"cleanThreshold": 7,
|
|
366
376
|
"autoClean": true,
|
|
367
377
|
"updateStrategy": "merge",
|
|
368
|
-
"lastAutoCleanTime": 1706371200000, // trailing comma OK
|
|
369
378
|
}
|
|
370
379
|
```
|
|
371
380
|
|
|
@@ -375,16 +384,16 @@ gw init --root /path/to/your/repo.git
|
|
|
375
384
|
|
|
376
385
|
### Configuration Options
|
|
377
386
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
- **
|
|
381
|
-
- **
|
|
387
|
+
All fields are optional and safe to commit — no machine-specific paths or runtime state is stored.
|
|
388
|
+
|
|
389
|
+
- **defaultBranch**: Default source worktree name (defaults to "main")
|
|
390
|
+
- **autoCopyFiles**: Array of file/directory paths to automatically copy when creating worktrees with `gw checkout` (set via `gw init --auto-copy-files`)
|
|
391
|
+
- **hooks**: Command hooks configuration (set via `gw init --pre-checkout` and `--post-checkout`)
|
|
382
392
|
- **hooks.checkout.pre**: Array of commands to run before creating a worktree
|
|
383
393
|
- **hooks.checkout.post**: Array of commands to run after creating a worktree
|
|
384
|
-
- **cleanThreshold**: Number of days before worktrees are considered stale for `gw clean` (
|
|
385
|
-
- **autoClean**: Silently remove stale worktrees in the background when running `gw checkout` or `gw list` (
|
|
386
|
-
- **updateStrategy**: Default strategy for `gw update` command: "merge" or "rebase" (
|
|
387
|
-
- **lastAutoCleanTime**: Internal timestamp tracking last auto-cleanup run (managed automatically, do not edit manually)
|
|
394
|
+
- **cleanThreshold**: Number of days before worktrees are considered stale for `gw clean` (defaults to 7, set via `gw init --clean-threshold`)
|
|
395
|
+
- **autoClean**: Silently remove stale worktrees in the background when running `gw checkout` or `gw list` (defaults to false, set via `gw init --auto-clean`)
|
|
396
|
+
- **updateStrategy**: Default strategy for `gw update` command: "merge" or "rebase" (defaults to "merge", set via `gw init --update-strategy`)
|
|
388
397
|
|
|
389
398
|
## Commands
|
|
390
399
|
|
|
@@ -560,7 +569,6 @@ This creates:
|
|
|
560
569
|
|
|
561
570
|
```json
|
|
562
571
|
{
|
|
563
|
-
"root": "/path/to/repo.git",
|
|
564
572
|
"defaultBranch": "main",
|
|
565
573
|
"autoCopyFiles": [".env", "secrets/", "components/ui/.vercel/"]
|
|
566
574
|
}
|
|
@@ -1151,7 +1159,6 @@ If your `.gw/config.json` contains:
|
|
|
1151
1159
|
|
|
1152
1160
|
```json
|
|
1153
1161
|
{
|
|
1154
|
-
"root": "/Users/username/Workspace/repo.git",
|
|
1155
1162
|
"defaultBranch": "main",
|
|
1156
1163
|
"autoCopyFiles": [".env", "secrets/"],
|
|
1157
1164
|
"hooks": {
|
|
@@ -1547,6 +1554,10 @@ gw cd feat/new-feature
|
|
|
1547
1554
|
gw init --auto-copy-files .env,components/agents/.env,components/ui/.vercel/ \
|
|
1548
1555
|
--post-checkout "pnpm install"
|
|
1549
1556
|
|
|
1557
|
+
# Commit the config so your team gets the same setup
|
|
1558
|
+
git add .gw/config.json
|
|
1559
|
+
git commit -m "chore: share gw config"
|
|
1560
|
+
|
|
1550
1561
|
# From within any worktree of your repository
|
|
1551
1562
|
# Create a new worktree with auto-copy and hooks
|
|
1552
1563
|
gw add feat/new-feature
|