@gw-tools/gw 0.20.3 → 0.20.4

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 +46 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -91,6 +91,8 @@ A command-line tool for managing git worktrees, built with Deno.
91
91
 
92
92
  ## Quick Start
93
93
 
94
+ **New Project Setup:**
95
+
94
96
  ```bash
95
97
  # Install (Homebrew on macOS)
96
98
  brew install mthines/gw-tools/gw && gw install-shell
@@ -101,25 +103,27 @@ npm install -g @gw-tools/gw && gw install-shell
101
103
  # Or install via Linux package manager
102
104
  yay -S gw-tools && gw install-shell
103
105
 
104
- # Create a new worktree and copy files
105
- gw add feat-new-feature .env secrets/
106
+ # Clone a repository with gw setup (interactive prompts for configuration)
107
+ gw init git@github.com:user/repo.git --interactive
108
+ # Automatically navigates to the new repository
106
109
 
107
- # Navigate to your new worktree
110
+ # Create worktrees and start working
111
+ gw add feat-new-feature
108
112
  gw cd feat-new-feature
109
-
110
- # Or checkout an existing branch (navigates if already checked out elsewhere)
111
- gw checkout main
112
113
  ```
113
114
 
114
- **Or with auto-copy (one-time setup):**
115
+ **Existing Repository Setup:**
115
116
 
116
117
  ```bash
117
- # Configure auto-copy files once per repository
118
- gw init --root $(gw root) --auto-copy-files .env,secrets/
118
+ # Configure gw in an existing repository
119
+ gw init --auto-copy-files .env,secrets/ --post-add "pnpm install"
119
120
 
120
- # Now just create worktrees - files are copied automatically
121
+ # Create worktrees - files are copied automatically, dependencies installed
121
122
  gw add feat-another-feature
122
123
  gw cd feat-another-feature
124
+
125
+ # Checkout an existing branch (navigates if already checked out elsewhere)
126
+ gw checkout main
123
127
  ```
124
128
 
125
129
  ## Initial Setup: Secrets in the Default Branch
@@ -129,29 +133,47 @@ gw cd feat-another-feature
129
133
  ### First-Time Setup Flow
130
134
 
131
135
  ```bash
132
- # 1. Set up your bare repository structure
133
- git clone --bare https://github.com/user/repo.git repo.git
134
- cd repo.git
136
+ # 1. Clone and set up repository with gw (interactive mode)
137
+ gw init git@github.com:user/repo.git --interactive
135
138
 
136
- # 2. Create the main worktree (your defaultBranch)
137
- git worktree add main main
139
+ # During interactive setup:
140
+ # - Configure auto-copy files: .env,secrets/
141
+ # - Set up post-add hooks if needed (e.g., pnpm install)
142
+ # - Configure other options as desired
138
143
 
139
- # 3. Set up secrets in the main worktree FIRST
144
+ # This automatically:
145
+ # - Clones the repository
146
+ # - Creates the gw_root branch
147
+ # - Creates the main worktree
148
+ # - Navigates you to the repository root
149
+
150
+ # 2. Set up secrets in the main worktree FIRST
140
151
  cd main
141
152
  cp .env.example .env # Create your environment file
142
153
  # Edit .env with your actual secrets, API keys, etc.
143
154
  mkdir -p secrets/
144
155
  # Add any other secret files your project needs
145
156
 
146
- # 4. Initialize gw with auto-copy configuration
147
- gw init --auto-copy-files .env,secrets/
148
-
149
- # 5. Now create feature worktrees - files are copied automatically from main
157
+ # 3. Now create feature worktrees - files are copied automatically from main
150
158
  cd ..
151
159
  gw add feat-new-feature
152
160
  # .env and secrets/ are automatically copied from main to feat-new-feature
153
161
  ```
154
162
 
163
+ **Alternative: Non-Interactive Setup**
164
+
165
+ ```bash
166
+ # Clone with configuration in one command
167
+ gw init git@github.com:user/repo.git \
168
+ --auto-copy-files .env,secrets/ \
169
+ --post-add "pnpm install"
170
+
171
+ # Then set up secrets in main worktree as shown above
172
+ cd repo.git/main
173
+ cp .env.example .env
174
+ # Edit .env with your secrets
175
+ ```
176
+
155
177
  ### Why This Matters
156
178
 
157
179
  - **`gw add`** copies files **from** your `defaultBranch` worktree **to** the new worktree
@@ -735,9 +757,11 @@ gw root
735
757
 
736
758
  ### init
737
759
 
738
- Initialize gw configuration for a git repository. This command can:
760
+ Initialize gw configuration for a git repository. This is the recommended way to get started with gw.
761
+
762
+ **Two modes:**
739
763
 
740
- 1. **Clone mode**: Clone a repository and set it up with gw configuration
764
+ 1. **Clone mode**: Clone a repository and automatically set it up with gw (recommended for new projects)
741
765
  2. **Existing repo mode**: Initialize gw in an existing repository
742
766
 
743
767
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.20.3",
3
+ "version": "0.20.4",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",