@gw-tools/gw 0.14.4 → 0.15.1

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 (2) hide show
  1. package/README.md +31 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -923,7 +923,7 @@ gw sync /full/path/to/repo/feat-branch .env
923
923
 
924
924
  ### clean
925
925
 
926
- Remove stale worktrees that are older than a configured threshold. By default, only removes worktrees with no uncommitted changes and no unpushed commits.
926
+ Remove safe worktrees with no uncommitted changes and no unpushed commits. By default, removes **ALL** safe worktrees regardless of age. Use `--use-autoclean-threshold` to only remove worktrees older than the configured threshold.
927
927
 
928
928
  **Note:** For automatic cleanup, see `gw init --auto-clean`. The `clean` command provides interactive, manual cleanup with detailed output and confirmation prompts.
929
929
 
@@ -933,6 +933,7 @@ gw clean [options]
933
933
 
934
934
  #### Options
935
935
 
936
+ - `--use-autoclean-threshold`: Only remove worktrees older than configured threshold (default: 7 days)
936
937
  - `-f, --force`: Skip safety checks (uncommitted changes, unpushed commits). WARNING: This may result in data loss
937
938
  - `-n, --dry-run`: Preview what would be removed without actually removing
938
939
  - `-h, --help`: Show help message
@@ -940,29 +941,42 @@ gw clean [options]
940
941
  #### Examples
941
942
 
942
943
  ```bash
943
- # Preview stale worktrees (safe to run)
944
+ # Preview all safe worktrees (default behavior)
944
945
  gw clean --dry-run
945
946
 
946
- # Remove stale worktrees with safety checks
947
+ # Remove all safe worktrees regardless of age
947
948
  gw clean
948
949
 
949
- # Force remove without safety checks (dangerous!)
950
- gw clean --force
950
+ # Only remove worktrees older than configured threshold
951
+ gw clean --use-autoclean-threshold
951
952
 
952
- # Configure threshold during init
953
- gw init --clean-threshold 14
953
+ # Preview old worktrees with threshold check
954
+ gw clean --use-autoclean-threshold --dry-run
955
+
956
+ # Force remove all worktrees without safety checks (dangerous!)
957
+ gw clean --force
954
958
  ```
955
959
 
956
960
  #### How It Works
957
961
 
958
962
  The clean command:
959
963
 
960
- 1. Checks for worktrees older than the configured threshold (default: 7 days)
964
+ 1. **Default mode:** Finds ALL safe worktrees (no age check)
965
+ - **With `--use-autoclean-threshold`:** Only finds worktrees older than configured threshold (default: 7 days)
961
966
  2. Verifies they have no uncommitted changes (unless `--force`)
962
967
  3. Verifies they have no unpushed commits (unless `--force`)
963
968
  4. Prompts for confirmation before deleting (unless `--dry-run`)
964
969
  5. Never removes bare/main repository worktrees
965
970
 
971
+ **Behavior Modes:**
972
+
973
+ | Command | Age Check | Safety Checks | Use Case |
974
+ |---------|-----------|---------------|----------|
975
+ | `gw clean` | No (all worktrees) | Yes (unless --force) | Clean up all finished work |
976
+ | `gw clean --use-autoclean-threshold` | Yes (7+ days) | Yes (unless --force) | Clean up old, stale worktrees |
977
+ | `gw clean --force` | No (all worktrees) | No | Force removal of all worktrees |
978
+ | `gw prune --clean` | No (all worktrees) | No | Git's native cleanup (no gw safety) |
979
+
966
980
  **Safety Features:**
967
981
 
968
982
  - By default, only removes worktrees with NO uncommitted changes
@@ -973,7 +987,7 @@ The clean command:
973
987
 
974
988
  **Configuration:**
975
989
 
976
- The age threshold is stored in `.gw/config.json` and can be set during initialization:
990
+ The age threshold (used by `--use-autoclean-threshold`) is stored in `.gw/config.json`:
977
991
 
978
992
  ```bash
979
993
  # Set clean threshold to 14 days
@@ -1055,7 +1069,7 @@ Clean up worktree administrative data and optionally remove clean worktrees.
1055
1069
  Wraps `git worktree prune` to clean up administrative files for deleted worktrees.
1056
1070
 
1057
1071
  **Clean Mode** (with `--clean`):
1058
- First runs `git worktree prune`, then removes ALL worktrees that have no uncommitted changes, no staged files, and no unpushed commits. Unlike `gw clean` (which is age-based), `gw prune --clean` removes worktrees regardless of age.
1072
+ First runs `git worktree prune`, then removes ALL worktrees that have no uncommitted changes, no staged files, and no unpushed commits. This is similar to default `gw clean` behavior but with additional protections for the default branch.
1059
1073
 
1060
1074
  ```bash
1061
1075
  gw prune [options]
@@ -1091,13 +1105,13 @@ gw prune --clean --verbose # Show detailed output
1091
1105
  ```
1092
1106
 
1093
1107
  **Comparison with `gw clean`:**
1094
- | Feature | `gw clean` | `gw prune --clean` |
1095
- |---------|-----------|-------------------|
1096
- | Age-based | Yes (configurable threshold) | No (removes all clean) |
1097
- | Safety checks | Yes | Yes |
1098
- | Protects default branch | No | Yes |
1099
- | Runs `git worktree prune` | No | Yes |
1100
- | Use case | Regular maintenance | Aggressive cleanup |
1108
+ | Feature | `gw clean` | `gw clean --use-autoclean-threshold` | `gw prune --clean` |
1109
+ |---------|-----------|-------------------------------------|-------------------|
1110
+ | Age-based | No (all worktrees) | Yes (configurable threshold) | No (removes all clean) |
1111
+ | Safety checks | Yes | Yes | Yes |
1112
+ | Protects default branch | No | No | Yes |
1113
+ | Runs `git worktree prune` | No | No | Yes |
1114
+ | Use case | Clean up finished work | Regular maintenance | Aggressive cleanup |
1101
1115
 
1102
1116
  #### lock
1103
1117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.14.4",
3
+ "version": "0.15.1",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",