wp-typia 0.22.0 → 0.22.2
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/dist-bunli/.bunli/commands.gen.js +1053 -550
- package/dist-bunli/{cli-39er8888.js → cli-1sm60g1z.js} +19 -2
- package/dist-bunli/{cli-e623rs7g.js → cli-6hcbjvym.js} +1 -1
- package/dist-bunli/{cli-add-kjhghdqq.js → cli-add-s0p4w1wz.js} +655 -294
- package/dist-bunli/{cli-doctor-p3jxvn0k.js → cli-doctor-6dchxz12.js} +1 -1
- package/dist-bunli/{cli-init-djhwr245.js → cli-init-r6h1xchq.js} +2 -2
- package/dist-bunli/{cli-1w5vkye4.js → cli-kww2sraq.js} +9 -7
- package/dist-bunli/{cli-ktp869eh.js → cli-n6hgvysz.js} +36 -23
- package/dist-bunli/{cli-scaffold-376yw891.js → cli-scaffold-f023yxc5.js} +4 -4
- package/dist-bunli/{cli-j180bk07.js → cli-smzkbfna.js} +31 -2
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-jt1a1w7r.js → command-list-d3dcvzg2.js} +184 -127
- package/dist-bunli/{migrations-nwas5bwt.js → migrations-pg5b9fh4.js} +2 -2
- package/dist-bunli/node-cli.js +287 -197
- package/package.json +2 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
ADD_KIND_IDS,
|
|
3
4
|
ADD_OPTION_METADATA,
|
|
4
5
|
CREATE_OPTION_METADATA,
|
|
5
6
|
DOCTOR_OPTION_METADATA,
|
|
6
7
|
INIT_OPTION_METADATA,
|
|
8
|
+
MCP_OPTION_METADATA,
|
|
7
9
|
MIGRATE_OPTION_METADATA,
|
|
8
10
|
SYNC_OPTION_METADATA,
|
|
9
11
|
TEMPLATES_OPTION_METADATA,
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
package_default,
|
|
17
19
|
prefersStructuredCliOutput,
|
|
18
20
|
resolveCommandOptionValues
|
|
19
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-n6hgvysz.js";
|
|
20
22
|
import {
|
|
21
23
|
Result,
|
|
22
24
|
TaggedError,
|
|
@@ -79,6 +81,54 @@ var BLOCK_VISIBLE_FIELD_ORDER = [
|
|
|
79
81
|
"data-storage",
|
|
80
82
|
"persistence-policy"
|
|
81
83
|
];
|
|
84
|
+
var NAME_ONLY_VISIBLE_FIELDS = [
|
|
85
|
+
"kind",
|
|
86
|
+
"name"
|
|
87
|
+
];
|
|
88
|
+
var NAME_SOURCE_VISIBLE_FIELDS = [
|
|
89
|
+
"kind",
|
|
90
|
+
"name",
|
|
91
|
+
"source"
|
|
92
|
+
];
|
|
93
|
+
var NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS = [
|
|
94
|
+
"kind",
|
|
95
|
+
"name",
|
|
96
|
+
"block",
|
|
97
|
+
"attribute"
|
|
98
|
+
];
|
|
99
|
+
var NAME_BLOCK_VISIBLE_FIELDS = [
|
|
100
|
+
"kind",
|
|
101
|
+
"name",
|
|
102
|
+
"block"
|
|
103
|
+
];
|
|
104
|
+
var NAME_SLOT_VISIBLE_FIELDS = [
|
|
105
|
+
"kind",
|
|
106
|
+
"name",
|
|
107
|
+
"slot"
|
|
108
|
+
];
|
|
109
|
+
var NAME_ANCHOR_POSITION_VISIBLE_FIELDS = [
|
|
110
|
+
"kind",
|
|
111
|
+
"name",
|
|
112
|
+
"anchor",
|
|
113
|
+
"position"
|
|
114
|
+
];
|
|
115
|
+
var NAME_FROM_TO_VISIBLE_FIELDS = [
|
|
116
|
+
"kind",
|
|
117
|
+
"name",
|
|
118
|
+
"from",
|
|
119
|
+
"to"
|
|
120
|
+
];
|
|
121
|
+
var NAME_NAMESPACE_METHODS_VISIBLE_FIELDS = [
|
|
122
|
+
"kind",
|
|
123
|
+
"name",
|
|
124
|
+
"namespace",
|
|
125
|
+
"methods"
|
|
126
|
+
];
|
|
127
|
+
var NAME_NAMESPACE_VISIBLE_FIELDS = [
|
|
128
|
+
"kind",
|
|
129
|
+
"name",
|
|
130
|
+
"namespace"
|
|
131
|
+
];
|
|
82
132
|
function readOptionalStringFlag(flags, name) {
|
|
83
133
|
const value = flags[name];
|
|
84
134
|
if (value === undefined || value === null) {
|
|
@@ -89,6 +139,21 @@ function readOptionalStringFlag(flags, name) {
|
|
|
89
139
|
}
|
|
90
140
|
return value;
|
|
91
141
|
}
|
|
142
|
+
function requireStringFlag(flags, name, message) {
|
|
143
|
+
const value = readOptionalStringFlag(flags, name);
|
|
144
|
+
if (!value) {
|
|
145
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
|
|
146
|
+
}
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
function readOptionalPairedStringFlags(flags, leftName, rightName, message) {
|
|
150
|
+
const leftValue = readOptionalStringFlag(flags, leftName);
|
|
151
|
+
const rightValue = readOptionalStringFlag(flags, rightName);
|
|
152
|
+
if (Boolean(leftValue) !== Boolean(rightValue)) {
|
|
153
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
|
|
154
|
+
}
|
|
155
|
+
return [leftValue, rightValue];
|
|
156
|
+
}
|
|
92
157
|
function requireAddKindName(context, message) {
|
|
93
158
|
if (!context.name) {
|
|
94
159
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
|
|
@@ -112,6 +177,15 @@ function toExternalLayerPromptOptions(options) {
|
|
|
112
177
|
function defineAddKindRegistryEntry(entry) {
|
|
113
178
|
return entry;
|
|
114
179
|
}
|
|
180
|
+
function createNamedExecutionPlan(context, options) {
|
|
181
|
+
const name = options.name ?? requireAddKindName(context, options.missingNameMessage);
|
|
182
|
+
return {
|
|
183
|
+
execute: (cwd) => options.execute({ cwd, name }),
|
|
184
|
+
getValues: options.getValues,
|
|
185
|
+
...options.getWarnings ? { getWarnings: options.getWarnings } : {},
|
|
186
|
+
...options.warnLine ? { warnLine: options.warnLine } : {}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
115
189
|
function isAddPersistenceTemplate(template) {
|
|
116
190
|
return template === "persistence" || template === "compound";
|
|
117
191
|
}
|
|
@@ -134,22 +208,24 @@ var ADD_KIND_REGISTRY = {
|
|
|
134
208
|
async prepareExecution(context) {
|
|
135
209
|
const name = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
|
|
136
210
|
const source = readOptionalStringFlag(context.flags, "source");
|
|
137
|
-
return {
|
|
138
|
-
execute: (cwd) => context.addRuntime.runAddAdminViewCommand({
|
|
139
|
-
adminViewName:
|
|
211
|
+
return createNamedExecutionPlan(context, {
|
|
212
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
|
|
213
|
+
adminViewName: name2,
|
|
140
214
|
cwd,
|
|
141
215
|
source
|
|
142
216
|
}),
|
|
143
217
|
getValues: (result) => ({
|
|
144
218
|
adminViewSlug: result.adminViewSlug,
|
|
145
219
|
...result.source ? { source: result.source } : {}
|
|
146
|
-
})
|
|
147
|
-
|
|
220
|
+
}),
|
|
221
|
+
missingNameMessage: "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].",
|
|
222
|
+
name
|
|
223
|
+
});
|
|
148
224
|
},
|
|
149
225
|
sortOrder: 10,
|
|
150
226
|
supportsDryRun: true,
|
|
151
227
|
usage: "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]",
|
|
152
|
-
visibleFieldNames: () =>
|
|
228
|
+
visibleFieldNames: () => NAME_SOURCE_VISIBLE_FIELDS
|
|
153
229
|
}),
|
|
154
230
|
"binding-source": defineAddKindRegistryEntry({
|
|
155
231
|
completion: {
|
|
@@ -171,15 +247,11 @@ var ADD_KIND_REGISTRY = {
|
|
|
171
247
|
nameLabel: "Binding source name",
|
|
172
248
|
async prepareExecution(context) {
|
|
173
249
|
const name = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
|
|
174
|
-
const blockName =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
execute: (cwd) => context.addRuntime.runAddBindingSourceCommand({
|
|
250
|
+
const [blockName, attributeName] = readOptionalPairedStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
|
|
251
|
+
return createNamedExecutionPlan(context, {
|
|
252
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
|
|
181
253
|
attributeName,
|
|
182
|
-
bindingSourceName:
|
|
254
|
+
bindingSourceName: name2,
|
|
183
255
|
blockName,
|
|
184
256
|
cwd
|
|
185
257
|
}),
|
|
@@ -187,13 +259,15 @@ var ADD_KIND_REGISTRY = {
|
|
|
187
259
|
...result.attributeName ? { attributeName: result.attributeName } : {},
|
|
188
260
|
...result.blockSlug ? { blockSlug: result.blockSlug } : {},
|
|
189
261
|
bindingSourceSlug: result.bindingSourceSlug
|
|
190
|
-
})
|
|
191
|
-
|
|
262
|
+
}),
|
|
263
|
+
missingNameMessage: "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].",
|
|
264
|
+
name
|
|
265
|
+
});
|
|
192
266
|
},
|
|
193
267
|
sortOrder: 70,
|
|
194
268
|
supportsDryRun: true,
|
|
195
269
|
usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]",
|
|
196
|
-
visibleFieldNames: () =>
|
|
270
|
+
visibleFieldNames: () => NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS
|
|
197
271
|
}),
|
|
198
272
|
block: defineAddKindRegistryEntry({
|
|
199
273
|
completion: {
|
|
@@ -231,10 +305,10 @@ var ADD_KIND_REGISTRY = {
|
|
|
231
305
|
})), 1);
|
|
232
306
|
}
|
|
233
307
|
resolvedTemplateId ??= "basic";
|
|
234
|
-
return {
|
|
235
|
-
execute: (cwd) => context.addRuntime.runAddBlockCommand({
|
|
308
|
+
return createNamedExecutionPlan(context, {
|
|
309
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockCommand({
|
|
236
310
|
alternateRenderTargets,
|
|
237
|
-
blockName:
|
|
311
|
+
blockName: name2,
|
|
238
312
|
cwd,
|
|
239
313
|
dataStorageMode,
|
|
240
314
|
externalLayerId,
|
|
@@ -249,8 +323,10 @@ var ADD_KIND_REGISTRY = {
|
|
|
249
323
|
templateId: result.templateId
|
|
250
324
|
}),
|
|
251
325
|
getWarnings: (result) => result.warnings,
|
|
326
|
+
missingNameMessage: "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]",
|
|
327
|
+
name,
|
|
252
328
|
warnLine: context.warnLine
|
|
253
|
-
};
|
|
329
|
+
});
|
|
254
330
|
},
|
|
255
331
|
sortOrder: 20,
|
|
256
332
|
supportsDryRun: true,
|
|
@@ -283,21 +359,21 @@ var ADD_KIND_REGISTRY = {
|
|
|
283
359
|
description: "Add a typed server/client workflow ability scaffold",
|
|
284
360
|
nameLabel: "Ability name",
|
|
285
361
|
async prepareExecution(context) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
execute: (cwd) => context.addRuntime.runAddAbilityCommand({
|
|
362
|
+
return createNamedExecutionPlan(context, {
|
|
363
|
+
execute: ({ cwd, name }) => context.addRuntime.runAddAbilityCommand({
|
|
289
364
|
abilityName: name,
|
|
290
365
|
cwd
|
|
291
366
|
}),
|
|
292
367
|
getValues: (result) => ({
|
|
293
368
|
abilitySlug: result.abilitySlug
|
|
294
|
-
})
|
|
295
|
-
|
|
369
|
+
}),
|
|
370
|
+
missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>."
|
|
371
|
+
});
|
|
296
372
|
},
|
|
297
373
|
sortOrder: 90,
|
|
298
374
|
supportsDryRun: true,
|
|
299
375
|
usage: "wp-typia add ability <name> [--dry-run]",
|
|
300
|
-
visibleFieldNames: () =>
|
|
376
|
+
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
|
|
301
377
|
}),
|
|
302
378
|
"editor-plugin": defineAddKindRegistryEntry({
|
|
303
379
|
completion: {
|
|
@@ -317,22 +393,24 @@ var ADD_KIND_REGISTRY = {
|
|
|
317
393
|
async prepareExecution(context) {
|
|
318
394
|
const name = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
|
|
319
395
|
const slot = readOptionalStringFlag(context.flags, "slot");
|
|
320
|
-
return {
|
|
321
|
-
execute: (cwd) => context.addRuntime.runAddEditorPluginCommand({
|
|
396
|
+
return createNamedExecutionPlan(context, {
|
|
397
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
|
|
322
398
|
cwd,
|
|
323
|
-
editorPluginName:
|
|
399
|
+
editorPluginName: name2,
|
|
324
400
|
slot
|
|
325
401
|
}),
|
|
326
402
|
getValues: (result) => ({
|
|
327
403
|
editorPluginSlug: result.editorPluginSlug,
|
|
328
404
|
slot: result.slot
|
|
329
|
-
})
|
|
330
|
-
|
|
405
|
+
}),
|
|
406
|
+
missingNameMessage: "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].",
|
|
407
|
+
name
|
|
408
|
+
});
|
|
331
409
|
},
|
|
332
410
|
sortOrder: 120,
|
|
333
411
|
supportsDryRun: true,
|
|
334
412
|
usage: "wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>] [--dry-run]",
|
|
335
|
-
visibleFieldNames: () =>
|
|
413
|
+
visibleFieldNames: () => NAME_SLOT_VISIBLE_FIELDS
|
|
336
414
|
}),
|
|
337
415
|
"hooked-block": defineAddKindRegistryEntry({
|
|
338
416
|
completion: {
|
|
@@ -352,18 +430,12 @@ var ADD_KIND_REGISTRY = {
|
|
|
352
430
|
nameLabel: "Target block",
|
|
353
431
|
async prepareExecution(context) {
|
|
354
432
|
const name = requireAddKindName(context, "`wp-typia add hooked-block` requires <block-slug>. Usage: wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild>.");
|
|
355
|
-
const anchorBlockName =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const position = readOptionalStringFlag(context.flags, "position");
|
|
360
|
-
if (!position) {
|
|
361
|
-
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
|
|
362
|
-
}
|
|
363
|
-
return {
|
|
364
|
-
execute: (cwd) => context.addRuntime.runAddHookedBlockCommand({
|
|
433
|
+
const anchorBlockName = requireStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
|
|
434
|
+
const position = requireStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
|
|
435
|
+
return createNamedExecutionPlan(context, {
|
|
436
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddHookedBlockCommand({
|
|
365
437
|
anchorBlockName,
|
|
366
|
-
blockName:
|
|
438
|
+
blockName: name2,
|
|
367
439
|
cwd,
|
|
368
440
|
position
|
|
369
441
|
}),
|
|
@@ -371,13 +443,15 @@ var ADD_KIND_REGISTRY = {
|
|
|
371
443
|
anchorBlockName: result.anchorBlockName,
|
|
372
444
|
blockSlug: result.blockSlug,
|
|
373
445
|
position: result.position
|
|
374
|
-
})
|
|
375
|
-
|
|
446
|
+
}),
|
|
447
|
+
missingNameMessage: "`wp-typia add hooked-block` requires <block-slug>. Usage: wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild>.",
|
|
448
|
+
name
|
|
449
|
+
});
|
|
376
450
|
},
|
|
377
451
|
sortOrder: 110,
|
|
378
452
|
supportsDryRun: true,
|
|
379
453
|
usage: "wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild> [--dry-run]",
|
|
380
|
-
visibleFieldNames: () =>
|
|
454
|
+
visibleFieldNames: () => NAME_ANCHOR_POSITION_VISIBLE_FIELDS
|
|
381
455
|
}),
|
|
382
456
|
pattern: defineAddKindRegistryEntry({
|
|
383
457
|
completion: {
|
|
@@ -394,21 +468,21 @@ var ADD_KIND_REGISTRY = {
|
|
|
394
468
|
description: "Add a PHP block pattern shell",
|
|
395
469
|
nameLabel: "Pattern name",
|
|
396
470
|
async prepareExecution(context) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
execute: (cwd) => context.addRuntime.runAddPatternCommand({
|
|
471
|
+
return createNamedExecutionPlan(context, {
|
|
472
|
+
execute: ({ cwd, name }) => context.addRuntime.runAddPatternCommand({
|
|
400
473
|
cwd,
|
|
401
474
|
patternName: name
|
|
402
475
|
}),
|
|
403
476
|
getValues: (result) => ({
|
|
404
477
|
patternSlug: result.patternSlug
|
|
405
|
-
})
|
|
406
|
-
|
|
478
|
+
}),
|
|
479
|
+
missingNameMessage: "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>."
|
|
480
|
+
});
|
|
407
481
|
},
|
|
408
482
|
sortOrder: 60,
|
|
409
483
|
supportsDryRun: true,
|
|
410
484
|
usage: "wp-typia add pattern <name> [--dry-run]",
|
|
411
|
-
visibleFieldNames: () =>
|
|
485
|
+
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
|
|
412
486
|
}),
|
|
413
487
|
style: defineAddKindRegistryEntry({
|
|
414
488
|
completion: {
|
|
@@ -427,26 +501,25 @@ var ADD_KIND_REGISTRY = {
|
|
|
427
501
|
nameLabel: "Style name",
|
|
428
502
|
async prepareExecution(context) {
|
|
429
503
|
const name = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
|
|
430
|
-
const blockSlug =
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
return {
|
|
435
|
-
execute: (cwd) => context.addRuntime.runAddBlockStyleCommand({
|
|
504
|
+
const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
|
|
505
|
+
return createNamedExecutionPlan(context, {
|
|
506
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
|
|
436
507
|
blockName: blockSlug,
|
|
437
508
|
cwd,
|
|
438
|
-
styleName:
|
|
509
|
+
styleName: name2
|
|
439
510
|
}),
|
|
440
511
|
getValues: (result) => ({
|
|
441
512
|
blockSlug: result.blockSlug,
|
|
442
513
|
styleSlug: result.styleSlug
|
|
443
|
-
})
|
|
444
|
-
|
|
514
|
+
}),
|
|
515
|
+
missingNameMessage: "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.",
|
|
516
|
+
name
|
|
517
|
+
});
|
|
445
518
|
},
|
|
446
519
|
sortOrder: 40,
|
|
447
520
|
supportsDryRun: true,
|
|
448
521
|
usage: "wp-typia add style <name> --block <block-slug> [--dry-run]",
|
|
449
|
-
visibleFieldNames: () =>
|
|
522
|
+
visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
|
|
450
523
|
}),
|
|
451
524
|
transform: defineAddKindRegistryEntry({
|
|
452
525
|
completion: {
|
|
@@ -466,33 +539,29 @@ var ADD_KIND_REGISTRY = {
|
|
|
466
539
|
nameLabel: "Transform name",
|
|
467
540
|
async prepareExecution(context) {
|
|
468
541
|
const name = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
|
|
469
|
-
const fromBlockName =
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const toBlockName = readOptionalStringFlag(context.flags, "to");
|
|
474
|
-
if (!toBlockName) {
|
|
475
|
-
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
|
|
476
|
-
}
|
|
477
|
-
return {
|
|
478
|
-
execute: (cwd) => context.addRuntime.runAddBlockTransformCommand({
|
|
542
|
+
const fromBlockName = requireStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
|
|
543
|
+
const toBlockName = requireStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
|
|
544
|
+
return createNamedExecutionPlan(context, {
|
|
545
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockTransformCommand({
|
|
479
546
|
cwd,
|
|
480
547
|
fromBlockName,
|
|
481
548
|
toBlockName,
|
|
482
|
-
transformName:
|
|
549
|
+
transformName: name2
|
|
483
550
|
}),
|
|
484
551
|
getValues: (result) => ({
|
|
485
552
|
blockSlug: result.blockSlug,
|
|
486
553
|
fromBlockName: result.fromBlockName,
|
|
487
554
|
toBlockName: result.toBlockName,
|
|
488
555
|
transformSlug: result.transformSlug
|
|
489
|
-
})
|
|
490
|
-
|
|
556
|
+
}),
|
|
557
|
+
missingNameMessage: "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.",
|
|
558
|
+
name
|
|
559
|
+
});
|
|
491
560
|
},
|
|
492
561
|
sortOrder: 50,
|
|
493
562
|
supportsDryRun: true,
|
|
494
563
|
usage: "wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]",
|
|
495
|
-
visibleFieldNames: () =>
|
|
564
|
+
visibleFieldNames: () => NAME_FROM_TO_VISIBLE_FIELDS
|
|
496
565
|
}),
|
|
497
566
|
"rest-resource": defineAddKindRegistryEntry({
|
|
498
567
|
completion: {
|
|
@@ -514,24 +583,26 @@ var ADD_KIND_REGISTRY = {
|
|
|
514
583
|
const name = requireAddKindName(context, "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].");
|
|
515
584
|
const methods = readOptionalStringFlag(context.flags, "methods");
|
|
516
585
|
const namespace = readOptionalStringFlag(context.flags, "namespace");
|
|
517
|
-
return {
|
|
518
|
-
execute: (cwd) => context.addRuntime.runAddRestResourceCommand({
|
|
586
|
+
return createNamedExecutionPlan(context, {
|
|
587
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
|
|
519
588
|
cwd,
|
|
520
589
|
methods,
|
|
521
590
|
namespace,
|
|
522
|
-
restResourceName:
|
|
591
|
+
restResourceName: name2
|
|
523
592
|
}),
|
|
524
593
|
getValues: (result) => ({
|
|
525
594
|
methods: result.methods.join(", "),
|
|
526
595
|
namespace: result.namespace,
|
|
527
596
|
restResourceSlug: result.restResourceSlug
|
|
528
|
-
})
|
|
529
|
-
|
|
597
|
+
}),
|
|
598
|
+
missingNameMessage: "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].",
|
|
599
|
+
name
|
|
600
|
+
});
|
|
530
601
|
},
|
|
531
602
|
sortOrder: 80,
|
|
532
603
|
supportsDryRun: true,
|
|
533
604
|
usage: "wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]",
|
|
534
|
-
visibleFieldNames: () =>
|
|
605
|
+
visibleFieldNames: () => NAME_NAMESPACE_METHODS_VISIBLE_FIELDS
|
|
535
606
|
}),
|
|
536
607
|
"ai-feature": defineAddKindRegistryEntry({
|
|
537
608
|
completion: {
|
|
@@ -551,9 +622,9 @@ var ADD_KIND_REGISTRY = {
|
|
|
551
622
|
async prepareExecution(context) {
|
|
552
623
|
const name = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
|
|
553
624
|
const namespace = readOptionalStringFlag(context.flags, "namespace");
|
|
554
|
-
return {
|
|
555
|
-
execute: (cwd) => context.addRuntime.runAddAiFeatureCommand({
|
|
556
|
-
aiFeatureName:
|
|
625
|
+
return createNamedExecutionPlan(context, {
|
|
626
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
|
|
627
|
+
aiFeatureName: name2,
|
|
557
628
|
cwd,
|
|
558
629
|
namespace
|
|
559
630
|
}),
|
|
@@ -562,13 +633,15 @@ var ADD_KIND_REGISTRY = {
|
|
|
562
633
|
namespace: result.namespace
|
|
563
634
|
}),
|
|
564
635
|
getWarnings: (result) => result.warnings,
|
|
636
|
+
missingNameMessage: "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].",
|
|
637
|
+
name,
|
|
565
638
|
warnLine: context.warnLine
|
|
566
|
-
};
|
|
639
|
+
});
|
|
567
640
|
},
|
|
568
641
|
sortOrder: 100,
|
|
569
642
|
supportsDryRun: true,
|
|
570
643
|
usage: "wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]",
|
|
571
|
-
visibleFieldNames: () =>
|
|
644
|
+
visibleFieldNames: () => NAME_NAMESPACE_VISIBLE_FIELDS
|
|
572
645
|
}),
|
|
573
646
|
variation: defineAddKindRegistryEntry({
|
|
574
647
|
completion: {
|
|
@@ -587,29 +660,27 @@ var ADD_KIND_REGISTRY = {
|
|
|
587
660
|
nameLabel: "Variation name",
|
|
588
661
|
async prepareExecution(context) {
|
|
589
662
|
const name = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
|
|
590
|
-
const blockSlug =
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
return {
|
|
595
|
-
execute: (cwd) => context.addRuntime.runAddVariationCommand({
|
|
663
|
+
const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
|
|
664
|
+
return createNamedExecutionPlan(context, {
|
|
665
|
+
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
|
|
596
666
|
blockName: blockSlug,
|
|
597
667
|
cwd,
|
|
598
|
-
variationName:
|
|
668
|
+
variationName: name2
|
|
599
669
|
}),
|
|
600
670
|
getValues: (result) => ({
|
|
601
671
|
blockSlug: result.blockSlug,
|
|
602
672
|
variationSlug: result.variationSlug
|
|
603
|
-
})
|
|
604
|
-
|
|
673
|
+
}),
|
|
674
|
+
missingNameMessage: "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>",
|
|
675
|
+
name
|
|
676
|
+
});
|
|
605
677
|
},
|
|
606
678
|
sortOrder: 30,
|
|
607
679
|
supportsDryRun: true,
|
|
608
680
|
usage: "wp-typia add variation <name> --block <block-slug> [--dry-run]",
|
|
609
|
-
visibleFieldNames: () =>
|
|
681
|
+
visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
|
|
610
682
|
})
|
|
611
683
|
};
|
|
612
|
-
var ADD_KIND_IDS = Object.keys(ADD_KIND_REGISTRY).sort((left, right) => ADD_KIND_REGISTRY[left].sortOrder - ADD_KIND_REGISTRY[right].sortOrder);
|
|
613
684
|
function isAddKindId(value) {
|
|
614
685
|
return typeof value === "string" && ADD_KIND_IDS.includes(value);
|
|
615
686
|
}
|
|
@@ -909,15 +980,7 @@ function buildStructuredCompletionSuccessPayload(command, completion, metadata =
|
|
|
909
980
|
command,
|
|
910
981
|
...serializedCompletion ? {
|
|
911
982
|
completion: serializedCompletion,
|
|
912
|
-
files: extractPlannedFiles(serializedCompletion)
|
|
913
|
-
nextSteps: serializedCompletion.nextSteps,
|
|
914
|
-
optionalLines: serializedCompletion.optionalLines,
|
|
915
|
-
optionalNote: serializedCompletion.optionalNote,
|
|
916
|
-
optionalTitle: serializedCompletion.optionalTitle,
|
|
917
|
-
preambleLines: serializedCompletion.preambleLines,
|
|
918
|
-
summaryLines: serializedCompletion.summaryLines,
|
|
919
|
-
title: serializedCompletion.title,
|
|
920
|
-
warnings: serializedCompletion.warningLines
|
|
983
|
+
files: extractPlannedFiles(serializedCompletion)
|
|
921
984
|
} : {}
|
|
922
985
|
}
|
|
923
986
|
};
|
|
@@ -936,14 +999,11 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
936
999
|
detectedLayout: plan.detectedLayout,
|
|
937
1000
|
files: toNonEmptyArray(files),
|
|
938
1001
|
mode: plan.commandMode === "apply" ? "apply" : "preview",
|
|
939
|
-
nextSteps: toNonEmptyArray(plan.nextSteps),
|
|
940
1002
|
packageManager: plan.packageManager,
|
|
941
1003
|
plan,
|
|
942
1004
|
projectDir: plan.projectDir,
|
|
943
1005
|
status: plan.status,
|
|
944
|
-
summary: plan.summary
|
|
945
|
-
title: completion.title,
|
|
946
|
-
warnings: toNonEmptyArray(plan.notes)
|
|
1006
|
+
summary: plan.summary
|
|
947
1007
|
}
|
|
948
1008
|
};
|
|
949
1009
|
}
|
|
@@ -1380,14 +1440,14 @@ async function executeSyncCommand({
|
|
|
1380
1440
|
}
|
|
1381
1441
|
|
|
1382
1442
|
// src/runtime-bridge.ts
|
|
1383
|
-
var loadCliAddRuntime = () => import("./cli-add-
|
|
1443
|
+
var loadCliAddRuntime = () => import("./cli-add-s0p4w1wz.js");
|
|
1384
1444
|
var loadCliDiagnosticsRuntime = () => import("./cli-diagnostics-5dvztm7q.js");
|
|
1385
|
-
var loadCliDoctorRuntime = () => import("./cli-doctor-
|
|
1386
|
-
var loadCliInitRuntime = () => import("./cli-init-
|
|
1445
|
+
var loadCliDoctorRuntime = () => import("./cli-doctor-6dchxz12.js");
|
|
1446
|
+
var loadCliInitRuntime = () => import("./cli-init-r6h1xchq.js");
|
|
1387
1447
|
var loadCliPromptRuntime = () => import("./cli-prompt-614tq57c.js");
|
|
1388
|
-
var loadCliScaffoldRuntime = () => import("./cli-scaffold-
|
|
1448
|
+
var loadCliScaffoldRuntime = () => import("./cli-scaffold-f023yxc5.js");
|
|
1389
1449
|
var loadCliTemplatesRuntime = () => import("./cli-templates-9t2a7zqd.js");
|
|
1390
|
-
var loadMigrationsRuntime = () => import("./migrations-
|
|
1450
|
+
var loadMigrationsRuntime = () => import("./migrations-pg5b9fh4.js");
|
|
1391
1451
|
async function wrapCliCommandError(command, error) {
|
|
1392
1452
|
const { createCliCommandError } = await loadCliDiagnosticsRuntime();
|
|
1393
1453
|
return createCliCommandError({ command, error });
|
|
@@ -2346,7 +2406,7 @@ var doctorCommand = defineCommand({
|
|
|
2346
2406
|
const prefersStructuredOutput = prefersStructuredCliOutput(args);
|
|
2347
2407
|
if (prefersStructuredOutput) {
|
|
2348
2408
|
const [{ getDoctorChecks }, { getDoctorFailureDetailLines }] = await Promise.all([
|
|
2349
|
-
import("./cli-doctor-
|
|
2409
|
+
import("./cli-doctor-6dchxz12.js"),
|
|
2350
2410
|
import("./cli-diagnostics-5dvztm7q.js")
|
|
2351
2411
|
]);
|
|
2352
2412
|
const checks = await getDoctorChecks(args.cwd);
|
|
@@ -3034,7 +3094,9 @@ var mcpCommand = defineCommand({
|
|
|
3034
3094
|
emitCliDiagnosticFailure(args, {
|
|
3035
3095
|
code: CLI_DIAGNOSTIC_CODES.INVALID_COMMAND,
|
|
3036
3096
|
command: "mcp",
|
|
3037
|
-
detailLines: [
|
|
3097
|
+
detailLines: [
|
|
3098
|
+
`Unknown mcp subcommand "${subcommand}". Expected list or sync.`
|
|
3099
|
+
]
|
|
3038
3100
|
});
|
|
3039
3101
|
} catch (error) {
|
|
3040
3102
|
emitCliDiagnosticFailure(args, {
|
|
@@ -3044,12 +3106,7 @@ var mcpCommand = defineCommand({
|
|
|
3044
3106
|
}
|
|
3045
3107
|
},
|
|
3046
3108
|
name: "mcp",
|
|
3047
|
-
options:
|
|
3048
|
-
"output-dir": {
|
|
3049
|
-
description: "Output directory for generated MCP metadata during `mcp sync`.",
|
|
3050
|
-
schema: exports_external.string().optional()
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3109
|
+
options: buildCommandOptions(MCP_OPTION_METADATA)
|
|
3053
3110
|
});
|
|
3054
3111
|
|
|
3055
3112
|
// src/commands/migrate.ts
|
|
@@ -3215,4 +3272,4 @@ export {
|
|
|
3215
3272
|
wpTypiaCommands
|
|
3216
3273
|
};
|
|
3217
3274
|
|
|
3218
|
-
//# debugId=
|
|
3275
|
+
//# debugId=844373B8B205795464756E2164756E21
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
snapshotProjectVersion,
|
|
16
16
|
verifyProjectMigrations,
|
|
17
17
|
wizardProjectMigrations
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-6hcbjvym.js";
|
|
19
19
|
import"./cli-gcbre1zs.js";
|
|
20
20
|
import"./cli-bq2v559b.js";
|
|
21
21
|
import"./cli-sj5mtyzj.js";
|
|
22
|
-
import"./cli-
|
|
22
|
+
import"./cli-smzkbfna.js";
|
|
23
23
|
import"./cli-pd5pqgre.js";
|
|
24
24
|
import"./cli-xnn9xjcy.js";
|
|
25
25
|
export {
|