wp-typia 0.23.1 → 0.24.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 +1 -0
- package/bin/routing-metadata.generated.js +7 -0
- package/dist-bunli/.bunli/commands.gen.js +9465 -7615
- package/dist-bunli/{cli-epsczb1c.js → cli-0v407aag.js} +1 -1
- package/dist-bunli/{cli-y7w3pybs.js → cli-74y6z3yx.js} +978 -944
- package/dist-bunli/{cli-add-xjaaa01x.js → cli-add-nmdraf20.js} +8694 -7854
- package/dist-bunli/{cli-43mx1vfb.js → cli-bajwv85z.js} +2 -1
- package/dist-bunli/{cli-ymecd15q.js → cli-cwjdzq6n.js} +45 -6
- package/dist-bunli/{cli-doctor-19e8313m.js → cli-doctor-pcss6ecx.js} +98 -12
- package/dist-bunli/{cli-init-2b4yn2cc.js → cli-init-he7vm7kc.js} +3 -3
- package/dist-bunli/{cli-scaffold-4tjw4jk5.js → cli-scaffold-an2k0fnm.js} +6 -6
- package/dist-bunli/{cli-nvs5atj1.js → cli-sw06c521.js} +1 -1
- package/dist-bunli/{cli-k5q5v8g6.js → cli-v0nnagb3.js} +1331 -893
- package/dist-bunli/{cli-fp16mntv.js → cli-y0a8nztv.js} +9 -4
- package/dist-bunli/cli-z48frc8t.js +229 -0
- package/dist-bunli/cli.js +3 -3
- package/dist-bunli/{command-list-vme7dr5v.js → command-list-xaw5agks.js} +170 -29
- package/dist-bunli/{migrations-pb5vvtdp.js → migrations-z7f4kxba.js} +3 -3
- package/dist-bunli/node-cli.js +259 -69
- package/package.json +2 -2
- package/dist-bunli/cli-j8et6jvr.js +0 -123
package/dist-bunli/node-cli.js
CHANGED
|
@@ -30,7 +30,7 @@ var ADD_OPTION_METADATA = {
|
|
|
30
30
|
type: "string"
|
|
31
31
|
},
|
|
32
32
|
block: {
|
|
33
|
-
description: "Target block slug for variation, style, and end-to-end binding-source workflows.",
|
|
33
|
+
description: "Target block slug/name for variation, core-variation, style, and end-to-end binding-source workflows.",
|
|
34
34
|
type: "string"
|
|
35
35
|
},
|
|
36
36
|
"controller-class": {
|
|
@@ -62,6 +62,10 @@ var ADD_OPTION_METADATA = {
|
|
|
62
62
|
description: "Source full block name (namespace/block) for transform workflows.",
|
|
63
63
|
type: "string"
|
|
64
64
|
},
|
|
65
|
+
"from-post-meta": {
|
|
66
|
+
description: "Alias for --post-meta when backing a binding-source scaffold from a typed post-meta contract.",
|
|
67
|
+
type: "string"
|
|
68
|
+
},
|
|
65
69
|
"inner-blocks-preset": {
|
|
66
70
|
description: "Compound-only InnerBlocks preset (freeform, ordered, horizontal, locked-structure).",
|
|
67
71
|
type: "string"
|
|
@@ -80,6 +84,10 @@ var ADD_OPTION_METADATA = {
|
|
|
80
84
|
description: "WordPress meta key for post-meta workflows; defaults to _<phpPrefix>_<name>.",
|
|
81
85
|
type: "string"
|
|
82
86
|
},
|
|
87
|
+
"meta-path": {
|
|
88
|
+
description: "Top-level post-meta field used as the default binding-source field when --post-meta or --from-post-meta is provided.",
|
|
89
|
+
type: "string"
|
|
90
|
+
},
|
|
83
91
|
method: {
|
|
84
92
|
description: "HTTP method for manual REST contract workflows (GET, POST, PUT, PATCH, or DELETE).",
|
|
85
93
|
type: "string"
|
|
@@ -100,6 +108,10 @@ var ADD_OPTION_METADATA = {
|
|
|
100
108
|
description: "WordPress post type key for post-meta workflows.",
|
|
101
109
|
type: "string"
|
|
102
110
|
},
|
|
111
|
+
"post-meta": {
|
|
112
|
+
description: "Typed post-meta contract slug used to back a binding-source scaffold.",
|
|
113
|
+
type: "string"
|
|
114
|
+
},
|
|
103
115
|
"persistence-policy": {
|
|
104
116
|
description: "Persistence write policy for persistence-capable templates.",
|
|
105
117
|
type: "string"
|
|
@@ -129,6 +141,14 @@ var ADD_OPTION_METADATA = {
|
|
|
129
141
|
description: "REST route pattern relative to the namespace; generated resources use it for item routes and manual/provider contracts may use it as an alias for --path.",
|
|
130
142
|
type: "string"
|
|
131
143
|
},
|
|
144
|
+
scope: {
|
|
145
|
+
description: "Pattern catalog scope for pattern workflows (full or section).",
|
|
146
|
+
type: "string"
|
|
147
|
+
},
|
|
148
|
+
"section-role": {
|
|
149
|
+
description: "Typed section role for section-scoped pattern catalog entries.",
|
|
150
|
+
type: "string"
|
|
151
|
+
},
|
|
132
152
|
"secret-field": {
|
|
133
153
|
description: "Write-only request body field for manual settings REST contracts; requires --manual and a request body, typically generated by POST, PUT, or PATCH.",
|
|
134
154
|
type: "string"
|
|
@@ -165,6 +185,14 @@ var ADD_OPTION_METADATA = {
|
|
|
165
185
|
description: "Optional built-in block family for the new block; interactive flows let you choose it when omitted and non-interactive runs default to basic.",
|
|
166
186
|
type: "string"
|
|
167
187
|
},
|
|
188
|
+
"thumbnail-url": {
|
|
189
|
+
description: "Optional thumbnail URL or relative path for typed pattern catalog entries.",
|
|
190
|
+
type: "string"
|
|
191
|
+
},
|
|
192
|
+
tags: {
|
|
193
|
+
description: "Comma-separated tags for typed pattern catalog entries.",
|
|
194
|
+
type: "string"
|
|
195
|
+
},
|
|
168
196
|
type: {
|
|
169
197
|
description: "Exported TypeScript type or interface name for standalone contract workflows.",
|
|
170
198
|
type: "string"
|
|
@@ -756,10 +784,19 @@ var WP_TYPIA_CONFIG_SOURCES = [
|
|
|
756
784
|
".wp-typiarc",
|
|
757
785
|
".wp-typiarc.json"
|
|
758
786
|
];
|
|
787
|
+
var wordpressVersionSchema = z2.string().regex(/^\d+\.\d+(?:\.\d+)?$/u, 'expected dotted numeric WordPress version such as "6.7" or "6.7.1"');
|
|
759
788
|
var wpTypiaSchemaSourceSchema = z2.object({
|
|
760
789
|
namespace: z2.string(),
|
|
761
790
|
path: z2.string()
|
|
762
791
|
}).strict();
|
|
792
|
+
var wordpressCompatibilityConfigSchema = z2.object({
|
|
793
|
+
minVersion: wordpressVersionSchema.optional(),
|
|
794
|
+
testedVersions: z2.array(wordpressVersionSchema).optional()
|
|
795
|
+
}).strict();
|
|
796
|
+
var blockApiCompatibilityConfigSchema = z2.object({
|
|
797
|
+
allowUnknownFutureKeys: z2.boolean().optional(),
|
|
798
|
+
strict: z2.boolean().optional()
|
|
799
|
+
}).strict();
|
|
763
800
|
var createConfigSchema = z2.object({
|
|
764
801
|
"alternate-render-targets": z2.string().optional(),
|
|
765
802
|
"inner-blocks-preset": z2.string().optional(),
|
|
@@ -799,8 +836,10 @@ var mcpConfigSchema = z2.object({
|
|
|
799
836
|
}).strict();
|
|
800
837
|
var wpTypiaUserConfigSchema = z2.object({
|
|
801
838
|
add: addConfigSchema.optional(),
|
|
839
|
+
compatibility: blockApiCompatibilityConfigSchema.optional(),
|
|
802
840
|
create: createConfigSchema.optional(),
|
|
803
|
-
mcp: mcpConfigSchema.optional()
|
|
841
|
+
mcp: mcpConfigSchema.optional(),
|
|
842
|
+
wordpress: wordpressCompatibilityConfigSchema.optional()
|
|
804
843
|
}).strict();
|
|
805
844
|
function formatIssuePath(issuePath) {
|
|
806
845
|
if (issuePath.length === 0) {
|
|
@@ -917,8 +956,8 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
917
956
|
|
|
918
957
|
// src/runtime-bridge-add.ts
|
|
919
958
|
import {
|
|
920
|
-
CLI_DIAGNOSTIC_CODES as
|
|
921
|
-
createCliDiagnosticCodeError as
|
|
959
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES9,
|
|
960
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError8
|
|
922
961
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
923
962
|
|
|
924
963
|
// src/add-kind-ids.ts
|
|
@@ -959,11 +998,13 @@ var NAME_TYPE_VISIBLE_FIELDS = [
|
|
|
959
998
|
"name",
|
|
960
999
|
"type"
|
|
961
1000
|
];
|
|
962
|
-
var
|
|
1001
|
+
var NAME_BLOCK_ATTRIBUTE_POST_META_VISIBLE_FIELDS = [
|
|
963
1002
|
"kind",
|
|
964
1003
|
"name",
|
|
965
1004
|
"block",
|
|
966
|
-
"attribute"
|
|
1005
|
+
"attribute",
|
|
1006
|
+
"post-meta",
|
|
1007
|
+
"meta-path"
|
|
967
1008
|
];
|
|
968
1009
|
var NAME_BLOCK_VISIBLE_FIELDS = [
|
|
969
1010
|
"kind",
|
|
@@ -1216,7 +1257,7 @@ var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1216
1257
|
});
|
|
1217
1258
|
|
|
1218
1259
|
// src/add-kinds/binding-source.ts
|
|
1219
|
-
var BINDING_SOURCE_MISSING_NAME_MESSAGE = "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].";
|
|
1260
|
+
var BINDING_SOURCE_MISSING_NAME_MESSAGE = "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--from-post-meta <post-meta> --meta-path <field>].";
|
|
1220
1261
|
var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
|
|
1221
1262
|
completion: {
|
|
1222
1263
|
nextSteps: (values) => [
|
|
@@ -1224,11 +1265,18 @@ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1224
1265
|
...values.blockSlug && values.attributeName ? [
|
|
1225
1266
|
`Review src/blocks/${values.blockSlug}/block.json for the ${values.attributeName} bindable attribute.`
|
|
1226
1267
|
] : [],
|
|
1268
|
+
...values.postMetaSlug ? [
|
|
1269
|
+
`Run wp-typia sync-rest --check after editing ${values.schemaFile}.`
|
|
1270
|
+
] : [],
|
|
1227
1271
|
"Run your workspace build or dev command to verify the binding source hooks and editor registration."
|
|
1228
1272
|
],
|
|
1229
1273
|
summaryLines: (values, projectDir) => [
|
|
1230
1274
|
`Binding source: ${values.bindingSourceSlug}`,
|
|
1231
1275
|
...values.blockSlug && values.attributeName ? [`Target: ${values.blockSlug}.${values.attributeName}`] : [],
|
|
1276
|
+
...values.postMetaSlug ? [
|
|
1277
|
+
`Post meta: ${values.postMetaSlug}`,
|
|
1278
|
+
`Meta field: ${values.metaPath}`
|
|
1279
|
+
] : [],
|
|
1232
1280
|
`Project directory: ${projectDir}`
|
|
1233
1281
|
],
|
|
1234
1282
|
title: "Added binding source"
|
|
@@ -1238,17 +1286,26 @@ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1238
1286
|
async prepareExecution(context) {
|
|
1239
1287
|
const name = requireAddKindName(context, BINDING_SOURCE_MISSING_NAME_MESSAGE);
|
|
1240
1288
|
const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
|
|
1289
|
+
const postMetaName = readOptionalDashedOrCamelStringFlag(context.flags, "from-post-meta", "fromPostMeta") ?? readOptionalDashedOrCamelStringFlag(context.flags, "post-meta", "postMeta");
|
|
1290
|
+
const metaPath = readOptionalDashedOrCamelStringFlag(context.flags, "meta-path", "metaPath");
|
|
1241
1291
|
return createNamedExecutionPlan(context, {
|
|
1242
1292
|
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
|
|
1243
1293
|
attributeName,
|
|
1244
1294
|
bindingSourceName: name2,
|
|
1245
1295
|
blockName,
|
|
1246
|
-
cwd
|
|
1296
|
+
cwd,
|
|
1297
|
+
metaPath,
|
|
1298
|
+
postMetaName
|
|
1247
1299
|
}),
|
|
1248
1300
|
getValues: (result) => ({
|
|
1249
1301
|
...result.attributeName ? { attributeName: result.attributeName } : {},
|
|
1250
1302
|
...result.blockSlug ? { blockSlug: result.blockSlug } : {},
|
|
1251
|
-
bindingSourceSlug: result.bindingSourceSlug
|
|
1303
|
+
bindingSourceSlug: result.bindingSourceSlug,
|
|
1304
|
+
...result.metaKey ? { metaKey: result.metaKey } : {},
|
|
1305
|
+
...result.metaPath ? { metaPath: result.metaPath } : {},
|
|
1306
|
+
...result.postMetaSlug ? { postMetaSlug: result.postMetaSlug } : {},
|
|
1307
|
+
...result.postType ? { postType: result.postType } : {},
|
|
1308
|
+
...result.schemaFile ? { schemaFile: result.schemaFile } : {}
|
|
1252
1309
|
}),
|
|
1253
1310
|
missingNameMessage: BINDING_SOURCE_MISSING_NAME_MESSAGE,
|
|
1254
1311
|
name,
|
|
@@ -1257,8 +1314,8 @@ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1257
1314
|
},
|
|
1258
1315
|
sortOrder: 70,
|
|
1259
1316
|
supportsDryRun: true,
|
|
1260
|
-
usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]",
|
|
1261
|
-
visibleFieldNames: () =>
|
|
1317
|
+
usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--from-post-meta|--post-meta <post-meta> [--meta-path <field>]] [--dry-run]",
|
|
1318
|
+
visibleFieldNames: () => NAME_BLOCK_ATTRIBUTE_POST_META_VISIBLE_FIELDS
|
|
1262
1319
|
});
|
|
1263
1320
|
|
|
1264
1321
|
// src/external-layer-prompt-options.ts
|
|
@@ -1400,6 +1457,78 @@ var contractAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1400
1457
|
visibleFieldNames: () => NAME_TYPE_VISIBLE_FIELDS
|
|
1401
1458
|
});
|
|
1402
1459
|
|
|
1460
|
+
// src/add-kinds/core-variation.ts
|
|
1461
|
+
import {
|
|
1462
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
|
|
1463
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError5
|
|
1464
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1465
|
+
var CORE_VARIATION_MISSING_NAME_MESSAGE = "`wp-typia add core-variation` requires <name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
|
|
1466
|
+
var CORE_VARIATION_MISSING_BLOCK_MESSAGE = "`wp-typia add core-variation` requires <block-name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
|
|
1467
|
+
function resolveCoreVariationInputs(context) {
|
|
1468
|
+
const positionalTargetBlockName = context.positionalArgs?.[1];
|
|
1469
|
+
const positionalVariationName = context.positionalArgs?.[2];
|
|
1470
|
+
if (positionalVariationName) {
|
|
1471
|
+
if (!positionalTargetBlockName) {
|
|
1472
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
|
|
1473
|
+
}
|
|
1474
|
+
return {
|
|
1475
|
+
targetBlockName: positionalTargetBlockName,
|
|
1476
|
+
variationName: positionalVariationName
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
if (context.name?.includes("/") && !readOptionalStrictStringFlag(context.flags, "block")) {
|
|
1480
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, CORE_VARIATION_MISSING_NAME_MESSAGE);
|
|
1481
|
+
}
|
|
1482
|
+
const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
|
|
1483
|
+
const targetBlockName = readOptionalStrictStringFlag(context.flags, "block");
|
|
1484
|
+
if (!targetBlockName) {
|
|
1485
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
|
|
1486
|
+
}
|
|
1487
|
+
return {
|
|
1488
|
+
targetBlockName,
|
|
1489
|
+
variationName
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
var coreVariationAddKindEntry = defineAddKindRegistryEntry({
|
|
1493
|
+
completion: {
|
|
1494
|
+
nextSteps: (values) => [
|
|
1495
|
+
`Review ${values.variationFile}.`,
|
|
1496
|
+
"Run your workspace build or dev command to verify the editor-side variation registration."
|
|
1497
|
+
],
|
|
1498
|
+
summaryLines: (values, projectDir) => [
|
|
1499
|
+
`Core variation: ${values.variationSlug}`,
|
|
1500
|
+
`Target block: ${values.targetBlockName}`,
|
|
1501
|
+
`Project directory: ${projectDir}`
|
|
1502
|
+
],
|
|
1503
|
+
title: "Added core block variation"
|
|
1504
|
+
},
|
|
1505
|
+
description: "Add an editor-side variation for an existing core or external block",
|
|
1506
|
+
nameLabel: "Variation name",
|
|
1507
|
+
async prepareExecution(context) {
|
|
1508
|
+
const { targetBlockName, variationName } = resolveCoreVariationInputs(context);
|
|
1509
|
+
return createNamedExecutionPlan(context, {
|
|
1510
|
+
execute: ({ cwd, name }) => context.addRuntime.runAddCoreVariationCommand({
|
|
1511
|
+
cwd,
|
|
1512
|
+
targetBlockName,
|
|
1513
|
+
variationName: name
|
|
1514
|
+
}),
|
|
1515
|
+
getValues: (result) => ({
|
|
1516
|
+
targetBlockName: result.targetBlockName,
|
|
1517
|
+
variationFile: result.variationFile,
|
|
1518
|
+
variationSlug: result.variationSlug
|
|
1519
|
+
}),
|
|
1520
|
+
missingNameMessage: CORE_VARIATION_MISSING_NAME_MESSAGE,
|
|
1521
|
+
name: variationName,
|
|
1522
|
+
warnLine: context.warnLine
|
|
1523
|
+
});
|
|
1524
|
+
},
|
|
1525
|
+
sortOrder: 25,
|
|
1526
|
+
supportsDryRun: true,
|
|
1527
|
+
usage: `wp-typia add core-variation <block-name> <name> [--dry-run]
|
|
1528
|
+
Alias: wp-typia add core-variation <name> --block <namespace/block> [--dry-run]`,
|
|
1529
|
+
visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1403
1532
|
// src/add-kinds/editor-plugin.ts
|
|
1404
1533
|
var EDITOR_PLUGIN_MISSING_NAME_MESSAGE = "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].";
|
|
1405
1534
|
var editorPluginAddKindEntry = defineAddKindRegistryEntry({
|
|
@@ -1542,33 +1671,51 @@ var PATTERN_MISSING_NAME_MESSAGE = "`wp-typia add pattern` requires <name>. Usag
|
|
|
1542
1671
|
var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
1543
1672
|
completion: {
|
|
1544
1673
|
nextSteps: (values) => [
|
|
1545
|
-
`Review
|
|
1674
|
+
`Review ${values.contentFile}.`,
|
|
1546
1675
|
"Run your workspace build or dev command to verify the new pattern registration."
|
|
1547
1676
|
],
|
|
1548
1677
|
summaryLines: (values, projectDir) => [
|
|
1549
1678
|
`Pattern: ${values.patternSlug}`,
|
|
1679
|
+
`Content file: ${values.contentFile}`,
|
|
1550
1680
|
`Project directory: ${projectDir}`
|
|
1551
1681
|
],
|
|
1552
1682
|
title: "Added workspace pattern"
|
|
1553
1683
|
},
|
|
1554
1684
|
description: "Add a PHP block pattern shell",
|
|
1685
|
+
hiddenStringSubmitFields: [
|
|
1686
|
+
"scope",
|
|
1687
|
+
"section-role",
|
|
1688
|
+
"tags",
|
|
1689
|
+
"thumbnail-url"
|
|
1690
|
+
],
|
|
1555
1691
|
nameLabel: "Pattern name",
|
|
1556
1692
|
async prepareExecution(context) {
|
|
1557
|
-
|
|
1558
|
-
|
|
1693
|
+
const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
|
|
1694
|
+
const scope = typeof context.flags.scope === "string" ? context.flags.scope : undefined;
|
|
1695
|
+
const sectionRole = typeof context.flags["section-role"] === "string" ? context.flags["section-role"] : undefined;
|
|
1696
|
+
const tags = typeof context.flags.tags === "string" ? context.flags.tags : undefined;
|
|
1697
|
+
const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
|
|
1698
|
+
return {
|
|
1699
|
+
execute: (cwd) => context.addRuntime.runAddPatternCommand({
|
|
1559
1700
|
cwd,
|
|
1560
|
-
|
|
1701
|
+
patternScope: scope,
|
|
1702
|
+
patternName: name,
|
|
1703
|
+
sectionRole,
|
|
1704
|
+
tags,
|
|
1705
|
+
thumbnailUrl
|
|
1561
1706
|
}),
|
|
1562
1707
|
getValues: (result) => ({
|
|
1563
|
-
|
|
1708
|
+
contentFile: result.contentFile,
|
|
1709
|
+
patternSlug: result.patternSlug,
|
|
1710
|
+
patternScope: result.patternScope,
|
|
1711
|
+
...result.sectionRole ? { sectionRole: result.sectionRole } : {}
|
|
1564
1712
|
}),
|
|
1565
|
-
missingNameMessage: PATTERN_MISSING_NAME_MESSAGE,
|
|
1566
1713
|
warnLine: context.warnLine
|
|
1567
|
-
}
|
|
1714
|
+
};
|
|
1568
1715
|
},
|
|
1569
1716
|
sortOrder: 60,
|
|
1570
1717
|
supportsDryRun: true,
|
|
1571
|
-
usage: "wp-typia add pattern <name> [--dry-run]",
|
|
1718
|
+
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--tags <tag,...>] [--thumbnail-url <url>] [--dry-run]",
|
|
1572
1719
|
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
|
|
1573
1720
|
});
|
|
1574
1721
|
|
|
@@ -1634,6 +1781,10 @@ var postMetaAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1634
1781
|
});
|
|
1635
1782
|
|
|
1636
1783
|
// src/add-kinds/rest-resource.ts
|
|
1784
|
+
import {
|
|
1785
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
1786
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError6
|
|
1787
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1637
1788
|
var REST_RESOURCE_GENERATED_USAGE = "Generated: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--dry-run]";
|
|
1638
1789
|
var REST_RESOURCE_MANUAL_USAGE = "Manual: wp-typia add rest-resource <name> --manual [--namespace <vendor/v1>] [--method <GET|POST|PUT|PATCH|DELETE>] [--auth <public|authenticated|public-write-protected>] [--path <route-pattern>|--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--query-type <Type>] [--body-type <Type>] [--response-type <Type>] [--secret-field <field>] [--secret-state-field|--secret-has-value-field <field>] [--secret-preserve-on-empty <true|false>] [--dry-run]";
|
|
1639
1790
|
var REST_RESOURCE_USAGE = `${REST_RESOURCE_GENERATED_USAGE}
|
|
@@ -1644,6 +1795,31 @@ var REST_RESOURCE_MISSING_NAME_MESSAGE = [
|
|
|
1644
1795
|
` ${REST_RESOURCE_MANUAL_USAGE}`
|
|
1645
1796
|
].join(`
|
|
1646
1797
|
`);
|
|
1798
|
+
var SECRET_PRESERVE_ON_EMPTY_TRUE_VALUES = new Set(["1", "true", "yes"]);
|
|
1799
|
+
var SECRET_PRESERVE_ON_EMPTY_FALSE_VALUES = new Set(["0", "false", "no"]);
|
|
1800
|
+
function readOptionalSecretPreserveOnEmptyFlag(flags) {
|
|
1801
|
+
const value = flags["secret-preserve-on-empty"] ?? flags.secretPreserveOnEmpty;
|
|
1802
|
+
if (value === undefined || value === null) {
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1805
|
+
if (typeof value === "boolean") {
|
|
1806
|
+
return value;
|
|
1807
|
+
}
|
|
1808
|
+
if (typeof value !== "string") {
|
|
1809
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1810
|
+
}
|
|
1811
|
+
const normalized = value.trim().toLowerCase();
|
|
1812
|
+
if (normalized.length === 0) {
|
|
1813
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1814
|
+
}
|
|
1815
|
+
if (SECRET_PRESERVE_ON_EMPTY_TRUE_VALUES.has(normalized)) {
|
|
1816
|
+
return true;
|
|
1817
|
+
}
|
|
1818
|
+
if (SECRET_PRESERVE_ON_EMPTY_FALSE_VALUES.has(normalized)) {
|
|
1819
|
+
return false;
|
|
1820
|
+
}
|
|
1821
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, "Manual REST contract --secret-preserve-on-empty must be true or false.");
|
|
1822
|
+
}
|
|
1647
1823
|
var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
1648
1824
|
completion: {
|
|
1649
1825
|
nextSteps: (values) => values.mode === "manual" ? [
|
|
@@ -1715,7 +1891,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1715
1891
|
const secretFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-field", "secretField");
|
|
1716
1892
|
const secretHasValueFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-has-value-field", "secretHasValueField");
|
|
1717
1893
|
const secretMaskedResponseFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-masked-response-field", "secretMaskedResponseField");
|
|
1718
|
-
const secretPreserveOnEmpty =
|
|
1894
|
+
const secretPreserveOnEmpty = readOptionalSecretPreserveOnEmptyFlag(context.flags);
|
|
1719
1895
|
const secretStateFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-state-field", "secretStateField");
|
|
1720
1896
|
return createNamedExecutionPlan(context, {
|
|
1721
1897
|
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
|
|
@@ -1900,6 +2076,7 @@ var ADD_KIND_REGISTRY = {
|
|
|
1900
2076
|
"admin-view": adminViewAddKindEntry,
|
|
1901
2077
|
block: blockAddKindEntry,
|
|
1902
2078
|
"integration-env": integrationEnvAddKindEntry,
|
|
2079
|
+
"core-variation": coreVariationAddKindEntry,
|
|
1903
2080
|
variation: variationAddKindEntry,
|
|
1904
2081
|
style: styleAddKindEntry,
|
|
1905
2082
|
transform: transformAddKindEntry,
|
|
@@ -2295,7 +2472,7 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
2295
2472
|
// package.json
|
|
2296
2473
|
var package_default = {
|
|
2297
2474
|
name: "wp-typia",
|
|
2298
|
-
version: "0.
|
|
2475
|
+
version: "0.24.0",
|
|
2299
2476
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
2300
2477
|
packageManager: "bun@1.3.11",
|
|
2301
2478
|
type: "module",
|
|
@@ -2365,7 +2542,7 @@ var package_default = {
|
|
|
2365
2542
|
"@bunli/tui": "0.6.0",
|
|
2366
2543
|
"@bunli/utils": "0.6.0",
|
|
2367
2544
|
"@wp-typia/api-client": "^0.4.5",
|
|
2368
|
-
"@wp-typia/project-tools": "0.
|
|
2545
|
+
"@wp-typia/project-tools": "0.24.0",
|
|
2369
2546
|
"better-result": "^2.7.0",
|
|
2370
2547
|
react: "^19.2.5",
|
|
2371
2548
|
"react-dom": "^19.2.5",
|
|
@@ -2394,8 +2571,8 @@ import {
|
|
|
2394
2571
|
parsePackageManagerField
|
|
2395
2572
|
} from "@wp-typia/project-tools/package-managers";
|
|
2396
2573
|
import {
|
|
2397
|
-
CLI_DIAGNOSTIC_CODES as
|
|
2398
|
-
createCliDiagnosticCodeError as
|
|
2574
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
|
|
2575
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError7
|
|
2399
2576
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2400
2577
|
var LOOSE_CREATE_COMPLETION_PACKAGE_MANAGER_PATTERN = new RegExp(`^(?:corepack\\s+)?(${PACKAGE_MANAGER_IDS.map(escapeRegExp).join("|")})(?=$|[@:/+\\s])`, "iu");
|
|
2401
2578
|
function parseCreateCompletionPackageManager(packageManager) {
|
|
@@ -2413,7 +2590,7 @@ function resolveCreateCompletionPackageManager(packageManager) {
|
|
|
2413
2590
|
if (parsedPackageManager) {
|
|
2414
2591
|
return parsedPackageManager;
|
|
2415
2592
|
}
|
|
2416
|
-
throw
|
|
2593
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
|
|
2417
2594
|
}
|
|
2418
2595
|
function formatCreateProgressLine(payload, markerOptions) {
|
|
2419
2596
|
return formatOutputMarker("progress", `${payload.title}: ${payload.detail}`, markerOptions);
|
|
@@ -2659,6 +2836,7 @@ async function executeAddCommand({
|
|
|
2659
2836
|
interactive,
|
|
2660
2837
|
kind,
|
|
2661
2838
|
name,
|
|
2839
|
+
positionalArgs,
|
|
2662
2840
|
printLine = console.log,
|
|
2663
2841
|
prompt,
|
|
2664
2842
|
warnLine = console.warn
|
|
@@ -2672,13 +2850,13 @@ async function executeAddCommand({
|
|
|
2672
2850
|
if (shouldPrintMissingAddKindHelp({ emitOutput })) {
|
|
2673
2851
|
printLine(addRuntime.formatAddHelpText());
|
|
2674
2852
|
}
|
|
2675
|
-
throw
|
|
2853
|
+
throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
|
|
2676
2854
|
}
|
|
2677
2855
|
if (!isAddKindId(kind)) {
|
|
2678
|
-
throw
|
|
2856
|
+
throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2679
2857
|
}
|
|
2680
2858
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2681
|
-
throw
|
|
2859
|
+
throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2682
2860
|
}
|
|
2683
2861
|
const executionContext = {
|
|
2684
2862
|
addRuntime,
|
|
@@ -2694,6 +2872,7 @@ async function executeAddCommand({
|
|
|
2694
2872
|
},
|
|
2695
2873
|
isInteractiveSession,
|
|
2696
2874
|
name,
|
|
2875
|
+
positionalArgs,
|
|
2697
2876
|
warnLine
|
|
2698
2877
|
};
|
|
2699
2878
|
return await executePlannedAddKind(kind, executionContext, {
|
|
@@ -2931,8 +3110,8 @@ async function executeMigrateCommand({
|
|
|
2931
3110
|
}
|
|
2932
3111
|
// src/runtime-bridge-templates.ts
|
|
2933
3112
|
import {
|
|
2934
|
-
CLI_DIAGNOSTIC_CODES as
|
|
2935
|
-
createCliDiagnosticCodeError as
|
|
3113
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES10,
|
|
3114
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError9
|
|
2936
3115
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2937
3116
|
var loadCliTemplatesRuntime2 = () => import("@wp-typia/project-tools/cli-templates");
|
|
2938
3117
|
async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
@@ -2952,24 +3131,24 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
2952
3131
|
}
|
|
2953
3132
|
if (subcommand === "inspect") {
|
|
2954
3133
|
if (!flags.id) {
|
|
2955
|
-
throw
|
|
3134
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
2956
3135
|
}
|
|
2957
3136
|
const template = getTemplateById(flags.id);
|
|
2958
3137
|
if (!template) {
|
|
2959
|
-
throw
|
|
3138
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
2960
3139
|
}
|
|
2961
3140
|
printBlock(printLine, [formatTemplateDetails(template)]);
|
|
2962
3141
|
return;
|
|
2963
3142
|
}
|
|
2964
|
-
throw
|
|
3143
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
2965
3144
|
}
|
|
2966
3145
|
// src/runtime-bridge-sync.ts
|
|
2967
3146
|
import { spawnSync } from "node:child_process";
|
|
2968
3147
|
import fs3 from "node:fs";
|
|
2969
3148
|
import path4 from "node:path";
|
|
2970
3149
|
import {
|
|
2971
|
-
CLI_DIAGNOSTIC_CODES as
|
|
2972
|
-
createCliDiagnosticCodeError as
|
|
3150
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
|
|
3151
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError10
|
|
2973
3152
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2974
3153
|
import {
|
|
2975
3154
|
formatInstallCommand,
|
|
@@ -2990,10 +3169,10 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
2990
3169
|
if (subcommand === "ai") {
|
|
2991
3170
|
return "ai";
|
|
2992
3171
|
}
|
|
2993
|
-
throw
|
|
3172
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
2994
3173
|
}
|
|
2995
3174
|
function getSyncRootError(cwd) {
|
|
2996
|
-
return
|
|
3175
|
+
return createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.OUTSIDE_PROJECT_ROOT, `No generated wp-typia project root was found at ${cwd}. Run \`wp-typia sync\` from a scaffolded project or official workspace root that already contains generated sync scripts. If you expected this directory to work, cd into the scaffold root first or rerun the scaffold before syncing.`);
|
|
2997
3176
|
}
|
|
2998
3177
|
function readSyncPackageJson(packageJsonPath) {
|
|
2999
3178
|
const source = fs3.readFileSync(packageJsonPath, "utf8");
|
|
@@ -3001,7 +3180,7 @@ function readSyncPackageJson(packageJsonPath) {
|
|
|
3001
3180
|
return JSON.parse(source);
|
|
3002
3181
|
} catch (error) {
|
|
3003
3182
|
const message = error instanceof Error ? error.message : String(error);
|
|
3004
|
-
throw
|
|
3183
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_ARGUMENT, `Unable to parse ${packageJsonPath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
3005
3184
|
}
|
|
3006
3185
|
}
|
|
3007
3186
|
function resolveSyncProjectContext(cwd) {
|
|
@@ -3068,7 +3247,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
3068
3247
|
if (markerDir) {
|
|
3069
3248
|
return;
|
|
3070
3249
|
}
|
|
3071
|
-
throw
|
|
3250
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.DEPENDENCIES_NOT_INSTALLED, `Project dependencies have not been installed yet. Run \`${formatInstallCommand(project.packageManager)}\` from the project root before \`wp-typia sync\`. The generated sync scripts rely on local tools such as \`tsx\`.`);
|
|
3072
3251
|
}
|
|
3073
3252
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
3074
3253
|
switch (packageManager) {
|
|
@@ -3106,7 +3285,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3106
3285
|
if (target === "ai") {
|
|
3107
3286
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
3108
3287
|
if (!syncAiCommand2) {
|
|
3109
|
-
throw
|
|
3288
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
3110
3289
|
}
|
|
3111
3290
|
return [syncAiCommand2];
|
|
3112
3291
|
}
|
|
@@ -3115,7 +3294,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3115
3294
|
}
|
|
3116
3295
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
3117
3296
|
if (!syncTypesCommand) {
|
|
3118
|
-
throw
|
|
3297
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
3119
3298
|
}
|
|
3120
3299
|
const plannedCommands = [syncTypesCommand];
|
|
3121
3300
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -3139,7 +3318,7 @@ function runProjectScript(project, plannedCommand, options) {
|
|
|
3139
3318
|
const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
|
|
3140
3319
|
const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
|
|
3141
3320
|
if (result.error || result.status !== 0) {
|
|
3142
|
-
throw
|
|
3321
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
|
|
3143
3322
|
cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
|
|
3144
3323
|
});
|
|
3145
3324
|
}
|
|
@@ -3181,8 +3360,8 @@ async function executeSyncCommand({
|
|
|
3181
3360
|
// src/command-contract.ts
|
|
3182
3361
|
import path5 from "node:path";
|
|
3183
3362
|
import {
|
|
3184
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3185
|
-
createCliDiagnosticCodeError as
|
|
3363
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
|
|
3364
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError11
|
|
3186
3365
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3187
3366
|
|
|
3188
3367
|
// src/command-registry.ts
|
|
@@ -3453,10 +3632,10 @@ function looksLikeStructuredProjectInput(value) {
|
|
|
3453
3632
|
function assertPositionalAliasProjectDir(projectDir) {
|
|
3454
3633
|
const normalizedProjectDir = path5.normalize(projectDir).replace(/[\\/]+$/u, "") || path5.normalize(projectDir);
|
|
3455
3634
|
if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
|
|
3456
|
-
throw
|
|
3635
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, `The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
|
|
3457
3636
|
}
|
|
3458
3637
|
if (looksLikeStructuredProjectInput(projectDir)) {
|
|
3459
|
-
throw
|
|
3638
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, `The positional alias only accepts unambiguous local project directories. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for \`${projectDir}\`.`);
|
|
3460
3639
|
}
|
|
3461
3640
|
}
|
|
3462
3641
|
function normalizeWpTypiaArgv(argv) {
|
|
@@ -3470,7 +3649,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3470
3649
|
return argv;
|
|
3471
3650
|
}
|
|
3472
3651
|
if (firstPositional === "migrations") {
|
|
3473
|
-
throw
|
|
3652
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, "`wp-typia migrations` was removed in favor of `wp-typia migrate`. Use `wp-typia migrate <subcommand>` instead.");
|
|
3474
3653
|
}
|
|
3475
3654
|
if (isReservedTopLevelCommandName(firstPositional)) {
|
|
3476
3655
|
assertStringOptionValues(argv);
|
|
@@ -3478,7 +3657,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3478
3657
|
}
|
|
3479
3658
|
if (positionalIndexes.length > 1) {
|
|
3480
3659
|
const extraPositionals = positionalIndexes.slice(1).map((index) => argv[index]).filter((value) => typeof value === "string" && value.length > 0);
|
|
3481
|
-
throw
|
|
3660
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, `The positional alias only accepts a single project directory. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for scaffold invocations with additional positional arguments, or check the command spelling if you meant another top-level command. Extra positional arguments: ${extraPositionals.map((value) => `\`${value}\``).join(", ")}.`);
|
|
3482
3661
|
}
|
|
3483
3662
|
assertPositionalAliasProjectDir(firstPositional);
|
|
3484
3663
|
const normalizedArgv = [
|
|
@@ -3492,7 +3671,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3492
3671
|
|
|
3493
3672
|
// src/node-fallback/doctor.ts
|
|
3494
3673
|
import {
|
|
3495
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3674
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
|
|
3496
3675
|
createCliCommandError as createCliCommandError2
|
|
3497
3676
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3498
3677
|
async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
@@ -3509,7 +3688,7 @@ async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
|
3509
3688
|
}, null, 2));
|
|
3510
3689
|
if (summary.exitCode === 1) {
|
|
3511
3690
|
throw createCliCommandError2({
|
|
3512
|
-
code:
|
|
3691
|
+
code: CLI_DIAGNOSTIC_CODES13.DOCTOR_CHECK_FAILED,
|
|
3513
3692
|
command: "doctor",
|
|
3514
3693
|
detailLines: getDoctorExitFailureDetailLines(checks, { exitPolicy }),
|
|
3515
3694
|
summary: "One or more doctor checks failed."
|
|
@@ -3531,9 +3710,15 @@ async function dispatchNodeFallbackDoctor({
|
|
|
3531
3710
|
|
|
3532
3711
|
// src/node-fallback/dispatchers/add.ts
|
|
3533
3712
|
import {
|
|
3534
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3713
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES14,
|
|
3535
3714
|
createCliCommandError as createCliCommandError3
|
|
3536
3715
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3716
|
+
function resolveNodeFallbackAddName(positionals) {
|
|
3717
|
+
if (positionals[1] === "core-variation" && positionals[3]) {
|
|
3718
|
+
return positionals[3];
|
|
3719
|
+
}
|
|
3720
|
+
return positionals[2];
|
|
3721
|
+
}
|
|
3537
3722
|
async function dispatchNodeFallbackAdd({
|
|
3538
3723
|
cwd,
|
|
3539
3724
|
mergedFlags,
|
|
@@ -3547,11 +3732,14 @@ async function dispatchNodeFallbackAdd({
|
|
|
3547
3732
|
printLine(formatAddHelpText());
|
|
3548
3733
|
}
|
|
3549
3734
|
throw createCliCommandError3({
|
|
3550
|
-
code:
|
|
3735
|
+
code: CLI_DIAGNOSTIC_CODES14.MISSING_ARGUMENT,
|
|
3551
3736
|
command: "add",
|
|
3552
3737
|
detailLines: buildMissingAddKindDetailLines()
|
|
3553
3738
|
});
|
|
3554
3739
|
}
|
|
3740
|
+
const kind = positionals[1];
|
|
3741
|
+
const name = resolveNodeFallbackAddName(positionals);
|
|
3742
|
+
const positionalArgs = positionals.slice(1);
|
|
3555
3743
|
if (mergedFlags.format === "json") {
|
|
3556
3744
|
let completion;
|
|
3557
3745
|
try {
|
|
@@ -3560,8 +3748,9 @@ async function dispatchNodeFallbackAdd({
|
|
|
3560
3748
|
emitOutput: false,
|
|
3561
3749
|
flags: mergedFlags,
|
|
3562
3750
|
interactive: false,
|
|
3563
|
-
kind
|
|
3564
|
-
name
|
|
3751
|
+
kind,
|
|
3752
|
+
name,
|
|
3753
|
+
positionalArgs,
|
|
3565
3754
|
printLine,
|
|
3566
3755
|
warnLine
|
|
3567
3756
|
});
|
|
@@ -3573,8 +3762,8 @@ async function dispatchNodeFallbackAdd({
|
|
|
3573
3762
|
}
|
|
3574
3763
|
printLine(JSON.stringify(buildStructuredCompletionSuccessPayload("add", completion, {
|
|
3575
3764
|
dryRun: Boolean(mergedFlags["dry-run"]),
|
|
3576
|
-
kind
|
|
3577
|
-
name
|
|
3765
|
+
kind,
|
|
3766
|
+
name,
|
|
3578
3767
|
projectDir: extractCompletionProjectDir(completion) ?? cwd
|
|
3579
3768
|
}), null, 2));
|
|
3580
3769
|
return;
|
|
@@ -3583,8 +3772,9 @@ async function dispatchNodeFallbackAdd({
|
|
|
3583
3772
|
cwd,
|
|
3584
3773
|
flags: mergedFlags,
|
|
3585
3774
|
interactive: undefined,
|
|
3586
|
-
kind
|
|
3587
|
-
name
|
|
3775
|
+
kind,
|
|
3776
|
+
name,
|
|
3777
|
+
positionalArgs,
|
|
3588
3778
|
printLine,
|
|
3589
3779
|
warnLine
|
|
3590
3780
|
});
|
|
@@ -3592,7 +3782,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3592
3782
|
|
|
3593
3783
|
// src/node-fallback/dispatchers/create.ts
|
|
3594
3784
|
import {
|
|
3595
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3785
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES15,
|
|
3596
3786
|
createCliCommandError as createCliCommandError4
|
|
3597
3787
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3598
3788
|
async function dispatchNodeFallbackCreate({
|
|
@@ -3605,7 +3795,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3605
3795
|
const projectDir = positionals[1];
|
|
3606
3796
|
if (!projectDir) {
|
|
3607
3797
|
throw createCliCommandError4({
|
|
3608
|
-
code:
|
|
3798
|
+
code: CLI_DIAGNOSTIC_CODES15.MISSING_ARGUMENT,
|
|
3609
3799
|
command: "create",
|
|
3610
3800
|
detailLines: buildMissingCreateProjectDirDetailLines()
|
|
3611
3801
|
});
|
|
@@ -3638,7 +3828,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3638
3828
|
|
|
3639
3829
|
// src/node-fallback/errors.ts
|
|
3640
3830
|
import {
|
|
3641
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3831
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES16,
|
|
3642
3832
|
createCliCommandError as createCliCommandError6,
|
|
3643
3833
|
formatCliDiagnosticError,
|
|
3644
3834
|
isCliDiagnosticError,
|
|
@@ -3756,18 +3946,18 @@ var NODE_FALLBACK_HELP_RENDERERS = Object.fromEntries(Object.entries(NODE_FALLBA
|
|
|
3756
3946
|
// src/node-fallback/errors.ts
|
|
3757
3947
|
function createNodeFallbackNoCommandCliError() {
|
|
3758
3948
|
return createCliCommandError6({
|
|
3759
|
-
code:
|
|
3949
|
+
code: CLI_DIAGNOSTIC_CODES16.INVALID_COMMAND,
|
|
3760
3950
|
command: "wp-typia",
|
|
3761
3951
|
detailLines: [NODE_FALLBACK_NO_COMMAND_REASON_LINE],
|
|
3762
3952
|
summary: "No command was provided."
|
|
3763
3953
|
});
|
|
3764
3954
|
}
|
|
3765
3955
|
function isNodeFallbackNoCommandCliDiagnostic(error) {
|
|
3766
|
-
return isCliDiagnosticError(error) && error.code ===
|
|
3956
|
+
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES16.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(NODE_FALLBACK_NO_COMMAND_REASON_LINE);
|
|
3767
3957
|
}
|
|
3768
3958
|
function throwUnsupportedNodeFallbackCommand(command) {
|
|
3769
3959
|
throw createCliCommandError6({
|
|
3770
|
-
code:
|
|
3960
|
+
code: CLI_DIAGNOSTIC_CODES16.UNSUPPORTED_COMMAND,
|
|
3771
3961
|
command,
|
|
3772
3962
|
detailLines: [
|
|
3773
3963
|
[
|
|
@@ -3803,7 +3993,7 @@ async function handleNodeFallbackEntrypointError(error, argv) {
|
|
|
3803
3993
|
|
|
3804
3994
|
// src/node-fallback/templates.ts
|
|
3805
3995
|
import {
|
|
3806
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3996
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES17,
|
|
3807
3997
|
createCliCommandError as createCliCommandError7
|
|
3808
3998
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3809
3999
|
import {
|
|
@@ -3820,7 +4010,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
3820
4010
|
const templateId = flags.id;
|
|
3821
4011
|
if (!templateId) {
|
|
3822
4012
|
throw createCliCommandError7({
|
|
3823
|
-
code:
|
|
4013
|
+
code: CLI_DIAGNOSTIC_CODES17.MISSING_ARGUMENT,
|
|
3824
4014
|
command: "templates",
|
|
3825
4015
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
3826
4016
|
});
|
|
@@ -3828,7 +4018,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
3828
4018
|
const template = getTemplateById(templateId);
|
|
3829
4019
|
if (!template) {
|
|
3830
4020
|
throw createCliCommandError7({
|
|
3831
|
-
code:
|
|
4021
|
+
code: CLI_DIAGNOSTIC_CODES17.INVALID_ARGUMENT,
|
|
3832
4022
|
command: "templates",
|
|
3833
4023
|
detailLines: [`Unknown template "${templateId}".`]
|
|
3834
4024
|
});
|
|
@@ -3847,7 +4037,7 @@ async function dispatchNodeFallbackTemplates({
|
|
|
3847
4037
|
const resolvedSubcommand = subcommand ?? (templateId ? "inspect" : "list");
|
|
3848
4038
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3849
4039
|
throw createCliCommandError7({
|
|
3850
|
-
code:
|
|
4040
|
+
code: CLI_DIAGNOSTIC_CODES17.INVALID_COMMAND,
|
|
3851
4041
|
command: "templates",
|
|
3852
4042
|
detailLines: [
|
|
3853
4043
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -4105,4 +4295,4 @@ export {
|
|
|
4105
4295
|
hasFlagBeforeTerminator
|
|
4106
4296
|
};
|
|
4107
4297
|
|
|
4108
|
-
//# debugId=
|
|
4298
|
+
//# debugId=89977F6E4F67703D64756E2164756E21
|