@woosau/dsh-custom-env 0.1.8 → 0.1.10
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 +28 -11
- package/README.zh-CN.md +28 -11
- package/lib/client.js +682 -408
- package/lib/index.js +337 -19
- package/lib/typert.host.js +407 -465
- package/lib/typert.remote-client.d.ts +2 -1
- package/lib/typert.remote-client.js +371 -373
- package/lib/types/client/EnvSettingsSection.d.ts +7 -3
- package/lib/types/client/locales.d.ts +22 -2
- package/lib/types/group-ids.d.ts +5 -0
- package/lib/types/groups-store.d.ts +73 -0
- package/lib/types/index.d.ts +40 -6
- package/lib/types/os-user-env/write-user-env-child.d.ts +11 -0
- package/lib/types/os-user-env/write-user-env.child.d.ts +4 -0
- package/lib/types/types.d.ts +22 -0
- package/lib/write-user-env.child.js +158 -0
- package/package.json +2 -1
package/lib/typert.host.js
CHANGED
|
@@ -1,465 +1,407 @@
|
|
|
1
|
-
/*
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}).readonly()).readonly())
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
type: 'object',
|
|
72
|
-
properties: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
sourceLocation:
|
|
174
|
-
},
|
|
175
|
-
'customEnv/
|
|
176
|
-
service: 'customEnv',
|
|
177
|
-
description: 'Create or
|
|
178
|
-
invocation: { kind: 'direct' },
|
|
179
|
-
parameters: [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
{
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
kind: 'method',
|
|
411
|
-
name: 'setVar',
|
|
412
|
-
signature: "@Remote('setVar') async setVar(name: string, value: string): Promise<void>",
|
|
413
|
-
summary: 'Create or replace one variable by name (empty value allowed).',
|
|
414
|
-
jsDoc: '/** Create or replace one variable by name. Empty value allowed. */',
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
kind: 'method',
|
|
418
|
-
name: 'removeVars',
|
|
419
|
-
signature: "@Remote('removeVars') async removeVars(names: readonly string[]): Promise<number>",
|
|
420
|
-
summary: 'Remove many variables by name.',
|
|
421
|
-
jsDoc: '/** Remove many variables by name. Returns how many lines were removed. */',
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
kind: 'method',
|
|
425
|
-
name: 'removeVar',
|
|
426
|
-
signature: "@Remote('removeVar') async removeVar(name: string): Promise<boolean>",
|
|
427
|
-
summary: 'Remove one variable by name.',
|
|
428
|
-
jsDoc: '/** Remove one variable by name. Returns whether a line was removed. */',
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
kind: 'method',
|
|
432
|
-
name: 'deleteEntry',
|
|
433
|
-
signature: "@Remote('deleteEntry') async deleteEntry(id: string): Promise<EnvSnapshot>",
|
|
434
|
-
summary: 'Delete one row by stable id.',
|
|
435
|
-
jsDoc: '/** Delete one entry by id. */',
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
kind: 'method',
|
|
439
|
-
name: 'restore',
|
|
440
|
-
signature: "@Remote('restore') async restore(id: string): Promise<EnvSnapshot>",
|
|
441
|
-
summary: 'Restore Host-start original name+value for this id.',
|
|
442
|
-
jsDoc: '/** Restore Host-start original name+value for this id. */',
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
kind: 'method',
|
|
446
|
-
name: 'cliStatus',
|
|
447
|
-
signature: "@Remote('cliStatus') async cliStatus(): Promise<CliStatus>",
|
|
448
|
-
summary: 'Compare user-environment dsh with this Host launcher.',
|
|
449
|
-
jsDoc: '/** Compare the user-environment `dsh` with the launcher expected for this Host. */',
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
kind: 'method',
|
|
453
|
-
name: 'cliInstall',
|
|
454
|
-
signature: "@Remote('cliInstall') async cliInstall(): Promise<CliStatus>",
|
|
455
|
-
summary: 'Install expected CLI onto PATH or /usr/local/bin/dsh.',
|
|
456
|
-
jsDoc: '/** Install the expected CLI onto the Windows user PATH or as `/usr/local/bin/dsh` on macOS. */',
|
|
457
|
-
},
|
|
458
|
-
],
|
|
459
|
-
types: [],
|
|
460
|
-
},
|
|
461
|
-
],
|
|
462
|
-
events: [],
|
|
463
|
-
objects: [],
|
|
464
|
-
},
|
|
465
|
-
}
|
|
1
|
+
/* Hand-maintained Host FaceModel for @woosau/dsh-custom-env. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info'
|
|
5
|
+
|
|
6
|
+
const envGroupSchema = () => z.object({
|
|
7
|
+
id: z.string().readonly(),
|
|
8
|
+
title: z.string().readonly(),
|
|
9
|
+
}).readonly()
|
|
10
|
+
|
|
11
|
+
const envEntrySchema = () => z.object({
|
|
12
|
+
id: z.string().readonly(),
|
|
13
|
+
name: z.string().readonly(),
|
|
14
|
+
value: z.string().readonly(),
|
|
15
|
+
groupId: z.string().readonly(),
|
|
16
|
+
kind: z.enum(['unchanged', 'modified', 'added']).readonly(),
|
|
17
|
+
previous: z.string().nullable().readonly(),
|
|
18
|
+
}).readonly()
|
|
19
|
+
|
|
20
|
+
let list$result$schema$value
|
|
21
|
+
const list$result$schema = () => (list$result$schema$value ??= z.object({
|
|
22
|
+
path: z.string().readonly(),
|
|
23
|
+
exists: z.boolean().readonly(),
|
|
24
|
+
groups: z.array(envGroupSchema()).readonly(),
|
|
25
|
+
entries: z.array(envEntrySchema()).readonly(),
|
|
26
|
+
}))
|
|
27
|
+
|
|
28
|
+
let envGroup$result$schema$value
|
|
29
|
+
const envGroup$result$schema = () => (envGroup$result$schema$value ??= envGroupSchema())
|
|
30
|
+
|
|
31
|
+
let cliStatus$result$schema$value
|
|
32
|
+
const cliStatus$result$schema = () => (cliStatus$result$schema$value ??= z.object({
|
|
33
|
+
platform: z.string().readonly(),
|
|
34
|
+
activePath: z.string().nullable().readonly(),
|
|
35
|
+
expectedPath: z.string().nullable().readonly(),
|
|
36
|
+
expectedDirectory: z.string().nullable().readonly(),
|
|
37
|
+
matches: z.boolean().readonly(),
|
|
38
|
+
canInstall: z.boolean().readonly(),
|
|
39
|
+
reason: z.string().nullable().readonly(),
|
|
40
|
+
}))
|
|
41
|
+
|
|
42
|
+
const str = () => z.string()
|
|
43
|
+
|
|
44
|
+
let setVars$parameter$0$schema$value
|
|
45
|
+
const setVars$parameter$0$schema = () => (setVars$parameter$0$schema$value ??= z.array(z.object({
|
|
46
|
+
name: z.string().readonly(),
|
|
47
|
+
value: z.string().readonly(),
|
|
48
|
+
group: z.string().optional(),
|
|
49
|
+
}).readonly()).readonly())
|
|
50
|
+
|
|
51
|
+
let removeVars$parameter$0$schema$value
|
|
52
|
+
const removeVars$parameter$0$schema = () => (removeVars$parameter$0$schema$value ??= z.array(z.string()).readonly())
|
|
53
|
+
|
|
54
|
+
let deleteGroup$parameter$1$schema$value
|
|
55
|
+
const deleteGroup$parameter$1$schema = () => (deleteGroup$parameter$1$schema$value ??= z.object({
|
|
56
|
+
moveToDefault: z.boolean().readonly(),
|
|
57
|
+
}).readonly())
|
|
58
|
+
|
|
59
|
+
const envVarWriteJsonSchema = {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
name: { type: 'string' },
|
|
63
|
+
value: { type: 'string' },
|
|
64
|
+
group: { type: 'string' },
|
|
65
|
+
},
|
|
66
|
+
required: ['name', 'value'],
|
|
67
|
+
additionalProperties: false,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const envGroupJsonSchema = {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
id: { type: 'string' },
|
|
74
|
+
title: { type: 'string' },
|
|
75
|
+
},
|
|
76
|
+
required: ['id', 'title'],
|
|
77
|
+
additionalProperties: true,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const cliStatusJsonSchema = {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
platform: { type: 'string' },
|
|
84
|
+
activePath: { type: ['string', 'null'] },
|
|
85
|
+
expectedPath: { type: ['string', 'null'] },
|
|
86
|
+
expectedDirectory: { type: ['string', 'null'] },
|
|
87
|
+
matches: { type: 'boolean' },
|
|
88
|
+
canInstall: { type: 'boolean' },
|
|
89
|
+
reason: { type: ['string', 'null'] },
|
|
90
|
+
},
|
|
91
|
+
required: ['platform', 'activePath', 'expectedPath', 'expectedDirectory', 'matches', 'canInstall', 'reason'],
|
|
92
|
+
additionalProperties: true,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const envSnapshotJsonSchema = {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
path: { type: 'string' },
|
|
99
|
+
exists: { type: 'boolean' },
|
|
100
|
+
groups: {
|
|
101
|
+
type: 'array',
|
|
102
|
+
items: envGroupJsonSchema,
|
|
103
|
+
},
|
|
104
|
+
entries: {
|
|
105
|
+
type: 'array',
|
|
106
|
+
items: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
id: { type: 'string' },
|
|
110
|
+
name: { type: 'string' },
|
|
111
|
+
value: { type: 'string' },
|
|
112
|
+
groupId: { type: 'string' },
|
|
113
|
+
kind: { type: 'string', enum: ['unchanged', 'modified', 'added'] },
|
|
114
|
+
previous: { type: ['string', 'null'] },
|
|
115
|
+
},
|
|
116
|
+
required: ['id', 'name', 'value', 'groupId', 'kind', 'previous'],
|
|
117
|
+
additionalProperties: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ['path', 'exists', 'groups', 'entries'],
|
|
122
|
+
additionalProperties: true,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const stringParam = (name, description, options = {}) => ({
|
|
126
|
+
name,
|
|
127
|
+
description,
|
|
128
|
+
source: 'json',
|
|
129
|
+
...(options.acceptsUndefined ? { acceptsUndefined: true } : {}),
|
|
130
|
+
codec: {
|
|
131
|
+
mode: 'strict',
|
|
132
|
+
typeSymbol: 'string',
|
|
133
|
+
create: str,
|
|
134
|
+
jsonSchema: { type: 'string' },
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const snapshotResult = (description = 'updated snapshot.') => ({
|
|
139
|
+
mode: 'strict',
|
|
140
|
+
typeSymbol: '@woosau/dsh-custom-env/types#EnvSnapshot',
|
|
141
|
+
create: list$result$schema,
|
|
142
|
+
description,
|
|
143
|
+
jsonSchema: envSnapshotJsonSchema,
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const groupResult = (description = 'group record.') => ({
|
|
147
|
+
mode: 'strict',
|
|
148
|
+
typeSymbol: '@woosau/dsh-custom-env/types#EnvGroup',
|
|
149
|
+
create: envGroup$result$schema,
|
|
150
|
+
description,
|
|
151
|
+
jsonSchema: envGroupJsonSchema,
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
const voidResult = {
|
|
155
|
+
mode: 'strict',
|
|
156
|
+
typeSymbol: 'void',
|
|
157
|
+
create: () => z.undefined(),
|
|
158
|
+
description: 'no return value.',
|
|
159
|
+
jsonSchema: { type: 'null' },
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const src = { file: 'src/index.ts', line: 1, column: 1 }
|
|
163
|
+
|
|
164
|
+
const $remote = createTypertRemoteInfo({
|
|
165
|
+
package: '@woosau/dsh-custom-env',
|
|
166
|
+
methods: {
|
|
167
|
+
'customEnv/list': {
|
|
168
|
+
service: 'customEnv',
|
|
169
|
+
description: 'List current $DSH_HOME/.env entries with groups and pending classification.',
|
|
170
|
+
invocation: { kind: 'direct' },
|
|
171
|
+
parameters: [],
|
|
172
|
+
result: snapshotResult('path, existence, groups, and sorted entries.'),
|
|
173
|
+
sourceLocation: src,
|
|
174
|
+
},
|
|
175
|
+
'customEnv/upsert': {
|
|
176
|
+
service: 'customEnv',
|
|
177
|
+
description: 'Create or update one row. Empty id creates a new row; optional groupId assigns membership.',
|
|
178
|
+
invocation: { kind: 'direct' },
|
|
179
|
+
parameters: [
|
|
180
|
+
stringParam('id', 'stable row id from list(), or empty string for a new row.'),
|
|
181
|
+
stringParam('name', 'writable variable name.'),
|
|
182
|
+
stringParam('value', 'value (empty string allowed).'),
|
|
183
|
+
stringParam('groupId', 'target group id for create/move (optional).', { acceptsUndefined: true }),
|
|
184
|
+
],
|
|
185
|
+
result: snapshotResult(),
|
|
186
|
+
sourceLocation: src,
|
|
187
|
+
},
|
|
188
|
+
'customEnv/setVars': {
|
|
189
|
+
service: 'customEnv',
|
|
190
|
+
description: 'Create or replace many variables by name in one rewrite. Optional group per entry.',
|
|
191
|
+
invocation: { kind: 'direct' },
|
|
192
|
+
parameters: [
|
|
193
|
+
{
|
|
194
|
+
name: 'entries',
|
|
195
|
+
description: 'name/value pairs with optional group (last duplicate name wins).',
|
|
196
|
+
source: 'json',
|
|
197
|
+
codec: {
|
|
198
|
+
mode: 'strict',
|
|
199
|
+
typeSymbol: 'readonly EnvVarWrite[]',
|
|
200
|
+
create: setVars$parameter$0$schema,
|
|
201
|
+
jsonSchema: { type: 'array', items: envVarWriteJsonSchema },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
result: voidResult,
|
|
206
|
+
sourceLocation: src,
|
|
207
|
+
},
|
|
208
|
+
'customEnv/setVar': {
|
|
209
|
+
service: 'customEnv',
|
|
210
|
+
description: 'Create or replace one variable by name. Optional group: new names default to default; existing keep group when omitted.',
|
|
211
|
+
invocation: { kind: 'direct' },
|
|
212
|
+
parameters: [
|
|
213
|
+
stringParam('name', 'writable variable name.'),
|
|
214
|
+
stringParam('value', 'value to store (empty string allowed).'),
|
|
215
|
+
stringParam('group', 'optional group id; omit to keep existing membership.', { acceptsUndefined: true }),
|
|
216
|
+
],
|
|
217
|
+
result: voidResult,
|
|
218
|
+
sourceLocation: src,
|
|
219
|
+
},
|
|
220
|
+
'customEnv/removeVars': {
|
|
221
|
+
service: 'customEnv',
|
|
222
|
+
description: 'Remove many variables by name from the file, Host, and OS user environment.',
|
|
223
|
+
invocation: { kind: 'direct' },
|
|
224
|
+
parameters: [
|
|
225
|
+
{
|
|
226
|
+
name: 'names',
|
|
227
|
+
description: 'writable variable names.',
|
|
228
|
+
source: 'json',
|
|
229
|
+
codec: {
|
|
230
|
+
mode: 'strict',
|
|
231
|
+
typeSymbol: 'readonly string[]',
|
|
232
|
+
create: removeVars$parameter$0$schema,
|
|
233
|
+
jsonSchema: { type: 'array', items: { type: 'string' } },
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
result: {
|
|
238
|
+
mode: 'strict',
|
|
239
|
+
typeSymbol: 'number',
|
|
240
|
+
create: () => z.number(),
|
|
241
|
+
description: 'number of .env lines removed.',
|
|
242
|
+
jsonSchema: { type: 'number' },
|
|
243
|
+
},
|
|
244
|
+
sourceLocation: src,
|
|
245
|
+
},
|
|
246
|
+
'customEnv/removeVar': {
|
|
247
|
+
service: 'customEnv',
|
|
248
|
+
description: 'Remove one variable by name from the file, Host, and OS user environment.',
|
|
249
|
+
invocation: { kind: 'direct' },
|
|
250
|
+
parameters: [
|
|
251
|
+
stringParam('name', 'writable variable name.'),
|
|
252
|
+
],
|
|
253
|
+
result: {
|
|
254
|
+
mode: 'strict',
|
|
255
|
+
typeSymbol: 'boolean',
|
|
256
|
+
create: () => z.boolean(),
|
|
257
|
+
description: 'true when a .env line was removed.',
|
|
258
|
+
jsonSchema: { type: 'boolean' },
|
|
259
|
+
},
|
|
260
|
+
sourceLocation: src,
|
|
261
|
+
},
|
|
262
|
+
'customEnv/deleteEntry': {
|
|
263
|
+
service: 'customEnv',
|
|
264
|
+
description: 'Delete one entry from the file, Host, and OS user environment.',
|
|
265
|
+
invocation: { kind: 'direct' },
|
|
266
|
+
parameters: [
|
|
267
|
+
stringParam('id', 'stable row id from list().'),
|
|
268
|
+
],
|
|
269
|
+
result: snapshotResult(),
|
|
270
|
+
sourceLocation: src,
|
|
271
|
+
},
|
|
272
|
+
'customEnv/restore': {
|
|
273
|
+
service: 'customEnv',
|
|
274
|
+
description: 'Restore Host-start original name+value for this id, or delete if added after start.',
|
|
275
|
+
invocation: { kind: 'direct' },
|
|
276
|
+
parameters: [
|
|
277
|
+
stringParam('id', 'stable row id from list().'),
|
|
278
|
+
],
|
|
279
|
+
result: snapshotResult(),
|
|
280
|
+
sourceLocation: src,
|
|
281
|
+
},
|
|
282
|
+
'customEnv/createGroup': {
|
|
283
|
+
service: 'customEnv',
|
|
284
|
+
description: 'Create a custom environment variable group.',
|
|
285
|
+
invocation: { kind: 'direct' },
|
|
286
|
+
parameters: [
|
|
287
|
+
stringParam('title', 'non-empty display title.'),
|
|
288
|
+
],
|
|
289
|
+
result: groupResult('created group.'),
|
|
290
|
+
sourceLocation: src,
|
|
291
|
+
},
|
|
292
|
+
'customEnv/renameGroup': {
|
|
293
|
+
service: 'customEnv',
|
|
294
|
+
description: 'Rename a custom group (not the default group).',
|
|
295
|
+
invocation: { kind: 'direct' },
|
|
296
|
+
parameters: [
|
|
297
|
+
stringParam('id', 'group id.'),
|
|
298
|
+
stringParam('title', 'new non-empty title.'),
|
|
299
|
+
],
|
|
300
|
+
result: groupResult('renamed group.'),
|
|
301
|
+
sourceLocation: src,
|
|
302
|
+
},
|
|
303
|
+
'customEnv/deleteGroup': {
|
|
304
|
+
service: 'customEnv',
|
|
305
|
+
description: 'Delete a custom group; optionally move members to default or remove their variables.',
|
|
306
|
+
invocation: { kind: 'direct' },
|
|
307
|
+
parameters: [
|
|
308
|
+
stringParam('id', 'group id (not default).'),
|
|
309
|
+
{
|
|
310
|
+
name: 'options',
|
|
311
|
+
description: 'moveToDefault controls whether members are kept.',
|
|
312
|
+
source: 'json',
|
|
313
|
+
codec: {
|
|
314
|
+
mode: 'strict',
|
|
315
|
+
typeSymbol: 'DeleteGroupOptions',
|
|
316
|
+
create: deleteGroup$parameter$1$schema,
|
|
317
|
+
jsonSchema: {
|
|
318
|
+
type: 'object',
|
|
319
|
+
properties: { moveToDefault: { type: 'boolean' } },
|
|
320
|
+
required: ['moveToDefault'],
|
|
321
|
+
additionalProperties: false,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
result: snapshotResult(),
|
|
327
|
+
sourceLocation: src,
|
|
328
|
+
},
|
|
329
|
+
'customEnv/moveEntry': {
|
|
330
|
+
service: 'customEnv',
|
|
331
|
+
description: 'Move one row into another group.',
|
|
332
|
+
invocation: { kind: 'direct' },
|
|
333
|
+
parameters: [
|
|
334
|
+
stringParam('id', 'stable row id from list().'),
|
|
335
|
+
stringParam('groupId', 'target group id.'),
|
|
336
|
+
],
|
|
337
|
+
result: snapshotResult(),
|
|
338
|
+
sourceLocation: src,
|
|
339
|
+
},
|
|
340
|
+
'customEnv/cliStatus': {
|
|
341
|
+
service: 'customEnv',
|
|
342
|
+
description: 'Compare the user-environment dsh with the launcher expected for this Host.',
|
|
343
|
+
invocation: { kind: 'direct' },
|
|
344
|
+
parameters: [],
|
|
345
|
+
result: {
|
|
346
|
+
mode: 'strict',
|
|
347
|
+
typeSymbol: '@woosau/dsh-custom-env/types#CliStatus',
|
|
348
|
+
create: cliStatus$result$schema,
|
|
349
|
+
description: 'active path, expected path, and whether Install should be offered.',
|
|
350
|
+
jsonSchema: cliStatusJsonSchema,
|
|
351
|
+
},
|
|
352
|
+
sourceLocation: src,
|
|
353
|
+
},
|
|
354
|
+
'customEnv/cliInstall': {
|
|
355
|
+
service: 'customEnv',
|
|
356
|
+
description: 'Install the expected CLI onto the Windows user PATH or as /usr/local/bin/dsh on macOS.',
|
|
357
|
+
invocation: { kind: 'direct' },
|
|
358
|
+
parameters: [],
|
|
359
|
+
result: {
|
|
360
|
+
mode: 'strict',
|
|
361
|
+
typeSymbol: '@woosau/dsh-custom-env/types#CliStatus',
|
|
362
|
+
create: cliStatus$result$schema,
|
|
363
|
+
description: 'refreshed status after install.',
|
|
364
|
+
jsonSchema: cliStatusJsonSchema,
|
|
365
|
+
},
|
|
366
|
+
sourceLocation: src,
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
}, z)
|
|
370
|
+
|
|
371
|
+
export const TYPERT = {
|
|
372
|
+
package: '@woosau/dsh-custom-env',
|
|
373
|
+
face: 'host',
|
|
374
|
+
schemas: [],
|
|
375
|
+
get invocations() { return $remote.descriptors },
|
|
376
|
+
model: {
|
|
377
|
+
services: [
|
|
378
|
+
{
|
|
379
|
+
description: 'Host remote for $DSH_HOME/.env CRUD with live Host/OS sync.',
|
|
380
|
+
summary: 'Host remote for $DSH_HOME/.env CRUD with live Host/OS sync.',
|
|
381
|
+
tags: [],
|
|
382
|
+
jsDoc: '/** Host remote for `$DSH_HOME/.env` CRUD with live Host/OS sync. */',
|
|
383
|
+
key: 'customEnv',
|
|
384
|
+
exportName: 'default',
|
|
385
|
+
members: [
|
|
386
|
+
{ kind: 'method', name: 'list', signature: "@Remote('list') async list(): Promise<EnvSnapshot>", summary: 'List current $DSH_HOME/.env entries and groups.', jsDoc: '/** List current `$DSH_HOME/.env` entries and groups. */' },
|
|
387
|
+
{ kind: 'method', name: 'upsert', signature: "@Remote('upsert') async upsert(id: string, name: string, value: string, groupId?: string): Promise<EnvSnapshot>", summary: 'Create or update one row by id.', jsDoc: '/** Create (`id === ""`) or update/rename one row. */' },
|
|
388
|
+
{ kind: 'method', name: 'setVars', signature: "@Remote('setVars') async setVars(entries: readonly EnvVarWrite[]): Promise<void>", summary: 'Create or replace many variables by name (optional group).', jsDoc: '/** Create or replace many variables by name. Optional group per entry. */' },
|
|
389
|
+
{ kind: 'method', name: 'setVar', signature: "@Remote('setVar') async setVar(name: string, value: string, group?: string): Promise<void>", summary: 'Create or replace one variable by name (optional group).', jsDoc: '/** Create or replace one variable by name. Optional group. */' },
|
|
390
|
+
{ kind: 'method', name: 'removeVars', signature: "@Remote('removeVars') async removeVars(names: readonly string[]): Promise<number>", summary: 'Remove many variables by name.', jsDoc: '/** Remove many variables by name. Returns how many lines were removed. */' },
|
|
391
|
+
{ kind: 'method', name: 'removeVar', signature: "@Remote('removeVar') async removeVar(name: string): Promise<boolean>", summary: 'Remove one variable by name.', jsDoc: '/** Remove one variable by name. Returns whether a line was removed. */' },
|
|
392
|
+
{ kind: 'method', name: 'deleteEntry', signature: "@Remote('deleteEntry') async deleteEntry(id: string): Promise<EnvSnapshot>", summary: 'Delete one row by stable id.', jsDoc: '/** Delete one entry by id. */' },
|
|
393
|
+
{ kind: 'method', name: 'restore', signature: "@Remote('restore') async restore(id: string): Promise<EnvSnapshot>", summary: 'Restore Host-start original name+value for this id.', jsDoc: '/** Restore Host-start original name+value for this id. */' },
|
|
394
|
+
{ kind: 'method', name: 'createGroup', signature: "@Remote('createGroup') async createGroup(title: string): Promise<EnvGroup>", summary: 'Create a custom group.', jsDoc: '/** Create a custom environment variable group. */' },
|
|
395
|
+
{ kind: 'method', name: 'renameGroup', signature: "@Remote('renameGroup') async renameGroup(id: string, title: string): Promise<EnvGroup>", summary: 'Rename a custom group.', jsDoc: '/** Rename a custom group (not default). */' },
|
|
396
|
+
{ kind: 'method', name: 'deleteGroup', signature: "@Remote('deleteGroup') async deleteGroup(id: string, options: DeleteGroupOptions): Promise<EnvSnapshot>", summary: 'Delete a custom group.', jsDoc: '/** Delete a custom group; optionally move or remove members. */' },
|
|
397
|
+
{ kind: 'method', name: 'moveEntry', signature: "@Remote('moveEntry') async moveEntry(id: string, groupId: string): Promise<EnvSnapshot>", summary: 'Move one row into another group.', jsDoc: '/** Move one row into another group. */' },
|
|
398
|
+
{ kind: 'method', name: 'cliStatus', signature: "@Remote('cliStatus') async cliStatus(): Promise<CliStatus>", summary: 'Compare user-environment dsh with this Host launcher.', jsDoc: '/** Compare the user-environment `dsh` with the launcher expected for this Host. */' },
|
|
399
|
+
{ kind: 'method', name: 'cliInstall', signature: "@Remote('cliInstall') async cliInstall(): Promise<CliStatus>", summary: 'Install expected CLI onto PATH or /usr/local/bin/dsh.', jsDoc: '/** Install the expected CLI onto the Windows user PATH or as `/usr/local/bin/dsh` on macOS. */' },
|
|
400
|
+
],
|
|
401
|
+
types: [],
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
events: [],
|
|
405
|
+
objects: [],
|
|
406
|
+
},
|
|
407
|
+
}
|