@junheep/gwt 0.3.0 → 0.5.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 +54 -41
- package/bin/gwt.mjs +725 -91
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,9 +29,11 @@ gwt shell install zsh
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
The installer shows the line it will add to `~/.zshrc` and asks for
|
|
32
|
-
confirmation. The integration also provides Zsh completion
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
confirmation. The integration also provides Zsh completion, which lists one
|
|
33
|
+
row per worktree and completes worktree IDs as well as the branch names it
|
|
34
|
+
shows. It also automatically loads assigned ports and configured environment
|
|
35
|
+
variables when Zsh enters a managed worktree. Previous values are restored
|
|
36
|
+
when Zsh leaves it. Normal environment synchronization produces no output.
|
|
35
37
|
|
|
36
38
|
## Coding agents
|
|
37
39
|
|
|
@@ -56,14 +58,10 @@ the installed skill is identical:
|
|
|
56
58
|
`--project` writes into the primary worktree so the skill can be committed for
|
|
57
59
|
the team.
|
|
58
60
|
|
|
59
|
-
The skill covers what
|
|
60
|
-
`git worktree`,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
details instead of repeating them, so it does not go stale as gwt changes.
|
|
64
|
-
Reinstall after upgrading to pick up a revised skill; an unchanged file is
|
|
65
|
-
reported as already installed, and a modified one is replaced only after
|
|
66
|
-
confirmation.
|
|
61
|
+
The skill covers what the help does not: when to prefer gwt over native
|
|
62
|
+
`git worktree`, which commands are destructive, and the traps worth knowing. It
|
|
63
|
+
points at `gwt <command> --help` for command details rather than repeating
|
|
64
|
+
them. Reinstall after upgrading gwt to pick up a revised skill.
|
|
67
65
|
|
|
68
66
|
## Configuration
|
|
69
67
|
|
|
@@ -90,6 +88,9 @@ Repositories without a remote use their canonical path.
|
|
|
90
88
|
"WEB_PORT",
|
|
91
89
|
"SERVER_PORT"
|
|
92
90
|
],
|
|
91
|
+
"env": {
|
|
92
|
+
"NEXT_PUBLIC_API_ENDPOINT": "http://127.0.0.1:${SERVER_PORT}"
|
|
93
|
+
},
|
|
93
94
|
"postCreate": "hooks/worktree-setup",
|
|
94
95
|
"preRemove": "hooks/worktree-cleanup"
|
|
95
96
|
}
|
|
@@ -121,6 +122,9 @@ The project file contains the configuration fields directly:
|
|
|
121
122
|
"WEB_PORT",
|
|
122
123
|
"SERVER_PORT"
|
|
123
124
|
],
|
|
125
|
+
"env": {
|
|
126
|
+
"NEXT_PUBLIC_API_ENDPOINT": "http://127.0.0.1:${SERVER_PORT}"
|
|
127
|
+
},
|
|
124
128
|
"postCreate": "./scripts/worktree-setup",
|
|
125
129
|
"preRemove": "./scripts/worktree-cleanup"
|
|
126
130
|
}
|
|
@@ -145,6 +149,10 @@ current commit as their base and run no setup actions.
|
|
|
145
149
|
overwriting an existing destination.
|
|
146
150
|
- `ports`: Environment variable names assigned stable ports in the range
|
|
147
151
|
20000–39999.
|
|
152
|
+
- `env`: Environment variables loaded alongside assigned ports. Values are
|
|
153
|
+
literal strings with optional `${PORT_NAME}` references to names declared in
|
|
154
|
+
`ports`. Shell expressions and references to arbitrary process variables are
|
|
155
|
+
not evaluated.
|
|
148
156
|
- `postCreate`: Executable run after files and ports are prepared.
|
|
149
157
|
- `preRemove`: Executable run before removal.
|
|
150
158
|
|
|
@@ -170,6 +178,7 @@ GWT_PATH
|
|
|
170
178
|
GWT_PRIMARY_PATH
|
|
171
179
|
GWT_BRANCH
|
|
172
180
|
<each name declared in ports>
|
|
181
|
+
<each name declared in env>
|
|
173
182
|
```
|
|
174
183
|
|
|
175
184
|
Example `postCreate` hook:
|
|
@@ -187,25 +196,30 @@ Hook paths in user config are resolved relative to the directory containing
|
|
|
187
196
|
worktree. Both run with the target worktree as their working directory, and
|
|
188
197
|
their standard output and errors are streamed directly to the terminal.
|
|
189
198
|
|
|
190
|
-
|
|
191
|
-
from a committed `.gwt.json` require explicit trust
|
|
192
|
-
repository
|
|
199
|
+
User configuration is trusted because the user added it directly. Ports and
|
|
200
|
+
environment variables from a committed `.gwt.json` require explicit trust
|
|
201
|
+
because they automatically change the shell; repository hooks require the same
|
|
202
|
+
approval because they execute code:
|
|
193
203
|
|
|
194
204
|
```sh
|
|
195
205
|
gwt trust
|
|
196
206
|
```
|
|
197
207
|
|
|
198
|
-
Approval is invalidated when `.gwt.json` or either hook changes.
|
|
208
|
+
Approval is invalidated when `.gwt.json` or either hook changes. `gwt remove`
|
|
209
|
+
asks for approval only when `preRemove` is configured, because removal applies
|
|
210
|
+
nothing else from the configuration.
|
|
199
211
|
|
|
200
212
|
## Commands
|
|
201
213
|
|
|
202
214
|
```sh
|
|
203
|
-
gwt new [branch] [--base <ref>] [--no-hooks]
|
|
204
|
-
gwt setup [id|branch|path] [--no-hooks]
|
|
215
|
+
gwt new [branch] [--base <ref>] [--no-hooks] [--background]
|
|
216
|
+
gwt setup [id|branch|path] [--no-hooks] [--background]
|
|
205
217
|
gwt list
|
|
206
|
-
gwt
|
|
218
|
+
gwt ls
|
|
219
|
+
gwt switch [primary|id|branch|path] [--create]
|
|
207
220
|
gwt info [primary|id|branch|path]
|
|
208
221
|
gwt remove [id|branch|path] [--keep-branch|--discard] [--yes] [--no-hooks]
|
|
222
|
+
gwt prune [--dry-run] [--yes]
|
|
209
223
|
gwt trust [--revoke]
|
|
210
224
|
gwt config create [--project]
|
|
211
225
|
gwt config show
|
|
@@ -213,26 +227,25 @@ gwt shell install zsh [--dry-run] [--yes]
|
|
|
213
227
|
gwt skill install <claude|codex> [--project] [--dry-run] [--yes]
|
|
214
228
|
```
|
|
215
229
|
|
|
216
|
-
Run `gwt --help` for the
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
`gwt
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
worktree removal and forced branch deletion.
|
|
230
|
+
Run `gwt --help` for the overview, or `gwt <command> --help` for arguments,
|
|
231
|
+
options, behavior, and examples. Nested commands such as `gwt config create
|
|
232
|
+
--help` have their own help.
|
|
233
|
+
|
|
234
|
+
What the listing does not show:
|
|
235
|
+
|
|
236
|
+
- **Branches.** `gwt new` without an argument creates `scratch/<id>`. With one,
|
|
237
|
+
it reuses an existing local branch, or creates a branch tracking the remote
|
|
238
|
+
when the name exists on exactly one remote; `--base` always means "new
|
|
239
|
+
branch". `gwt switch <branch>` offers to create a worktree for a branch that
|
|
240
|
+
has none, and `--create` skips the question when running non-interactively.
|
|
241
|
+
- **Background setup.** `--background` detaches `postCreate` and returns once
|
|
242
|
+
files are copied and ports assigned, logging to `.git/gwt/logs/<id>.log`.
|
|
243
|
+
`gwt list` reports the worktree as `running`, or `interrupted` if the process
|
|
244
|
+
disappears.
|
|
245
|
+
- **Cleanup.** `gwt remove` also deletes the `scratch/<id>` branch a worktree
|
|
246
|
+
moved off, but only when the branch it moved to already contains those
|
|
247
|
+
commits. `gwt prune` clears records left by worktrees removed outside gwt,
|
|
248
|
+
including their scratch branches; it reports what it found and asks first.
|
|
249
|
+
- **State.** IDs, assigned ports, and setup status live in
|
|
250
|
+
`.git/gwt/worktrees/`. `gwt info` prints a worktree's ports and environment
|
|
251
|
+
exactly as the shell integration loads them.
|