@joberthel/worktree 1.1.0 → 1.3.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 +19 -8
- package/dist/cli-spec.js +33 -5
- package/dist/cli.js +209 -51
- package/dist/cli.test/harness.js +64 -0
- package/dist/config/json-schema.js +37 -0
- package/dist/config/load.js +4 -3
- package/dist/config/schema.js +17 -15
- package/dist/docker/compose.js +2 -1
- package/dist/docker/ports.js +43 -0
- package/dist/errors.js +66 -0
- package/dist/git/repository.js +4 -3
- package/dist/operations/attached.js +8 -7
- package/dist/operations/commands.js +2 -1
- package/dist/operations/confirmation.js +13 -1
- package/dist/operations/create.js +11 -10
- package/dist/operations/manage.js +14 -11
- package/dist/operations/process.js +3 -2
- package/dist/state/store.js +4 -3
- package/dist/ui/environment-info.js +12 -0
- package/dist/ui/json-output.js +6 -1
- package/package.json +4 -2
- package/schema/wt.schema.json +208 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/@joberthel/worktree@1/schema/wt.schema.json",
|
|
4
|
+
"title": "wt configuration",
|
|
5
|
+
"description": "Configuration for wt, read from .wt.yml at the root of the source checkout.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"host": {
|
|
9
|
+
"description": "Runs this repository inside the Docker environment of a host repository. Cannot be combined with `worktrees`.",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"path": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1,
|
|
15
|
+
"description": "Root of the host checkout, absolute or relative to this checkout."
|
|
16
|
+
},
|
|
17
|
+
"from": {
|
|
18
|
+
"description": "Host ref to check out. Defaults to the host checkout's HEAD.",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"minLength": 1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": [
|
|
24
|
+
"path"
|
|
25
|
+
],
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
},
|
|
28
|
+
"worktrees": {
|
|
29
|
+
"description": "Worktree placement.",
|
|
30
|
+
"default": {
|
|
31
|
+
"directory": "../worktrees"
|
|
32
|
+
},
|
|
33
|
+
"anyOf": [
|
|
34
|
+
{
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"directory": {
|
|
38
|
+
"default": "../worktrees",
|
|
39
|
+
"description": "Where worktrees are created, absolute or relative to the main checkout.",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"minLength": 1
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "null"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"copy": {
|
|
52
|
+
"description": "Relative files and directories copied from the source checkout into each new worktree. Entries must not overlap.",
|
|
53
|
+
"anyOf": [
|
|
54
|
+
{
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"minLength": 1
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "null"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"hooks": {
|
|
67
|
+
"description": "Commands run by `wt create` and `wt reset`.",
|
|
68
|
+
"anyOf": [
|
|
69
|
+
{
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"worktree": {
|
|
73
|
+
"description": "Hooks that run in the new worktree.",
|
|
74
|
+
"anyOf": [
|
|
75
|
+
{
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"before_create": {
|
|
79
|
+
"description": "Runs after the worktree, copied files, and cloned volumes are in place, before Docker Compose starts the services.",
|
|
80
|
+
"anyOf": [
|
|
81
|
+
{
|
|
82
|
+
"description": "Path to an executable, relative to the directory the hook runs in.",
|
|
83
|
+
"type": "string",
|
|
84
|
+
"minLength": 1
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties": {
|
|
89
|
+
"script": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "Inline shell script run with /bin/sh. Start it with `set -eu` to stop at the first failure."
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"required": [
|
|
95
|
+
"script"
|
|
96
|
+
],
|
|
97
|
+
"additionalProperties": false
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"after_create": {
|
|
102
|
+
"description": "Runs after Docker Compose has started the services.",
|
|
103
|
+
"anyOf": [
|
|
104
|
+
{
|
|
105
|
+
"description": "Path to an executable, relative to the directory the hook runs in.",
|
|
106
|
+
"type": "string",
|
|
107
|
+
"minLength": 1
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"script": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Inline shell script run with /bin/sh. Start it with `set -eu` to stop at the first failure."
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"required": [
|
|
118
|
+
"script"
|
|
119
|
+
],
|
|
120
|
+
"additionalProperties": false
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"additionalProperties": false
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "null"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"source": {
|
|
133
|
+
"description": "Hooks that run in the source checkout.",
|
|
134
|
+
"anyOf": [
|
|
135
|
+
{
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"before_create": {
|
|
139
|
+
"description": "Runs after the worktree, copied files, and cloned volumes are in place, before Docker Compose starts the services.",
|
|
140
|
+
"anyOf": [
|
|
141
|
+
{
|
|
142
|
+
"description": "Path to an executable, relative to the directory the hook runs in.",
|
|
143
|
+
"type": "string",
|
|
144
|
+
"minLength": 1
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"type": "object",
|
|
148
|
+
"properties": {
|
|
149
|
+
"script": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "Inline shell script run with /bin/sh. Start it with `set -eu` to stop at the first failure."
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"required": [
|
|
155
|
+
"script"
|
|
156
|
+
],
|
|
157
|
+
"additionalProperties": false
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"after_create": {
|
|
162
|
+
"description": "Runs after Docker Compose has started the services.",
|
|
163
|
+
"anyOf": [
|
|
164
|
+
{
|
|
165
|
+
"description": "Path to an executable, relative to the directory the hook runs in.",
|
|
166
|
+
"type": "string",
|
|
167
|
+
"minLength": 1
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {
|
|
172
|
+
"script": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"description": "Inline shell script run with /bin/sh. Start it with `set -eu` to stop at the first failure."
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": [
|
|
178
|
+
"script"
|
|
179
|
+
],
|
|
180
|
+
"additionalProperties": false
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"additionalProperties": false
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "null"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"type": "null"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"additionalProperties": false,
|
|
202
|
+
"not": {
|
|
203
|
+
"required": [
|
|
204
|
+
"host",
|
|
205
|
+
"worktrees"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}
|