@camaradesuk/git-worktree-tools 1.6.0 → 1.7.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.
Files changed (190) hide show
  1. package/README.md +307 -418
  2. package/dist/cli/cleanpr.test.js +2 -0
  3. package/dist/cli/cleanpr.test.js.map +1 -1
  4. package/dist/cli/newpr.js +48 -11
  5. package/dist/cli/newpr.js.map +1 -1
  6. package/dist/cli/newpr.test.js +33 -15
  7. package/dist/cli/newpr.test.js.map +1 -1
  8. package/dist/cli/wt/clean.d.ts +1 -0
  9. package/dist/cli/wt/clean.d.ts.map +1 -1
  10. package/dist/cli/wt/clean.js +11 -1
  11. package/dist/cli/wt/clean.js.map +1 -1
  12. package/dist/cli/wt/config.d.ts +1 -1
  13. package/dist/cli/wt/config.d.ts.map +1 -1
  14. package/dist/cli/wt/config.js +148 -13
  15. package/dist/cli/wt/config.js.map +1 -1
  16. package/dist/cli/wt/config.test.d.ts +5 -0
  17. package/dist/cli/wt/config.test.d.ts.map +1 -0
  18. package/dist/cli/wt/config.test.js +260 -0
  19. package/dist/cli/wt/config.test.js.map +1 -0
  20. package/dist/cli/wt/entry.test.js +11 -8
  21. package/dist/cli/wt/entry.test.js.map +1 -1
  22. package/dist/cli/wt/init.d.ts +14 -0
  23. package/dist/cli/wt/init.d.ts.map +1 -0
  24. package/dist/cli/wt/init.js +209 -0
  25. package/dist/cli/wt/init.js.map +1 -0
  26. package/dist/cli/wt/init.test.d.ts +5 -0
  27. package/dist/cli/wt/init.test.d.ts.map +1 -0
  28. package/dist/cli/wt/init.test.js +165 -0
  29. package/dist/cli/wt/init.test.js.map +1 -0
  30. package/dist/cli/wt/init.unit.test.d.ts +5 -0
  31. package/dist/cli/wt/init.unit.test.d.ts.map +1 -0
  32. package/dist/cli/wt/init.unit.test.js +432 -0
  33. package/dist/cli/wt/init.unit.test.js.map +1 -0
  34. package/dist/cli/wt/interactive-menu.d.ts +41 -0
  35. package/dist/cli/wt/interactive-menu.d.ts.map +1 -0
  36. package/dist/cli/wt/interactive-menu.js +639 -0
  37. package/dist/cli/wt/interactive-menu.js.map +1 -0
  38. package/dist/cli/wt/interactive-menu.test.d.ts +10 -0
  39. package/dist/cli/wt/interactive-menu.test.d.ts.map +1 -0
  40. package/dist/cli/wt/interactive-menu.test.js +711 -0
  41. package/dist/cli/wt/interactive-menu.test.js.map +1 -0
  42. package/dist/cli/wt/link.d.ts +9 -0
  43. package/dist/cli/wt/link.d.ts.map +1 -1
  44. package/dist/cli/wt/link.js +27 -0
  45. package/dist/cli/wt/link.js.map +1 -1
  46. package/dist/cli/wt/list.d.ts +2 -2
  47. package/dist/cli/wt/list.d.ts.map +1 -1
  48. package/dist/cli/wt/list.js +17 -17
  49. package/dist/cli/wt/list.js.map +1 -1
  50. package/dist/cli/wt/new.d.ts +7 -1
  51. package/dist/cli/wt/new.d.ts.map +1 -1
  52. package/dist/cli/wt/new.js +58 -6
  53. package/dist/cli/wt/new.js.map +1 -1
  54. package/dist/cli/wt/wt.test.js +159 -16
  55. package/dist/cli/wt/wt.test.js.map +1 -1
  56. package/dist/cli/wt.d.ts +2 -1
  57. package/dist/cli/wt.d.ts.map +1 -1
  58. package/dist/cli/wt.js +98 -3
  59. package/dist/cli/wt.js.map +1 -1
  60. package/dist/cli/wt.unit.test.d.ts +7 -0
  61. package/dist/cli/wt.unit.test.d.ts.map +1 -0
  62. package/dist/cli/wt.unit.test.js +182 -0
  63. package/dist/cli/wt.unit.test.js.map +1 -0
  64. package/dist/cli/wtconfig.js +18 -4
  65. package/dist/cli/wtconfig.js.map +1 -1
  66. package/dist/cli/wtconfig.test.js +18 -16
  67. package/dist/cli/wtconfig.test.js.map +1 -1
  68. package/dist/e2e/newpr/scenarios.e2e.test.js +7 -7
  69. package/dist/e2e/newpr/scenarios.e2e.test.js.map +1 -1
  70. package/dist/e2e/wt/wt.e2e.test.d.ts +9 -0
  71. package/dist/e2e/wt/wt.e2e.test.d.ts.map +1 -0
  72. package/dist/e2e/wt/wt.e2e.test.js +384 -0
  73. package/dist/e2e/wt/wt.e2e.test.js.map +1 -0
  74. package/dist/lib/ai/base-provider.d.ts +22 -0
  75. package/dist/lib/ai/base-provider.d.ts.map +1 -1
  76. package/dist/lib/ai/base-provider.js +180 -99
  77. package/dist/lib/ai/base-provider.js.map +1 -1
  78. package/dist/lib/ai/base-provider.test.js +13 -14
  79. package/dist/lib/ai/base-provider.test.js.map +1 -1
  80. package/dist/lib/ai/cli-provider.d.ts +11 -7
  81. package/dist/lib/ai/cli-provider.d.ts.map +1 -1
  82. package/dist/lib/ai/cli-provider.js +19 -49
  83. package/dist/lib/ai/cli-provider.js.map +1 -1
  84. package/dist/lib/ai/cli-provider.test.js +47 -49
  85. package/dist/lib/ai/cli-provider.test.js.map +1 -1
  86. package/dist/lib/ai/index.d.ts +2 -1
  87. package/dist/lib/ai/index.d.ts.map +1 -1
  88. package/dist/lib/ai/index.js +2 -0
  89. package/dist/lib/ai/index.js.map +1 -1
  90. package/dist/lib/ai/provider-manager.js +2 -2
  91. package/dist/lib/ai/provider-manager.js.map +1 -1
  92. package/dist/lib/ai/repo-docs.d.ts +43 -0
  93. package/dist/lib/ai/repo-docs.d.ts.map +1 -0
  94. package/dist/lib/ai/repo-docs.js +274 -0
  95. package/dist/lib/ai/repo-docs.js.map +1 -0
  96. package/dist/lib/ai/repo-docs.test.d.ts +5 -0
  97. package/dist/lib/ai/repo-docs.test.d.ts.map +1 -0
  98. package/dist/lib/ai/repo-docs.test.js +357 -0
  99. package/dist/lib/ai/repo-docs.test.js.map +1 -0
  100. package/dist/lib/ai/types.d.ts +18 -2
  101. package/dist/lib/ai/types.d.ts.map +1 -1
  102. package/dist/lib/ai/types.js.map +1 -1
  103. package/dist/lib/config-editor.d.ts +21 -0
  104. package/dist/lib/config-editor.d.ts.map +1 -0
  105. package/dist/lib/config-editor.js +729 -0
  106. package/dist/lib/config-editor.js.map +1 -0
  107. package/dist/lib/config-editor.test.d.ts +11 -0
  108. package/dist/lib/config-editor.test.d.ts.map +1 -0
  109. package/dist/lib/config-editor.test.js +526 -0
  110. package/dist/lib/config-editor.test.js.map +1 -0
  111. package/dist/lib/config-validation.d.ts +28 -0
  112. package/dist/lib/config-validation.d.ts.map +1 -0
  113. package/dist/lib/config-validation.js +534 -0
  114. package/dist/lib/config-validation.js.map +1 -0
  115. package/dist/lib/config-validation.test.d.ts +5 -0
  116. package/dist/lib/config-validation.test.d.ts.map +1 -0
  117. package/dist/lib/config-validation.test.js +398 -0
  118. package/dist/lib/config-validation.test.js.map +1 -0
  119. package/dist/lib/config.d.ts +115 -6
  120. package/dist/lib/config.d.ts.map +1 -1
  121. package/dist/lib/config.js +251 -55
  122. package/dist/lib/config.js.map +1 -1
  123. package/dist/lib/config.test.js +2 -1
  124. package/dist/lib/config.test.js.map +1 -1
  125. package/dist/lib/constants.d.ts +50 -1
  126. package/dist/lib/constants.d.ts.map +1 -1
  127. package/dist/lib/constants.js +67 -1
  128. package/dist/lib/constants.js.map +1 -1
  129. package/dist/lib/constants.test.d.ts +5 -0
  130. package/dist/lib/constants.test.d.ts.map +1 -0
  131. package/dist/lib/constants.test.js +121 -0
  132. package/dist/lib/constants.test.js.map +1 -0
  133. package/dist/lib/git.d.ts +12 -0
  134. package/dist/lib/git.d.ts.map +1 -1
  135. package/dist/lib/git.js +26 -0
  136. package/dist/lib/git.js.map +1 -1
  137. package/dist/lib/global-check.d.ts +38 -0
  138. package/dist/lib/global-check.d.ts.map +1 -0
  139. package/dist/lib/global-check.js +135 -0
  140. package/dist/lib/global-check.js.map +1 -0
  141. package/dist/lib/global-check.test.d.ts +5 -0
  142. package/dist/lib/global-check.test.d.ts.map +1 -0
  143. package/dist/lib/global-check.test.js +153 -0
  144. package/dist/lib/global-check.test.js.map +1 -0
  145. package/dist/lib/global-config.d.ts +102 -0
  146. package/dist/lib/global-config.d.ts.map +1 -0
  147. package/dist/lib/global-config.js +234 -0
  148. package/dist/lib/global-config.js.map +1 -0
  149. package/dist/lib/global-config.test.d.ts +5 -0
  150. package/dist/lib/global-config.test.d.ts.map +1 -0
  151. package/dist/lib/global-config.test.js +282 -0
  152. package/dist/lib/global-config.test.js.map +1 -0
  153. package/dist/lib/logger.d.ts +175 -0
  154. package/dist/lib/logger.d.ts.map +1 -0
  155. package/dist/lib/logger.js +475 -0
  156. package/dist/lib/logger.js.map +1 -0
  157. package/dist/lib/logger.test.d.ts +5 -0
  158. package/dist/lib/logger.test.d.ts.map +1 -0
  159. package/dist/lib/logger.test.js +292 -0
  160. package/dist/lib/logger.test.js.map +1 -0
  161. package/dist/lib/lswt/action-executors.test.js +2 -0
  162. package/dist/lib/lswt/action-executors.test.js.map +1 -1
  163. package/dist/lib/newpr/args.d.ts.map +1 -1
  164. package/dist/lib/newpr/args.js +9 -2
  165. package/dist/lib/newpr/args.js.map +1 -1
  166. package/dist/lib/newpr/args.test.js +1 -1
  167. package/dist/lib/newpr/args.test.js.map +1 -1
  168. package/dist/lib/newpr/types.d.ts +2 -0
  169. package/dist/lib/newpr/types.d.ts.map +1 -1
  170. package/dist/lib/prompts.d.ts +6 -0
  171. package/dist/lib/prompts.d.ts.map +1 -1
  172. package/dist/lib/prompts.js +31 -9
  173. package/dist/lib/prompts.js.map +1 -1
  174. package/dist/lib/prompts.test.js +72 -1
  175. package/dist/lib/prompts.test.js.map +1 -1
  176. package/dist/lib/schema.test.d.ts +10 -0
  177. package/dist/lib/schema.test.d.ts.map +1 -0
  178. package/dist/lib/schema.test.js +309 -0
  179. package/dist/lib/schema.test.js.map +1 -0
  180. package/dist/lib/wtconfig/environment.d.ts.map +1 -1
  181. package/dist/lib/wtconfig/environment.js +6 -4
  182. package/dist/lib/wtconfig/environment.js.map +1 -1
  183. package/dist/lib/wtconfig/environment.test.js +2 -7
  184. package/dist/lib/wtconfig/environment.test.js.map +1 -1
  185. package/dist/lib/wtconfig/types.d.ts +3 -1
  186. package/dist/lib/wtconfig/types.d.ts.map +1 -1
  187. package/dist/lib/wtlink/manage-manifest.test.js +145 -7
  188. package/dist/lib/wtlink/manage-manifest.test.js.map +1 -1
  189. package/package.json +2 -1
  190. package/schemas/worktreerc.schema.json +416 -0
package/README.md CHANGED
@@ -8,12 +8,14 @@ Cross-platform CLI tools for git worktree workflow management. Create PRs with d
8
8
 
9
9
  ## Features
10
10
 
11
- - **Cross-platform**: Works natively on Windows, macOS, and Linux (no bash/WSL required)
12
- - **Smart State Detection**: Intelligently handles 10+ git scenarios (uncommitted changes, local commits, existing branches, etc.)
13
- - **PR + Worktree Workflow**: Create PRs and dedicated worktrees in one command
14
- - **Shared Repos**: Automatically create worktrees in related repositories
15
- - **Config Syncing**: Share gitignored config files (.env, .vscode, etc.) between worktrees via hard links
16
- - **Configurable**: Per-repo settings via `.worktreerc`
11
+ - **Unified CLI** Single `wt` command with interactive menu or subcommands
12
+ - **Cross-platform** Works natively on Windows, macOS, and Linux (no bash/WSL required)
13
+ - **Smart State Detection** — Intelligently handles 10+ git scenarios (uncommitted changes, local commits, existing branches, etc.)
14
+ - **PR + Worktree Workflow** — Create PRs and dedicated worktrees in one command
15
+ - **Config Syncing** Share gitignored config files (.env, .vscode, etc.) between worktrees via hard links
16
+ - **Three-Tier Configuration** — Global, repo, and local config with JSON schema validation
17
+ - **Structured Logging** — Configurable log levels with file output support
18
+ - **AI Tool Integration** — JSON output mode and programmatic API for AI agents
17
19
 
18
20
  ## Installation
19
21
 
@@ -30,60 +32,83 @@ npm install -g @camaradesuk/git-worktree-tools
30
32
  ## Quick Start
31
33
 
32
34
  ```bash
33
- # Using the unified wt command (recommended)
34
- wt new "Add user authentication feature" # Create PR with worktree
35
- wt list # List worktrees
36
- wt clean # Clean up merged/closed PRs
37
- wt link # Manage shared config files
38
- wt state --json # Query git state
39
- wt config init # Configure settings
40
-
41
- # Or use individual commands directly
42
- newpr "Add user authentication feature"
43
- lswt
44
- cleanpr
45
- wtlink
46
- wtstate --json
47
- wtconfig init
35
+ # Interactive menu (recommended for exploration)
36
+ wt
37
+
38
+ # Create a new PR with worktree
39
+ wt new "Add user authentication feature"
40
+
41
+ # List worktrees with interactive selection
42
+ wt list
43
+
44
+ # Clean up merged/closed PRs
45
+ wt clean
46
+
47
+ # Initialize configuration
48
+ wt init
48
49
  ```
49
50
 
50
- ## Commands
51
+ ---
51
52
 
52
- ### wt (Unified Command)
53
+ ## The `wt` Command
53
54
 
54
- The `wt` command provides a single entry point for all git-worktree-tools functionality:
55
+ The unified `wt` command provides access to all git-worktree-tools functionality through an interactive menu or subcommands.
56
+
57
+ ### Interactive Mode
58
+
59
+ Run `wt` without arguments to launch the interactive menu:
55
60
 
56
61
  ```bash
57
- wt <command> [options]
62
+ wt
58
63
  ```
59
64
 
65
+ The menu provides guided workflows for:
66
+
67
+ - Creating new PRs (from description, existing PR, or current branch)
68
+ - Listing and navigating worktrees
69
+ - Cleaning up merged/closed PR worktrees
70
+ - Managing config file linking
71
+ - Viewing git state
72
+ - Editing configuration
73
+
74
+ ### Subcommands
75
+
60
76
  | Command | Alias | Description |
61
77
  | -------------------- | -------- | ----------------------------------- |
78
+ | `wt` | - | Interactive main menu |
62
79
  | `wt new <desc>` | `wt n` | Create a new PR with worktree |
63
80
  | `wt list` | `wt ls` | List worktrees with PR status |
64
81
  | `wt clean [pr]` | `wt c` | Clean up merged/closed PR worktrees |
65
82
  | `wt link [cmd]` | `wt l` | Manage gitignored files via links |
66
83
  | `wt state` | `wt s` | Query git worktree state |
67
84
  | `wt config [cmd]` | `wt cfg` | Configuration management |
85
+ | `wt init` | - | Initialize configuration |
68
86
  | `wt completion <sh>` | - | Generate shell completion scripts |
69
87
 
70
- All subcommands accept the same options as their standalone equivalents. For example:
88
+ ### Global Options
71
89
 
72
90
  ```bash
73
- wt new "Add feature" --draft # Same as: newpr "Add feature" --draft
74
- wt list --json # Same as: lswt --json
75
- wt clean --all # Same as: cleanpr --all
91
+ wt -v # Verbose output (debug level)
92
+ wt -vv # Very verbose (trace level)
93
+ wt --debug # Debug output
94
+ wt -q, --quiet # Suppress non-essential output
95
+ wt --log-file FILE # Write logs to file
76
96
  ```
77
97
 
78
- ### newpr
98
+ ---
99
+
100
+ ## Commands Reference
101
+
102
+ ### wt new / newpr
79
103
 
80
104
  Create a new PR with an associated worktree.
81
105
 
82
106
  ```bash
83
- newpr "Description of the feature"
84
- newpr --branch my-feature "Feature description"
85
- newpr --pr 123 # Work on existing PR
86
- newpr --draft "WIP feature"
107
+ wt new "Description of the feature"
108
+ wt new --branch my-feature "Feature description"
109
+ wt new --pr 123 # Work on existing PR
110
+ wt new --draft "WIP feature"
111
+ wt new --install --code # Install deps and open editor
87
112
  ```
88
113
 
89
114
  **Smart State Handling**: The tool detects your current git state and offers appropriate options:
@@ -93,131 +118,56 @@ newpr --draft "WIP feature"
93
118
  - On a feature branch? Create PR for it or start new
94
119
  - Detached HEAD? Create branch from current commit or main
95
120
 
96
- ### cleanpr
97
-
98
- Clean up worktrees for merged or closed PRs.
99
-
100
- ```bash
101
- cleanpr # Interactive cleanup
102
- cleanpr --all # Clean all merged/closed automatically
103
- cleanpr --force # Force remove even if not merged
104
- ```
105
-
106
- ### lswt
121
+ ### wt list / lswt
107
122
 
108
123
  List and manage git worktrees with an interactive interface.
109
124
 
110
125
  ```bash
111
- lswt # Interactive mode (default in terminal)
112
- lswt --no-interactive # List-only mode
113
- lswt --status # Include PR status (requires gh cli)
114
- lswt --json # Output as JSON for scripting
115
- lswt --verbose # Show more details (commit hashes, full paths)
116
- lswt | cat # Automatically uses list mode when piped
126
+ wt list # Interactive mode (default in terminal)
127
+ wt ls --no-interactive # List-only mode
128
+ wt ls --status # Include PR status (requires gh cli)
129
+ wt ls --json # Output as JSON for scripting
130
+ wt ls --verbose # Show more details
117
131
  ```
118
132
 
119
- **Interactive mode** (enabled by default when running in a terminal):
120
-
121
- When running in a TTY terminal, `lswt` enters interactive mode where you can select a worktree and perform actions:
122
-
123
- | Shortcut | Action |
124
- | -------- | ------------------------------------------ |
125
- | `e` | Open in editor (VSCode or Cursor) |
126
- | `t` | Open terminal at worktree path |
127
- | `p` | Open PR in browser / Create PR from branch |
128
- | `d` | Show worktree details |
129
- | `c` | Copy path to clipboard |
130
- | `l` | Link config files (via wtlink) |
131
- | `r` | Remove worktree (not available for main) |
132
- | `q` | Quit |
133
-
134
- **Fuzzy search** — Press `/` to enter search mode and filter worktrees by:
135
-
136
- - Branch name (`dark-mode`, `feat/auth`)
137
- - PR number (`#42`, `42`)
138
- - PR title (`Add dark mode`)
139
- - PR state (`OPEN`, `MERGED`, `CLOSED`)
133
+ **Interactive Mode Shortcuts**:
140
134
 
141
- The search uses fuzzy matching, so typing `dm` will match `dark-mode`. Press `Enter` to confirm the filter, `Escape` to cancel, or `Backspace` to edit.
135
+ | Key | Action |
136
+ | --- | ------------------------------------------ |
137
+ | `e` | Open in editor (VS Code or Cursor) |
138
+ | `t` | Open terminal at worktree path |
139
+ | `p` | Open PR in browser / Create PR from branch |
140
+ | `d` | Show worktree details |
141
+ | `c` | Copy path to clipboard |
142
+ | `l` | Link config files (via wtlink) |
143
+ | `r` | Remove worktree (not available for main) |
144
+ | `/` | Fuzzy search worktrees |
145
+ | `q` | Quit |
142
146
 
143
- Use `--no-interactive` to disable interactive mode, or pipe output to automatically switch to list mode.
147
+ ### wt clean / cleanpr
144
148
 
145
- ### wtlink
146
-
147
- Interactive CLI for managing configuration file links between git worktrees. Share config files while keeping build artifacts separate using hard links and a manifest file.
149
+ Clean up worktrees for merged or closed PRs.
148
150
 
149
151
  ```bash
150
- wtlink # Interactive main menu
151
- wtlink manage # Interactive file browser to select files to share
152
- wtlink link # Create hard links based on manifest
153
- wtlink link ../my-app.pr42 # Link to specific worktree
154
- wtlink validate # Verify manifest integrity
152
+ wt clean # Interactive cleanup
153
+ wt clean --all # Clean all merged/closed automatically
154
+ wt clean --force # Force remove even if not merged
155
+ wt clean --dry-run # Preview what would be cleaned
155
156
  ```
156
157
 
157
- **Command options:**
158
-
159
- ```bash
160
- # manage - Discover and manage the manifest
161
- wtlink manage # Interactive mode
162
- wtlink manage --non-interactive # Auto-add new files as commented
163
- wtlink manage --clean # Remove stale entries automatically
164
- wtlink manage --dry-run # Preview changes without writing
165
- wtlink manage --backup # Create .wtlinkrc.bak before updating
158
+ ### wt link / wtlink
166
159
 
167
- # link - Create links between worktrees
168
- wtlink link [source] [dest] # Link from source to destination
169
- wtlink link --dry-run # Preview what would be linked
170
- wtlink link --type symbolic # Use symlinks instead of hard links
171
- wtlink link --yes # Skip confirmation prompts
160
+ Interactive CLI for managing configuration file links between git worktrees.
172
161
 
173
- # validate - Check manifest integrity
174
- wtlink validate # Validate against current worktree
175
- wtlink validate ../other-wt # Validate against specific source
162
+ ```bash
163
+ wt link # Interactive main menu
164
+ wt link manage # Interactive file browser
165
+ wt link link # Create hard links based on manifest
166
+ wt link link ../my-app.pr42 # Link to specific worktree
167
+ wt link validate # Verify manifest integrity
176
168
  ```
177
169
 
178
- **How it works:**
179
-
180
- 1. **Discover** — Scans for git-ignored files in your repository
181
- 2. **Decide** — Interactive UI to categorize each file (link, track, or skip)
182
- 3. **Link** — Creates hard links from main worktree to feature worktrees
183
- 4. **Validate** — Ensures manifest entries exist and remain git-ignored
184
-
185
- **Interactive UI navigation:**
186
-
187
- | Key | Action |
188
- | --- | ------------------------------------------------ |
189
- | ↑/↓ | Navigate file list |
190
- | ←/→ | Navigate into/out of folders (hierarchical view) |
191
- | A | Mark as "Will Link" (added to manifest) |
192
- | C | Mark as "Track" (commented in manifest) |
193
- | S | Mark as "Skip" (not in manifest) |
194
- | 0 | Toggle showing undecided items |
195
- | 1 | Toggle showing "Will Link" items |
196
- | 2 | Toggle showing "Track" items |
197
- | 3 | Toggle showing "Skip" items |
198
- | V | Toggle hierarchical/flat view |
199
- | ? | Show help |
200
- | Q | Save and quit |
201
- | X | Cancel without saving |
202
-
203
- **Folder operations:** Actions on folders apply to all files inside. The UI shows a breakdown of child states for each folder.
204
-
205
- **Safety confirmations:** Before linking, the tool shows source and destination worktrees with their branch names and warns about potentially dangerous operations:
206
-
207
- - **Yellow warning** — Source is not on a base branch (main/master/develop). This is unusual since config files should typically flow from main to feature branches.
208
- - **Red warning** — Destination is a base branch. This would overwrite your main worktree's config files, which is usually not intended.
209
-
210
- The tool recognizes `main`, `master`, and `develop` as base branches. Use `--yes` to skip these confirmations if you're sure about your operation.
211
-
212
- **Conflict detection:** When linking, if a file already exists at the destination with different content, you'll be prompted to:
213
-
214
- - **Replace** — Delete destination and create link
215
- - **Ignore** — Keep destination file as-is
216
- - **Remove** — Remove entry from manifest
217
-
218
- **Manifest format (`.wtlinkrc`):**
219
-
220
- The manifest lives in your repository root and tracks which files to share:
170
+ **Manifest format (`.wtlink`):**
221
171
 
222
172
  ```text
223
173
  .vscode/settings.json
@@ -227,237 +177,123 @@ The manifest lives in your repository root and tracks which files to share:
227
177
  ```
228
178
 
229
179
  - Active entries (no `#`) are hard-linked between worktrees
230
- - Commented entries (`#`) are tracked but not currently linked
231
- - Files marked "Skip" are not added to the manifest at all
180
+ - Commented entries (`#`) are tracked but not linked
232
181
 
233
182
  **Best practices:**
234
183
 
235
- **Good candidates for linking:**
236
-
237
- - `.vscode/settings.json`, `.editorconfig` — Editor config
238
- - `.env.local`, `.env.development` — Local environment variables
239
- - `certificates/`, `credentials/` — Local dev certificates
240
-
241
- ❌ **Not suitable for linking:**
184
+ - **Good for linking:** `.vscode/settings.json`, `.editorconfig`, `.env.local`, certificates
185
+ - **Not for linking:** `node_modules/`, `dist/`, `build/`, `.git/`
242
186
 
243
- - `node_modules/` — Use [pnpm](https://pnpm.io) for shared dependencies instead
244
- - `dist/`, `build/` — Build artifacts should be separate per worktree
245
- - `.git/` — Never link git internals
187
+ See [wtlink documentation](#wtlink-details) for full details.
246
188
 
247
- ### wtstate
189
+ ### wt state / wtstate
248
190
 
249
- Query the current git state for AI agents and automation. Returns structured information about the repository state, available actions, and recommended next steps.
191
+ Query the current git state for AI agents and automation.
250
192
 
251
193
  ```bash
252
- wtstate # Human-readable output
253
- wtstate --json # Machine-readable JSON output
254
- wtstate --verbose # Include file lists and commit details
255
- wtstate --base dev # Specify base branch (default: main)
194
+ wt state # Human-readable output
195
+ wt state --json # Machine-readable JSON output
196
+ wt state --verbose # Include file lists and commit details
197
+ wt state --base dev # Specify base branch
256
198
  ```
257
199
 
258
200
  **JSON output includes:**
259
201
 
260
- - `scenario` — Current git state scenario (e.g., `main_staged_same`, `branch_with_changes`)
261
- - `scenarioDescription` — Human-readable description
262
- - `currentBranch` — Current branch name (null if detached HEAD)
263
- - `baseBranch` — Base branch for comparison
202
+ - `scenario` — Git state scenario (e.g., `main_staged_same`)
203
+ - `currentBranch` — Current branch name
264
204
  - `worktreeType` — Type: `main_worktree`, `pr_worktree`, or `other`
265
- - `hasChanges`, `hasStagedChanges`, `hasUnstagedChanges` — Change flags
266
- - `localCommits` — List of local commits not in origin
267
205
  - `availableActions` — Actions available for this scenario
268
206
  - `recommendedAction` — Suggested action to take
269
207
 
270
- ### wtconfig
208
+ ### wt config
271
209
 
272
- Configuration management with an interactive setup wizard.
210
+ Configuration management with interactive editing.
273
211
 
274
212
  ```bash
275
- wtconfig init # Run interactive setup wizard
276
- wtconfig show # Show current configuration
277
- wtconfig set <key> <val> # Set a configuration value
278
- wtconfig get <key> # Get a configuration value
279
- wtconfig edit # Open config in default editor
280
- wtconfig validate # Validate configuration
213
+ wt config # Interactive config editor
214
+ wt cfg init # Run setup wizard (alias for wt init)
215
+ wt cfg show # Show current configuration
216
+ wt cfg set key value # Set a configuration value
217
+ wt cfg get key # Get a configuration value
218
+ wt cfg edit # Open config in default editor
219
+ wt cfg validate # Validate configuration
220
+ wt cfg schema # Show JSON schema URL
281
221
  ```
282
222
 
283
- **Setup wizard detects:**
284
-
285
- - Operating system and installed tools
286
- - Git configuration (version, user, email)
287
- - GitHub CLI authentication
288
- - Available AI tools (Claude Code, Gemini CLI, Ollama)
289
- - Package manager (npm, pnpm, yarn, bun)
290
- - IDE availability (VS Code, Cursor)
291
-
292
- **Configuration locations:**
293
-
294
- - **Global:** `~/.worktreerc` (applies to all repos)
295
- - **Repository:** `.worktreerc` or `.worktreerc.json` (repo-specific)
223
+ ### wt init
296
224
 
297
- Repository config overrides global settings.
298
-
299
- **Example AI workflow:**
225
+ Initialize git-worktree-tools configuration.
300
226
 
301
227
  ```bash
302
- # 1. Query state
303
- STATE=$(wtstate --json)
304
-
305
- # 2. Extract recommended action
306
- ACTION=$(echo $STATE | jq -r '.data.recommendedAction')
307
-
308
- # 3. Execute with chosen action
309
- newpr "Add feature" --non-interactive --action=$ACTION --json
228
+ wt init # Interactive initialization
229
+ wt init --local # Create local config (gitignored)
230
+ wt init --global # Create global config
231
+ wt init --force # Overwrite existing config
310
232
  ```
311
233
 
312
- ## AI Tool Integration
313
-
314
- All commands support `--json` for machine-readable output, enabling integration with AI CLI tools like Claude Code, Gemini CLI, and Codex.
234
+ ---
315
235
 
316
- > **Comprehensive Guide:** See [docs/AI-TOOLING.md](docs/AI-TOOLING.md) for detailed documentation including programmatic API, error codes, lifecycle hooks, and integration examples.
317
-
318
- ### Quick Start for AI Agents
236
+ ## Configuration
319
237
 
320
- The recommended workflow is a three-step "look before you leap" pattern:
238
+ git-worktree-tools uses a three-tier configuration system:
321
239
 
322
- ```bash
323
- # 1. Query current git state
324
- STATE=$(wtstate --json)
325
-
326
- # 2. Extract recommended action
327
- ACTION=$(echo $STATE | jq -r '.data.recommendedAction')
240
+ | Level | File | Purpose | Git Status |
241
+ | ------ | ------------------------------------------ | -------------------- | ---------- |
242
+ | Local | `.worktreerc.local` | Personal overrides | gitignored |
243
+ | Repo | `.worktreerc` or `.worktreerc.json` | Shared team settings | committed |
244
+ | Global | `~/.config/git-worktree-tools/config.json` | User-wide defaults | N/A |
328
245
 
329
- # 3. Execute with the chosen action
330
- newpr "Add feature X" --non-interactive --action=$ACTION --json
331
- ```
246
+ **Merge order:** defaults global repo ← local
332
247
 
333
- ### Non-Interactive Mode
248
+ ### Creating Configuration
334
249
 
335
250
  ```bash
336
- # Create PR without prompts
337
- newpr "Feature X" --non-interactive --json
338
- newpr "Fix bug" --non-interactive --action=commit_staged --json
251
+ # Interactive setup (recommended)
252
+ wt init
339
253
 
340
- # Clean PRs with dry-run preview
341
- cleanpr --all --dry-run --json
342
- cleanpr --all --json
343
-
344
- # Link configs without prompts
345
- wtlink link --yes --json
254
+ # Or create specific configs
255
+ wt init --global # User-wide defaults
256
+ wt init --local # Personal repo overrides
346
257
  ```
347
258
 
348
- ### JSON Output Schema
349
-
350
- All commands return consistent JSON:
351
-
352
- ```typescript
353
- interface CommandResult<T> {
354
- success: boolean; // Whether the command succeeded
355
- command: string; // Command name (e.g., "newpr", "cleanpr")
356
- timestamp: string; // ISO 8601 timestamp
357
- data?: T; // Command-specific data (on success)
358
- error?: {
359
- // Error details (on failure)
360
- code: string; // Machine-readable error code
361
- message: string; // Human-readable message
362
- };
363
- warnings?: string[]; // Non-fatal warnings
364
- }
365
- ```
366
-
367
- ### Structured Error Codes
368
-
369
- Error codes enable programmatic error handling:
370
-
371
- | Code | Description |
372
- | ---------------------- | ---------------------------- |
373
- | `NOT_GIT_REPO` | Not inside a git repository |
374
- | `GH_NOT_AUTHENTICATED` | GitHub CLI not authenticated |
375
- | `INVALID_ACTION` | Invalid action for scenario |
376
- | `HOOK_FAILED` | Lifecycle hook failed |
377
- | `USER_CANCELLED` | Operation cancelled |
378
- | `PR_CREATE_FAILED` | Failed to create PR |
379
-
380
- See [docs/AI-TOOLING.md](docs/AI-TOOLING.md#structured-error-codes) for the complete list.
381
-
382
- ### Available Actions for `--action` Flag
383
-
384
- | Action | Description |
385
- | ---------------------------- | ------------------------------------------ |
386
- | `empty_commit` | Create empty initial commit |
387
- | `commit_staged` | Commit staged changes to new branch |
388
- | `commit_all` | Stage all and commit to new branch |
389
- | `stash_and_empty` | Stash changes, create empty commit |
390
- | `use_commits` | Use local commits (branch from HEAD) |
391
- | `push_then_branch` | Push to main first, then create branch |
392
- | `use_commits_and_commit_all` | Include commits + commit uncommitted |
393
- | `use_commits_and_stash` | Include commits, stash uncommitted |
394
- | `create_pr_for_branch` | Create PR for existing branch |
395
- | `pr_for_branch_commit_all` | Create PR for branch, commit changes first |
396
- | `pr_for_branch_stash` | Create PR for branch, stash changes |
397
- | `branch_from_detached` | Create branch from detached HEAD |
398
-
399
- ### Programmatic API
400
-
401
- For deeper integration, use the programmatic API:
402
-
403
- ```typescript
404
- import {
405
- queryState,
406
- listWorktrees,
407
- cleanWorktrees,
408
- createPr,
409
- } from '@camaradesuk/git-worktree-tools';
410
-
411
- // Query git state
412
- const state = queryState({ baseBranch: 'main' });
413
- if (state.success) {
414
- console.log(`Scenario: ${state.data.scenario}`);
415
- console.log(`Recommended: ${state.data.recommendedAction}`);
416
- }
417
-
418
- // Create PR
419
- const result = await createPr({
420
- description: 'Add dark mode',
421
- action: 'commit_staged',
422
- draft: true,
423
- });
424
- ```
425
-
426
- See [docs/AI-TOOLING.md](docs/AI-TOOLING.md#programmatic-api) for complete API documentation.
427
-
428
- ## Configuration
429
-
430
- Create a `.worktreerc` file in your repository root, or use `wtconfig init` to generate one interactively:
259
+ ### Example Configuration
431
260
 
432
261
  ```json
433
262
  {
263
+ "$schema": "https://unpkg.com/@camaradesuk/git-worktree-tools/schemas/worktreerc.schema.json",
434
264
  "baseBranch": "main",
435
265
  "draftPr": true,
436
266
  "branchPrefix": "feat",
267
+ "preferredEditor": "vscode",
437
268
  "ai": {
438
269
  "provider": "auto",
439
270
  "branchName": true,
440
271
  "prDescription": true
441
272
  },
442
273
  "hooks": {
443
- "post-worktree": "npm install"
274
+ "post-worktree": ["npm install", "code ."]
275
+ },
276
+ "logging": {
277
+ "level": "info"
444
278
  }
445
279
  }
446
280
  ```
447
281
 
448
- ### Options
449
-
450
- | Option | Type | Default | Description |
451
- | ----------------- | -------- | --------------------- | ---------------------------------------------------------- |
452
- | `sharedRepos` | string[] | `[]` | Sibling repos to also create worktrees for |
453
- | `baseBranch` | string | `"main"` | Base branch for new PRs |
454
- | `draftPr` | boolean | `false` | Create PRs as drafts by default |
455
- | `worktreePattern` | string | `"{repo}.pr{number}"` | Worktree directory naming pattern |
456
- | `worktreeParent` | string | `".."` | Parent directory for worktrees |
457
- | `branchPrefix` | string | `"feat"` | Prefix for auto-generated branch names |
458
- | `preferredEditor` | string | `"vscode"` | Editor for lswt interactive: "vscode", "cursor", or "auto" |
459
- | `ai` | object | `{}` | AI content generation settings (see below) |
460
- | `hooks` | object | `{}` | Lifecycle hook commands (see below) |
282
+ ### Configuration Options
283
+
284
+ | Option | Type | Default | Description |
285
+ | ----------------- | -------- | --------------------- | ------------------------------------------- |
286
+ | `baseBranch` | string | `"main"` | Base branch for new PRs |
287
+ | `draftPr` | boolean | `false` | Create PRs as drafts by default |
288
+ | `worktreePattern` | string | `"{repo}.pr{number}"` | Worktree directory naming pattern |
289
+ | `worktreeParent` | string | `".."` | Parent directory for worktrees |
290
+ | `branchPrefix` | string | `"feat"` | Prefix for auto-generated branch names |
291
+ | `sharedRepos` | string[] | `[]` | Sibling repos to also create worktrees for |
292
+ | `preferredEditor` | string | `"vscode"` | Editor: `"vscode"`, `"cursor"`, or `"auto"` |
293
+ | `syncPatterns` | string[] | `[]` | Patterns to sync between worktrees |
294
+ | `ai` | object | `{}` | AI content generation settings |
295
+ | `hooks` | object | `{}` | Lifecycle hook commands |
296
+ | `logging` | object | `{}` | Logging configuration |
461
297
 
462
298
  ### AI Content Generation
463
299
 
@@ -466,19 +302,20 @@ Enable AI-powered content generation for branch names and PR descriptions:
466
302
  ```json
467
303
  {
468
304
  "ai": {
469
- "provider": "auto", // "auto" | "claude" | "gemini" | "openai" | "ollama" | "none"
470
- "branchName": true, // Generate smart branch names from description
471
- "prTitle": true, // Generate PR titles
472
- "prDescription": true // Generate PR descriptions from changes
305
+ "provider": "auto",
306
+ "branchName": true,
307
+ "prTitle": true,
308
+ "prDescription": true,
309
+ "commitMessage": true
473
310
  }
474
311
  }
475
312
  ```
476
313
 
477
- When `provider` is `"auto"`, the tool detects available AI tools in order: Claude Code → Gemini CLI → Ollama → OpenAI API.
314
+ **Providers:** `"auto"` (detects available tools), `"claude"`, `"gemini"`, `"openai"`, `"ollama"`, `"none"`
478
315
 
479
316
  ### Lifecycle Hooks
480
317
 
481
- Run custom commands at various points in the `newpr` workflow:
318
+ Run custom commands at various points in the workflow:
482
319
 
483
320
  ```json
484
321
  {
@@ -487,110 +324,106 @@ Run custom commands at various points in the `newpr` workflow:
487
324
  "post-pr": ["echo 'PR created!'", "./notify-team.sh"],
488
325
  "pre-branch": {
489
326
  "command": "npm test",
490
- "failOnError": true
327
+ "failOnError": true,
328
+ "timeout": 60000
491
329
  }
492
330
  }
493
331
  }
494
332
  ```
495
333
 
496
- **Available hooks:**
334
+ **Available hooks:** `pre-analyze`, `post-analyze`, `pre-branch`, `post-branch`, `pre-commit`, `post-commit`, `pre-push`, `post-push`, `pre-pr`, `post-pr`, `pre-worktree`, `post-worktree`, `cleanup`
497
335
 
498
- | Hook | Description | Critical |
499
- | --------------- | ------------------------- | -------- |
500
- | `pre-analyze` | Before git state analysis | Yes |
501
- | `post-analyze` | After state analysis | No |
502
- | `pre-branch` | Before branch creation | Yes |
503
- | `post-branch` | After branch creation | No |
504
- | `pre-commit` | Before initial commit | Yes |
505
- | `post-commit` | After initial commit | No |
506
- | `pre-push` | Before push to origin | Yes |
507
- | `post-push` | After push to origin | No |
508
- | `pre-pr` | Before PR creation | Yes |
509
- | `post-pr` | After PR creation | No |
510
- | `pre-worktree` | Before worktree creation | Yes |
511
- | `post-worktree` | After worktree creation | No |
512
- | `cleanup` | On error (for rollback) | No |
336
+ **Hook context variables** (environment variables):
513
337
 
514
- **Critical hooks** abort the workflow if they fail. Non-critical hooks show a warning but continue.
338
+ | Variable | Description |
339
+ | ------------------ | ----------------- |
340
+ | `WT_BRANCH_NAME` | New branch name |
341
+ | `WT_PR_NUMBER` | PR number |
342
+ | `WT_PR_URL` | PR URL |
343
+ | `WT_WORKTREE_PATH` | New worktree path |
344
+ | `WT_REPO_ROOT` | Main repo root |
345
+ | `WT_BASE_BRANCH` | Base branch |
346
+ | `WT_DESCRIPTION` | PR description |
515
347
 
516
- **Hook definition formats:**
348
+ ### Logging Configuration
517
349
 
518
350
  ```json
519
351
  {
520
- "hooks": {
521
- // Simple command
522
- "post-worktree": "npm install",
523
-
524
- // Multiple commands (run in sequence)
525
- "post-pr": ["echo 'Done!'", "./scripts/notify.sh"],
526
-
527
- // Complex definition
528
- "pre-commit": {
529
- "command": "npm test",
530
- "timeout": 60000,
531
- "failOnError": true,
532
- "if": "exists:package.json"
533
- }
352
+ "logging": {
353
+ "level": "info",
354
+ "logFile": "/path/to/logfile.log"
534
355
  }
535
356
  }
536
357
  ```
537
358
 
538
- **Hook context variables** (available as environment variables):
359
+ **Levels:** `silent`, `error`, `warn`, `info`, `debug`, `trace`
539
360
 
540
- | Variable | Description |
541
- | ------------------ | ------------------ |
542
- | `WT_BRANCH_NAME` | New branch name |
543
- | `WT_PR_NUMBER` | PR number |
544
- | `WT_PR_URL` | PR URL |
545
- | `WT_WORKTREE_PATH` | New worktree path |
546
- | `WT_REPO_ROOT` | Main repo root |
547
- | `WT_BASE_BRANCH` | Base branch (main) |
548
- | `WT_DESCRIPTION` | PR description |
361
+ CLI flags override config: `-v` (debug), `-vv` (trace), `-q` (silent), `--log-file`
549
362
 
550
- > **Note:** File syncing between worktrees is managed by `wtlink` using its own `.wtlinkrc` manifest. See the [wtlink section](#wtlink) for details.
363
+ ---
551
364
 
552
- ## Example Workflow
365
+ ## AI Tool Integration
366
+
367
+ All commands support `--json` for machine-readable output, enabling integration with AI CLI tools.
368
+
369
+ ### Quick Start for AI Agents
553
370
 
554
371
  ```bash
555
- # Start in your main repo
556
- cd ~/projects/my-app
372
+ # 1. Query current git state
373
+ STATE=$(wt state --json)
557
374
 
558
- # Create a new feature PR
559
- newpr "Add dark mode support"
560
- # → Creates branch: feat/add-dark-mode-support-xyz123
561
- # → Creates PR: #42
562
- # → Creates worktree: ~/projects/my-app.pr42
563
- # → Switches to worktree
375
+ # 2. Extract recommended action
376
+ ACTION=$(echo $STATE | jq -r '.data.recommendedAction')
564
377
 
565
- # Work on the feature in the dedicated worktree
566
- # ... make changes, commit, push ...
378
+ # 3. Execute with the chosen action
379
+ wt new "Add feature X" --non-interactive --action=$ACTION --json
380
+ ```
567
381
 
568
- # Need to work on another feature? No problem!
569
- cd ~/projects/my-app
570
- newpr "Fix login bug"
571
- # → Creates another worktree: ~/projects/my-app.pr43
382
+ ### Non-Interactive Mode
572
383
 
573
- # List your worktrees
574
- lswt
575
- # WORKTREE BRANCH PR STATUS
576
- # ~/projects/my-app main - -
577
- # ~/projects/my-app.pr42 feat/add-dark-mode-xyz123 #42 open
578
- # ~/projects/my-app.pr43 feat/fix-login-bug-abc456 #43 open
384
+ ```bash
385
+ wt new "Feature" --non-interactive --json
386
+ wt clean --all --json
387
+ wt link link --yes --json
388
+ ```
579
389
 
580
- # After PRs are merged, clean up
581
- cleanpr
582
- # → Removes worktrees for merged PRs
583
- # Deletes local branches
390
+ ### JSON Response Schema
391
+
392
+ ```typescript
393
+ interface CommandResult<T> {
394
+ success: boolean;
395
+ command: string;
396
+ timestamp: string;
397
+ data?: T;
398
+ error?: { code: string; message: string };
399
+ warnings?: string[];
400
+ }
401
+ ```
402
+
403
+ ### Programmatic API
404
+
405
+ ```typescript
406
+ import { queryState, createPr, listWorktrees } from '@camaradesuk/git-worktree-tools';
407
+
408
+ const state = queryState({ baseBranch: 'main' });
409
+ const result = await createPr({
410
+ description: 'Add dark mode',
411
+ action: 'commit_staged',
412
+ draft: true,
413
+ });
584
414
  ```
585
415
 
416
+ See [docs/AI-TOOLING.md](docs/AI-TOOLING.md) for comprehensive AI integration documentation including error codes, available actions, and integration examples.
417
+
418
+ ---
419
+
586
420
  ## Shell Completion
587
421
 
588
- Enable tab completion for `wt` commands in your shell:
422
+ Enable tab completion for `wt` commands:
589
423
 
590
424
  ### Bash
591
425
 
592
426
  ```bash
593
- # Add to ~/.bashrc
594
427
  wt completion bash >> ~/.bashrc
595
428
  source ~/.bashrc
596
429
  ```
@@ -598,13 +431,9 @@ source ~/.bashrc
598
431
  ### Zsh
599
432
 
600
433
  ```bash
601
- # Create completion directory and add completion
602
434
  mkdir -p ~/.zsh/completions
603
435
  wt completion zsh > ~/.zsh/completions/_wt
604
-
605
- # Add to ~/.zshrc (if not already present)
606
- fpath=(~/.zsh/completions $fpath)
607
- autoload -Uz compinit && compinit
436
+ # Add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)
608
437
  ```
609
438
 
610
439
  ### Fish
@@ -613,35 +442,95 @@ autoload -Uz compinit && compinit
613
442
  wt completion fish > ~/.config/fish/completions/wt.fish
614
443
  ```
615
444
 
616
- After setup, you can tab-complete commands and options:
445
+ ---
446
+
447
+ ## wtlink Details
448
+
449
+ The `wtlink` command provides an interactive TUI for managing configuration file links.
450
+
451
+ ### Interactive UI Navigation
452
+
453
+ | Key | Action |
454
+ | --- | ------------------------------------------------ |
455
+ | ↑/↓ | Navigate file list |
456
+ | ←/→ | Navigate into/out of folders (hierarchical view) |
457
+ | A | Mark as "Will Link" (added to manifest) |
458
+ | C | Mark as "Track" (commented in manifest) |
459
+ | S | Mark as "Skip" (not in manifest) |
460
+ | 0-3 | Toggle filter visibility |
461
+ | V | Toggle hierarchical/flat view |
462
+ | ? | Show help |
463
+ | Q | Save and quit |
464
+ | X | Cancel without saving |
465
+
466
+ ### Command Options
617
467
 
618
468
  ```bash
619
- wt <TAB> # Shows: new, list, clean, link, state, config, completion
620
- wt new --<TAB> # Shows: --pr, --draft, --json, --non-interactive, --action
621
- wt list --<TAB> # Shows: --verbose, --json, --no-status, --no-interactive
469
+ # manage - Discover and manage the manifest
470
+ wtlink manage # Interactive mode
471
+ wtlink manage --non-interactive # Auto-add new files as commented
472
+ wtlink manage --clean # Remove stale entries
473
+ wtlink manage --dry-run # Preview changes
474
+
475
+ # link - Create links between worktrees
476
+ wtlink link [source] [dest] # Link from source to destination
477
+ wtlink link --dry-run # Preview what would be linked
478
+ wtlink link --type symbolic # Use symlinks instead of hard links
479
+ wtlink link --yes # Skip confirmation prompts
480
+
481
+ # validate - Check manifest integrity
482
+ wtlink validate # Validate against current worktree
622
483
  ```
623
484
 
485
+ ---
486
+
487
+ ## Example Workflow
488
+
489
+ ```bash
490
+ # Start in your main repo
491
+ cd ~/projects/my-app
492
+
493
+ # Create a new feature PR
494
+ wt new "Add dark mode support"
495
+ # → Creates branch: feat/add-dark-mode-support-xyz123
496
+ # → Creates PR: #42
497
+ # → Creates worktree: ~/projects/my-app.pr42
498
+ # → Runs post-worktree hooks (npm install, etc.)
499
+
500
+ # Work on the feature in the dedicated worktree
501
+ # ... make changes, commit, push ...
502
+
503
+ # Need another feature? No problem!
504
+ cd ~/projects/my-app
505
+ wt new "Fix login bug"
506
+ # → Creates worktree: ~/projects/my-app.pr43
507
+
508
+ # List your worktrees
509
+ wt list
510
+ # Interactive selection with PR status
511
+
512
+ # After PRs are merged, clean up
513
+ wt clean
514
+ # → Removes worktrees for merged PRs
515
+ # → Deletes local branches
516
+ ```
517
+
518
+ ---
519
+
624
520
  ## Development
625
521
 
626
522
  ```bash
627
- # Clone the repo
628
523
  git clone https://github.com/camaradesuk/git-worktree-tools.git
629
524
  cd git-worktree-tools
630
-
631
- # Install dependencies
632
525
  npm install
633
-
634
- # Build
635
526
  npm run build
636
-
637
- # Test
638
527
  npm test
639
-
640
- # Link for local development
641
- npm link
528
+ npm link # For local development
642
529
  ```
643
530
 
644
- See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for detailed local development instructions, including how to test CLI commands without affecting your global install.
531
+ See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for detailed development instructions.
532
+
533
+ ---
645
534
 
646
535
  ## License
647
536