wp-typia 0.24.0 → 0.24.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/bin/routing-metadata.generated.js +2 -0
- package/dist-bunli/.bunli/commands.gen.js +311 -129
- package/dist-bunli/{cli-74y6z3yx.js → cli-4eqznv15.js} +11 -7
- package/dist-bunli/{cli-cwjdzq6n.js → cli-6mr6vja7.js} +75 -16
- package/dist-bunli/{cli-0v407aag.js → cli-6ys6d16y.js} +1 -1
- package/dist-bunli/{cli-add-nmdraf20.js → cli-add-r4c15g7g.js} +127 -40
- package/dist-bunli/{cli-doctor-pcss6ecx.js → cli-doctor-fd6mfx0f.js} +2 -2
- package/dist-bunli/{cli-init-he7vm7kc.js → cli-init-kmredfj7.js} +2 -2
- package/dist-bunli/{cli-v0nnagb3.js → cli-kbqztfkt.js} +221 -216
- package/dist-bunli/{cli-scaffold-an2k0fnm.js → cli-scaffold-b49zc1rw.js} +5 -5
- package/dist-bunli/{cli-sw06c521.js → cli-vxd8eyax.js} +1 -1
- package/dist-bunli/{cli-y0a8nztv.js → cli-wfvf3tv1.js} +9 -7
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-xaw5agks.js → command-list-rqt03qqy.js} +90 -25
- package/dist-bunli/{migrations-z7f4kxba.js → migrations-zhd03hvy.js} +2 -2
- package/dist-bunli/node-cli.js +208 -143
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -33,6 +33,10 @@ var ADD_OPTION_METADATA = {
|
|
|
33
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
|
+
"catalog-title": {
|
|
37
|
+
description: "Human-readable title for typed pattern catalog entries; defaults to the pattern slug title.",
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
36
40
|
"controller-class": {
|
|
37
41
|
description: "REST resource controller class used for generated route callbacks or declared manual/provider route ownership.",
|
|
38
42
|
type: "string"
|
|
@@ -142,11 +146,11 @@ var ADD_OPTION_METADATA = {
|
|
|
142
146
|
type: "string"
|
|
143
147
|
},
|
|
144
148
|
scope: {
|
|
145
|
-
description: "Pattern catalog scope for pattern workflows
|
|
149
|
+
description: "Pattern catalog scope for pattern workflows; one of full or section.",
|
|
146
150
|
type: "string"
|
|
147
151
|
},
|
|
148
152
|
"section-role": {
|
|
149
|
-
description: "Typed section role for section-scoped pattern catalog entries.",
|
|
153
|
+
description: "Typed section role for section-scoped pattern catalog entries; requires --scope section.",
|
|
150
154
|
type: "string"
|
|
151
155
|
},
|
|
152
156
|
"secret-field": {
|
|
@@ -190,7 +194,13 @@ var ADD_OPTION_METADATA = {
|
|
|
190
194
|
type: "string"
|
|
191
195
|
},
|
|
192
196
|
tags: {
|
|
193
|
-
description: "Comma-separated tags for typed pattern catalog entries.",
|
|
197
|
+
description: "Comma-separated tags for typed pattern catalog entries; combine with repeatable --tag for single tags.",
|
|
198
|
+
repeatable: true,
|
|
199
|
+
type: "string"
|
|
200
|
+
},
|
|
201
|
+
tag: {
|
|
202
|
+
description: "Repeatable single tag for typed pattern catalog entries; use --tags for comma-separated lists.",
|
|
203
|
+
repeatable: true,
|
|
194
204
|
type: "string"
|
|
195
205
|
},
|
|
196
206
|
type: {
|
|
@@ -455,10 +465,19 @@ function buildCommandOptionParser(...metadataMaps) {
|
|
|
455
465
|
}
|
|
456
466
|
return {
|
|
457
467
|
booleanOptionNames: new Set(collectOptionNamesByType(metadata, "boolean")),
|
|
468
|
+
repeatableOptionNames: new Set(Object.entries(metadata).filter(([, option]) => option.repeatable).map(([name]) => name)),
|
|
458
469
|
shortFlagMap: new Map(Object.entries(metadata).flatMap(([name, option]) => option.short ? [[option.short, { name, type: option.type }]] : [])),
|
|
459
470
|
stringOptionNames: new Set(collectOptionNamesByType(metadata, "string"))
|
|
460
471
|
};
|
|
461
472
|
}
|
|
473
|
+
function assignParsedOptionValue(flags, options) {
|
|
474
|
+
if (!options.parser.repeatableOptionNames.has(options.name)) {
|
|
475
|
+
flags[options.name] = options.value;
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const current = flags[options.name];
|
|
479
|
+
flags[options.name] = Array.isArray(current) ? [...current, options.value] : current === undefined ? [options.value] : [current, options.value];
|
|
480
|
+
}
|
|
462
481
|
function buildArgvWalkerRoutingMetadata(...metadataMaps) {
|
|
463
482
|
const parser = buildCommandOptionParser(...metadataMaps);
|
|
464
483
|
return {
|
|
@@ -473,22 +492,29 @@ function createMissingOptionValueError(optionLabel) {
|
|
|
473
492
|
function createUnknownOptionError(optionLabel) {
|
|
474
493
|
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unknown option \`${optionLabel}\`.`);
|
|
475
494
|
}
|
|
476
|
-
function
|
|
495
|
+
function walkArgvOptions(argv, options) {
|
|
477
496
|
const flags = {};
|
|
478
497
|
const nextArgv = [];
|
|
479
|
-
const
|
|
498
|
+
const booleanOptionNames = new Set(options.parser.booleanOptionNames);
|
|
499
|
+
const optionNames = new Set(options.optionNames ?? []);
|
|
500
|
+
for (const optionName of options.extraBooleanOptionNames ?? []) {
|
|
501
|
+
booleanOptionNames.add(optionName);
|
|
502
|
+
}
|
|
480
503
|
for (let index = 0;index < argv.length; index += 1) {
|
|
481
504
|
const arg = argv[index];
|
|
482
505
|
if (!arg) {
|
|
483
506
|
continue;
|
|
484
507
|
}
|
|
485
508
|
if (arg === "--") {
|
|
486
|
-
nextArgv.push(...argv.slice(index));
|
|
509
|
+
nextArgv.push(...argv.slice(index + (options.strict ? 1 : 0)));
|
|
487
510
|
break;
|
|
488
511
|
}
|
|
489
512
|
if (arg.length === 2 && arg.startsWith("-")) {
|
|
490
513
|
const shortFlag = options.parser.shortFlagMap.get(arg.slice(1));
|
|
491
|
-
if (!shortFlag || !optionNames.has(shortFlag.name)) {
|
|
514
|
+
if (!shortFlag || !options.strict && !optionNames.has(shortFlag.name)) {
|
|
515
|
+
if (options.strict) {
|
|
516
|
+
throw createUnknownOptionError(arg);
|
|
517
|
+
}
|
|
492
518
|
nextArgv.push(arg);
|
|
493
519
|
continue;
|
|
494
520
|
}
|
|
@@ -500,7 +526,11 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
500
526
|
if (!next || next.startsWith("-")) {
|
|
501
527
|
throw createMissingOptionValueError(arg);
|
|
502
528
|
}
|
|
503
|
-
flags
|
|
529
|
+
assignParsedOptionValue(flags, {
|
|
530
|
+
name: shortFlag.name,
|
|
531
|
+
parser: options.parser,
|
|
532
|
+
value: next
|
|
533
|
+
});
|
|
504
534
|
index += 1;
|
|
505
535
|
continue;
|
|
506
536
|
}
|
|
@@ -509,15 +539,18 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
509
539
|
const separatorIndex = option.indexOf("=");
|
|
510
540
|
const rawName = separatorIndex === -1 ? option : option.slice(0, separatorIndex);
|
|
511
541
|
const inlineValue = separatorIndex === -1 ? undefined : option.slice(separatorIndex + 1);
|
|
512
|
-
if (!optionNames.has(rawName)) {
|
|
542
|
+
if (!options.strict && !optionNames.has(rawName)) {
|
|
513
543
|
nextArgv.push(arg);
|
|
514
544
|
continue;
|
|
515
545
|
}
|
|
516
|
-
if (
|
|
546
|
+
if (booleanOptionNames.has(rawName)) {
|
|
517
547
|
flags[rawName] = true;
|
|
518
548
|
continue;
|
|
519
549
|
}
|
|
520
550
|
if (!options.parser.stringOptionNames.has(rawName)) {
|
|
551
|
+
if (options.strict) {
|
|
552
|
+
throw createUnknownOptionError(`--${rawName}`);
|
|
553
|
+
}
|
|
521
554
|
nextArgv.push(arg);
|
|
522
555
|
continue;
|
|
523
556
|
}
|
|
@@ -525,17 +558,28 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
525
558
|
if (!inlineValue) {
|
|
526
559
|
throw createMissingOptionValueError(`--${rawName}`);
|
|
527
560
|
}
|
|
528
|
-
flags
|
|
561
|
+
assignParsedOptionValue(flags, {
|
|
562
|
+
name: rawName,
|
|
563
|
+
parser: options.parser,
|
|
564
|
+
value: inlineValue
|
|
565
|
+
});
|
|
529
566
|
continue;
|
|
530
567
|
}
|
|
531
568
|
const next = argv[index + 1];
|
|
532
569
|
if (!next || next.startsWith("-")) {
|
|
533
570
|
throw createMissingOptionValueError(`--${rawName}`);
|
|
534
571
|
}
|
|
535
|
-
flags
|
|
572
|
+
assignParsedOptionValue(flags, {
|
|
573
|
+
name: rawName,
|
|
574
|
+
parser: options.parser,
|
|
575
|
+
value: next
|
|
576
|
+
});
|
|
536
577
|
index += 1;
|
|
537
578
|
continue;
|
|
538
579
|
}
|
|
580
|
+
if (arg.startsWith("-") && options.strict) {
|
|
581
|
+
throw createUnknownOptionError(arg);
|
|
582
|
+
}
|
|
539
583
|
nextArgv.push(arg);
|
|
540
584
|
}
|
|
541
585
|
return {
|
|
@@ -543,71 +587,19 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
543
587
|
flags
|
|
544
588
|
};
|
|
545
589
|
}
|
|
590
|
+
function extractKnownOptionValuesFromArgv(argv, options) {
|
|
591
|
+
return walkArgvOptions(argv, {
|
|
592
|
+
optionNames: options.optionNames,
|
|
593
|
+
parser: options.parser,
|
|
594
|
+
strict: false
|
|
595
|
+
});
|
|
596
|
+
}
|
|
546
597
|
function parseCommandArgvWithMetadata(argv, options) {
|
|
547
|
-
const flags = {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
for (let index = 0;index < argv.length; index += 1) {
|
|
554
|
-
const arg = argv[index];
|
|
555
|
-
if (!arg) {
|
|
556
|
-
continue;
|
|
557
|
-
}
|
|
558
|
-
if (arg === "--") {
|
|
559
|
-
positionals.push(...argv.slice(index + 1));
|
|
560
|
-
break;
|
|
561
|
-
}
|
|
562
|
-
if (arg.length === 2 && arg.startsWith("-")) {
|
|
563
|
-
const shortFlag = options.parser.shortFlagMap.get(arg.slice(1));
|
|
564
|
-
if (!shortFlag) {
|
|
565
|
-
throw createUnknownOptionError(arg);
|
|
566
|
-
}
|
|
567
|
-
if (shortFlag.type === "boolean") {
|
|
568
|
-
flags[shortFlag.name] = true;
|
|
569
|
-
continue;
|
|
570
|
-
}
|
|
571
|
-
const next = argv[index + 1];
|
|
572
|
-
if (!next || next.startsWith("-")) {
|
|
573
|
-
throw createMissingOptionValueError(arg);
|
|
574
|
-
}
|
|
575
|
-
flags[shortFlag.name] = next;
|
|
576
|
-
index += 1;
|
|
577
|
-
continue;
|
|
578
|
-
}
|
|
579
|
-
if (arg.startsWith("--")) {
|
|
580
|
-
const option = arg.slice(2);
|
|
581
|
-
const separatorIndex = option.indexOf("=");
|
|
582
|
-
const rawName = separatorIndex === -1 ? option : option.slice(0, separatorIndex);
|
|
583
|
-
const inlineValue = separatorIndex === -1 ? undefined : option.slice(separatorIndex + 1);
|
|
584
|
-
if (booleanOptionNames.has(rawName)) {
|
|
585
|
-
flags[rawName] = true;
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
if (!options.parser.stringOptionNames.has(rawName)) {
|
|
589
|
-
throw createUnknownOptionError(`--${rawName}`);
|
|
590
|
-
}
|
|
591
|
-
if (inlineValue !== undefined) {
|
|
592
|
-
if (!inlineValue) {
|
|
593
|
-
throw createMissingOptionValueError(`--${rawName}`);
|
|
594
|
-
}
|
|
595
|
-
flags[rawName] = inlineValue;
|
|
596
|
-
continue;
|
|
597
|
-
}
|
|
598
|
-
const next = argv[index + 1];
|
|
599
|
-
if (!next || next.startsWith("-")) {
|
|
600
|
-
throw createMissingOptionValueError(`--${rawName}`);
|
|
601
|
-
}
|
|
602
|
-
flags[rawName] = next;
|
|
603
|
-
index += 1;
|
|
604
|
-
continue;
|
|
605
|
-
}
|
|
606
|
-
if (arg.startsWith("-")) {
|
|
607
|
-
throw createUnknownOptionError(arg);
|
|
608
|
-
}
|
|
609
|
-
positionals.push(arg);
|
|
610
|
-
}
|
|
598
|
+
const { argv: positionals, flags } = walkArgvOptions(argv, {
|
|
599
|
+
extraBooleanOptionNames: options.extraBooleanOptionNames,
|
|
600
|
+
parser: options.parser,
|
|
601
|
+
strict: true
|
|
602
|
+
});
|
|
611
603
|
return {
|
|
612
604
|
flags,
|
|
613
605
|
positionals
|
|
@@ -627,6 +619,10 @@ function resolveCommandOptionValues(metadata, options) {
|
|
|
627
619
|
resolved[name] = Boolean(value ?? false);
|
|
628
620
|
continue;
|
|
629
621
|
}
|
|
622
|
+
if (descriptor.repeatable && Array.isArray(value)) {
|
|
623
|
+
resolved[name] = value.every((item) => typeof item === "string") ? value.join(",") : undefined;
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
630
626
|
resolved[name] = typeof value === "string" ? value : undefined;
|
|
631
627
|
}
|
|
632
628
|
return resolved;
|
|
@@ -956,8 +952,8 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
956
952
|
|
|
957
953
|
// src/runtime-bridge-add.ts
|
|
958
954
|
import {
|
|
959
|
-
CLI_DIAGNOSTIC_CODES as
|
|
960
|
-
createCliDiagnosticCodeError as
|
|
955
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES10,
|
|
956
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError9
|
|
961
957
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
962
958
|
|
|
963
959
|
// src/add-kind-ids.ts
|
|
@@ -988,6 +984,13 @@ var NAME_ONLY_VISIBLE_FIELDS = [
|
|
|
988
984
|
"kind",
|
|
989
985
|
"name"
|
|
990
986
|
];
|
|
987
|
+
var PATTERN_CATALOG_VISIBLE_FIELDS = [
|
|
988
|
+
"kind",
|
|
989
|
+
"name",
|
|
990
|
+
"scope",
|
|
991
|
+
"section-role",
|
|
992
|
+
"catalog-title"
|
|
993
|
+
];
|
|
991
994
|
var NAME_SOURCE_VISIBLE_FIELDS = [
|
|
992
995
|
"kind",
|
|
993
996
|
"name",
|
|
@@ -1464,6 +1467,15 @@ import {
|
|
|
1464
1467
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1465
1468
|
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
1469
|
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>.";
|
|
1470
|
+
var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
|
|
1471
|
+
function formatCoreVariationMissingPositionalNameMessage(blockName) {
|
|
1472
|
+
return [
|
|
1473
|
+
`\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
|
|
1474
|
+
"Usage: wp-typia add core-variation <block-name> <name>",
|
|
1475
|
+
"Alternative: wp-typia add core-variation <name> --block <namespace/block>"
|
|
1476
|
+
].join(`
|
|
1477
|
+
`);
|
|
1478
|
+
}
|
|
1467
1479
|
function resolveCoreVariationInputs(context) {
|
|
1468
1480
|
const positionalTargetBlockName = context.positionalArgs?.[1];
|
|
1469
1481
|
const positionalVariationName = context.positionalArgs?.[2];
|
|
@@ -1476,16 +1488,17 @@ function resolveCoreVariationInputs(context) {
|
|
|
1476
1488
|
variationName: positionalVariationName
|
|
1477
1489
|
};
|
|
1478
1490
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1491
|
+
const targetBlockFlag = readOptionalStrictStringFlag(context.flags, "block");
|
|
1492
|
+
const missingPositionalNameTarget = context.name !== undefined && positionalTargetBlockName === context.name && CORE_VARIATION_BLOCK_NAME_PATTERN.test(context.name) ? context.name : undefined;
|
|
1493
|
+
if (missingPositionalNameTarget && !targetBlockFlag) {
|
|
1494
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, formatCoreVariationMissingPositionalNameMessage(missingPositionalNameTarget));
|
|
1481
1495
|
}
|
|
1482
1496
|
const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
|
|
1483
|
-
|
|
1484
|
-
if (!targetBlockName) {
|
|
1497
|
+
if (!targetBlockFlag) {
|
|
1485
1498
|
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
|
|
1486
1499
|
}
|
|
1487
1500
|
return {
|
|
1488
|
-
targetBlockName,
|
|
1501
|
+
targetBlockName: targetBlockFlag,
|
|
1489
1502
|
variationName
|
|
1490
1503
|
};
|
|
1491
1504
|
}
|
|
@@ -1517,6 +1530,7 @@ var coreVariationAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1517
1530
|
variationFile: result.variationFile,
|
|
1518
1531
|
variationSlug: result.variationSlug
|
|
1519
1532
|
}),
|
|
1533
|
+
getWarnings: (result) => result.warnings,
|
|
1520
1534
|
missingNameMessage: CORE_VARIATION_MISSING_NAME_MESSAGE,
|
|
1521
1535
|
name: variationName,
|
|
1522
1536
|
warnLine: context.warnLine
|
|
@@ -1663,10 +1677,15 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1663
1677
|
supportsDryRun: true,
|
|
1664
1678
|
usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
|
|
1665
1679
|
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
|
|
1666
|
-
hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
|
|
1680
|
+
hiddenBooleanSubmitFields: ["wp-env", "release-zip"],
|
|
1681
|
+
hiddenStringSubmitFields: ["service"]
|
|
1667
1682
|
});
|
|
1668
1683
|
|
|
1669
1684
|
// src/add-kinds/pattern.ts
|
|
1685
|
+
import {
|
|
1686
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
1687
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError6
|
|
1688
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1670
1689
|
var PATTERN_MISSING_NAME_MESSAGE = "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>.";
|
|
1671
1690
|
var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
1672
1691
|
completion: {
|
|
@@ -1682,21 +1701,18 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1682
1701
|
title: "Added workspace pattern"
|
|
1683
1702
|
},
|
|
1684
1703
|
description: "Add a PHP block pattern shell",
|
|
1685
|
-
hiddenStringSubmitFields: [
|
|
1686
|
-
"scope",
|
|
1687
|
-
"section-role",
|
|
1688
|
-
"tags",
|
|
1689
|
-
"thumbnail-url"
|
|
1690
|
-
],
|
|
1704
|
+
hiddenStringSubmitFields: ["tag", "tags", "thumbnail-url"],
|
|
1691
1705
|
nameLabel: "Pattern name",
|
|
1692
1706
|
async prepareExecution(context) {
|
|
1693
1707
|
const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
|
|
1694
|
-
const scope =
|
|
1695
|
-
const sectionRole =
|
|
1696
|
-
const
|
|
1708
|
+
const scope = resolvePatternScopeFlag(context);
|
|
1709
|
+
const sectionRole = resolvePatternSectionRoleFlag(context, scope);
|
|
1710
|
+
const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
|
|
1711
|
+
const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
|
|
1697
1712
|
const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
|
|
1698
1713
|
return {
|
|
1699
1714
|
execute: (cwd) => context.addRuntime.runAddPatternCommand({
|
|
1715
|
+
catalogTitle,
|
|
1700
1716
|
cwd,
|
|
1701
1717
|
patternScope: scope,
|
|
1702
1718
|
patternName: name,
|
|
@@ -1715,9 +1731,58 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1715
1731
|
},
|
|
1716
1732
|
sortOrder: 60,
|
|
1717
1733
|
supportsDryRun: true,
|
|
1718
|
-
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--tags <tag,...>] [--thumbnail-url <url>] [--dry-run]",
|
|
1719
|
-
visibleFieldNames: () =>
|
|
1734
|
+
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
|
|
1735
|
+
visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
|
|
1720
1736
|
});
|
|
1737
|
+
function createInvalidPatternArgumentError(message) {
|
|
1738
|
+
return createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, message);
|
|
1739
|
+
}
|
|
1740
|
+
function createMissingPatternArgumentError(message) {
|
|
1741
|
+
return createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, message);
|
|
1742
|
+
}
|
|
1743
|
+
function resolvePatternScopeFlag(context) {
|
|
1744
|
+
const scope = readOptionalLooseStringFlag(context.flags, "scope");
|
|
1745
|
+
if (!scope) {
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
if (context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.includes(scope)) {
|
|
1749
|
+
return scope;
|
|
1750
|
+
}
|
|
1751
|
+
throw createInvalidPatternArgumentError(`\`--scope\` must be one of: ${context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.join(", ")}. Usage: wp-typia add pattern <name> --scope <full|section>.`);
|
|
1752
|
+
}
|
|
1753
|
+
function resolvePatternSectionRoleFlag(context, scope) {
|
|
1754
|
+
const sectionRole = readOptionalLooseStringFlag(context.flags, "section-role");
|
|
1755
|
+
if (scope === "section" && sectionRole === undefined) {
|
|
1756
|
+
throw createMissingPatternArgumentError("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
|
|
1757
|
+
}
|
|
1758
|
+
if (scope !== "section" && sectionRole !== undefined) {
|
|
1759
|
+
throw createInvalidPatternArgumentError("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
|
|
1760
|
+
}
|
|
1761
|
+
const normalizedSectionRole = sectionRole === undefined ? undefined : context.addRuntime.normalizeBlockSlug(sectionRole);
|
|
1762
|
+
if (normalizedSectionRole && !context.addRuntime.PATTERN_SECTION_ROLE_PATTERN.test(normalizedSectionRole)) {
|
|
1763
|
+
throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
|
|
1764
|
+
}
|
|
1765
|
+
if (sectionRole !== undefined && !normalizedSectionRole) {
|
|
1766
|
+
throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
|
|
1767
|
+
}
|
|
1768
|
+
return normalizedSectionRole;
|
|
1769
|
+
}
|
|
1770
|
+
function collectStringFlagValues(value) {
|
|
1771
|
+
if (typeof value === "string") {
|
|
1772
|
+
return [value];
|
|
1773
|
+
}
|
|
1774
|
+
if (Array.isArray(value)) {
|
|
1775
|
+
return value.filter((item) => typeof item === "string");
|
|
1776
|
+
}
|
|
1777
|
+
return [];
|
|
1778
|
+
}
|
|
1779
|
+
function normalizePatternTagFlags(tagsFlag, tagFlag) {
|
|
1780
|
+
const tags = [
|
|
1781
|
+
...collectStringFlagValues(tagsFlag),
|
|
1782
|
+
...collectStringFlagValues(tagFlag)
|
|
1783
|
+
];
|
|
1784
|
+
return tags.length > 0 ? tags : undefined;
|
|
1785
|
+
}
|
|
1721
1786
|
|
|
1722
1787
|
// src/add-kinds/post-meta.ts
|
|
1723
1788
|
var POST_META_MISSING_NAME_MESSAGE = "`wp-typia add post-meta` requires <name>. Usage: wp-typia add post-meta <name> --post-type <post-type> [--type <ExportedTypeName>] [--meta-key <meta-key>].";
|
|
@@ -1782,8 +1847,8 @@ var postMetaAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1782
1847
|
|
|
1783
1848
|
// src/add-kinds/rest-resource.ts
|
|
1784
1849
|
import {
|
|
1785
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1786
|
-
createCliDiagnosticCodeError as
|
|
1850
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
|
|
1851
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError7
|
|
1787
1852
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1788
1853
|
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]";
|
|
1789
1854
|
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]";
|
|
@@ -1806,11 +1871,11 @@ function readOptionalSecretPreserveOnEmptyFlag(flags) {
|
|
|
1806
1871
|
return value;
|
|
1807
1872
|
}
|
|
1808
1873
|
if (typeof value !== "string") {
|
|
1809
|
-
throw
|
|
1874
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1810
1875
|
}
|
|
1811
1876
|
const normalized = value.trim().toLowerCase();
|
|
1812
1877
|
if (normalized.length === 0) {
|
|
1813
|
-
throw
|
|
1878
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1814
1879
|
}
|
|
1815
1880
|
if (SECRET_PRESERVE_ON_EMPTY_TRUE_VALUES.has(normalized)) {
|
|
1816
1881
|
return true;
|
|
@@ -1818,7 +1883,7 @@ function readOptionalSecretPreserveOnEmptyFlag(flags) {
|
|
|
1818
1883
|
if (SECRET_PRESERVE_ON_EMPTY_FALSE_VALUES.has(normalized)) {
|
|
1819
1884
|
return false;
|
|
1820
1885
|
}
|
|
1821
|
-
throw
|
|
1886
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, "Manual REST contract --secret-preserve-on-empty must be true or false.");
|
|
1822
1887
|
}
|
|
1823
1888
|
var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
1824
1889
|
completion: {
|
|
@@ -2472,7 +2537,7 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
2472
2537
|
// package.json
|
|
2473
2538
|
var package_default = {
|
|
2474
2539
|
name: "wp-typia",
|
|
2475
|
-
version: "0.24.
|
|
2540
|
+
version: "0.24.2",
|
|
2476
2541
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
2477
2542
|
packageManager: "bun@1.3.11",
|
|
2478
2543
|
type: "module",
|
|
@@ -2542,7 +2607,7 @@ var package_default = {
|
|
|
2542
2607
|
"@bunli/tui": "0.6.0",
|
|
2543
2608
|
"@bunli/utils": "0.6.0",
|
|
2544
2609
|
"@wp-typia/api-client": "^0.4.5",
|
|
2545
|
-
"@wp-typia/project-tools": "0.24.
|
|
2610
|
+
"@wp-typia/project-tools": "0.24.2",
|
|
2546
2611
|
"better-result": "^2.7.0",
|
|
2547
2612
|
react: "^19.2.5",
|
|
2548
2613
|
"react-dom": "^19.2.5",
|
|
@@ -2571,8 +2636,8 @@ import {
|
|
|
2571
2636
|
parsePackageManagerField
|
|
2572
2637
|
} from "@wp-typia/project-tools/package-managers";
|
|
2573
2638
|
import {
|
|
2574
|
-
CLI_DIAGNOSTIC_CODES as
|
|
2575
|
-
createCliDiagnosticCodeError as
|
|
2639
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES9,
|
|
2640
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError8
|
|
2576
2641
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2577
2642
|
var LOOSE_CREATE_COMPLETION_PACKAGE_MANAGER_PATTERN = new RegExp(`^(?:corepack\\s+)?(${PACKAGE_MANAGER_IDS.map(escapeRegExp).join("|")})(?=$|[@:/+\\s])`, "iu");
|
|
2578
2643
|
function parseCreateCompletionPackageManager(packageManager) {
|
|
@@ -2590,7 +2655,7 @@ function resolveCreateCompletionPackageManager(packageManager) {
|
|
|
2590
2655
|
if (parsedPackageManager) {
|
|
2591
2656
|
return parsedPackageManager;
|
|
2592
2657
|
}
|
|
2593
|
-
throw
|
|
2658
|
+
throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
|
|
2594
2659
|
}
|
|
2595
2660
|
function formatCreateProgressLine(payload, markerOptions) {
|
|
2596
2661
|
return formatOutputMarker("progress", `${payload.title}: ${payload.detail}`, markerOptions);
|
|
@@ -2850,13 +2915,13 @@ async function executeAddCommand({
|
|
|
2850
2915
|
if (shouldPrintMissingAddKindHelp({ emitOutput })) {
|
|
2851
2916
|
printLine(addRuntime.formatAddHelpText());
|
|
2852
2917
|
}
|
|
2853
|
-
throw
|
|
2918
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
|
|
2854
2919
|
}
|
|
2855
2920
|
if (!isAddKindId(kind)) {
|
|
2856
|
-
throw
|
|
2921
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2857
2922
|
}
|
|
2858
2923
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2859
|
-
throw
|
|
2924
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2860
2925
|
}
|
|
2861
2926
|
const executionContext = {
|
|
2862
2927
|
addRuntime,
|
|
@@ -3110,8 +3175,8 @@ async function executeMigrateCommand({
|
|
|
3110
3175
|
}
|
|
3111
3176
|
// src/runtime-bridge-templates.ts
|
|
3112
3177
|
import {
|
|
3113
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3114
|
-
createCliDiagnosticCodeError as
|
|
3178
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
|
|
3179
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError10
|
|
3115
3180
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3116
3181
|
var loadCliTemplatesRuntime2 = () => import("@wp-typia/project-tools/cli-templates");
|
|
3117
3182
|
async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
@@ -3131,24 +3196,24 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
3131
3196
|
}
|
|
3132
3197
|
if (subcommand === "inspect") {
|
|
3133
3198
|
if (!flags.id) {
|
|
3134
|
-
throw
|
|
3199
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
3135
3200
|
}
|
|
3136
3201
|
const template = getTemplateById(flags.id);
|
|
3137
3202
|
if (!template) {
|
|
3138
|
-
throw
|
|
3203
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
3139
3204
|
}
|
|
3140
3205
|
printBlock(printLine, [formatTemplateDetails(template)]);
|
|
3141
3206
|
return;
|
|
3142
3207
|
}
|
|
3143
|
-
throw
|
|
3208
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
3144
3209
|
}
|
|
3145
3210
|
// src/runtime-bridge-sync.ts
|
|
3146
3211
|
import { spawnSync } from "node:child_process";
|
|
3147
3212
|
import fs3 from "node:fs";
|
|
3148
3213
|
import path4 from "node:path";
|
|
3149
3214
|
import {
|
|
3150
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3151
|
-
createCliDiagnosticCodeError as
|
|
3215
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
|
|
3216
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError11
|
|
3152
3217
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3153
3218
|
import {
|
|
3154
3219
|
formatInstallCommand,
|
|
@@ -3169,10 +3234,10 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
3169
3234
|
if (subcommand === "ai") {
|
|
3170
3235
|
return "ai";
|
|
3171
3236
|
}
|
|
3172
|
-
throw
|
|
3237
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
3173
3238
|
}
|
|
3174
3239
|
function getSyncRootError(cwd) {
|
|
3175
|
-
return
|
|
3240
|
+
return createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.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.`);
|
|
3176
3241
|
}
|
|
3177
3242
|
function readSyncPackageJson(packageJsonPath) {
|
|
3178
3243
|
const source = fs3.readFileSync(packageJsonPath, "utf8");
|
|
@@ -3180,7 +3245,7 @@ function readSyncPackageJson(packageJsonPath) {
|
|
|
3180
3245
|
return JSON.parse(source);
|
|
3181
3246
|
} catch (error) {
|
|
3182
3247
|
const message = error instanceof Error ? error.message : String(error);
|
|
3183
|
-
throw
|
|
3248
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, `Unable to parse ${packageJsonPath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
3184
3249
|
}
|
|
3185
3250
|
}
|
|
3186
3251
|
function resolveSyncProjectContext(cwd) {
|
|
@@ -3247,7 +3312,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
3247
3312
|
if (markerDir) {
|
|
3248
3313
|
return;
|
|
3249
3314
|
}
|
|
3250
|
-
throw
|
|
3315
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.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\`.`);
|
|
3251
3316
|
}
|
|
3252
3317
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
3253
3318
|
switch (packageManager) {
|
|
@@ -3285,7 +3350,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3285
3350
|
if (target === "ai") {
|
|
3286
3351
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
3287
3352
|
if (!syncAiCommand2) {
|
|
3288
|
-
throw
|
|
3353
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
3289
3354
|
}
|
|
3290
3355
|
return [syncAiCommand2];
|
|
3291
3356
|
}
|
|
@@ -3294,7 +3359,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3294
3359
|
}
|
|
3295
3360
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
3296
3361
|
if (!syncTypesCommand) {
|
|
3297
|
-
throw
|
|
3362
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
3298
3363
|
}
|
|
3299
3364
|
const plannedCommands = [syncTypesCommand];
|
|
3300
3365
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -3318,7 +3383,7 @@ function runProjectScript(project, plannedCommand, options) {
|
|
|
3318
3383
|
const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
|
|
3319
3384
|
const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
|
|
3320
3385
|
if (result.error || result.status !== 0) {
|
|
3321
|
-
throw
|
|
3386
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
|
|
3322
3387
|
cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
|
|
3323
3388
|
});
|
|
3324
3389
|
}
|
|
@@ -3360,8 +3425,8 @@ async function executeSyncCommand({
|
|
|
3360
3425
|
// src/command-contract.ts
|
|
3361
3426
|
import path5 from "node:path";
|
|
3362
3427
|
import {
|
|
3363
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3364
|
-
createCliDiagnosticCodeError as
|
|
3428
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
|
|
3429
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError12
|
|
3365
3430
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3366
3431
|
|
|
3367
3432
|
// src/command-registry.ts
|
|
@@ -3632,10 +3697,10 @@ function looksLikeStructuredProjectInput(value) {
|
|
|
3632
3697
|
function assertPositionalAliasProjectDir(projectDir) {
|
|
3633
3698
|
const normalizedProjectDir = path5.normalize(projectDir).replace(/[\\/]+$/u, "") || path5.normalize(projectDir);
|
|
3634
3699
|
if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
|
|
3635
|
-
throw
|
|
3700
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT, `The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
|
|
3636
3701
|
}
|
|
3637
3702
|
if (looksLikeStructuredProjectInput(projectDir)) {
|
|
3638
|
-
throw
|
|
3703
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT, `The positional alias only accepts unambiguous local project directories. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for \`${projectDir}\`.`);
|
|
3639
3704
|
}
|
|
3640
3705
|
}
|
|
3641
3706
|
function normalizeWpTypiaArgv(argv) {
|
|
@@ -3649,7 +3714,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3649
3714
|
return argv;
|
|
3650
3715
|
}
|
|
3651
3716
|
if (firstPositional === "migrations") {
|
|
3652
|
-
throw
|
|
3717
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT, "`wp-typia migrations` was removed in favor of `wp-typia migrate`. Use `wp-typia migrate <subcommand>` instead.");
|
|
3653
3718
|
}
|
|
3654
3719
|
if (isReservedTopLevelCommandName(firstPositional)) {
|
|
3655
3720
|
assertStringOptionValues(argv);
|
|
@@ -3657,7 +3722,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3657
3722
|
}
|
|
3658
3723
|
if (positionalIndexes.length > 1) {
|
|
3659
3724
|
const extraPositionals = positionalIndexes.slice(1).map((index) => argv[index]).filter((value) => typeof value === "string" && value.length > 0);
|
|
3660
|
-
throw
|
|
3725
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.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(", ")}.`);
|
|
3661
3726
|
}
|
|
3662
3727
|
assertPositionalAliasProjectDir(firstPositional);
|
|
3663
3728
|
const normalizedArgv = [
|
|
@@ -3671,7 +3736,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3671
3736
|
|
|
3672
3737
|
// src/node-fallback/doctor.ts
|
|
3673
3738
|
import {
|
|
3674
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3739
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES14,
|
|
3675
3740
|
createCliCommandError as createCliCommandError2
|
|
3676
3741
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3677
3742
|
async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
@@ -3688,7 +3753,7 @@ async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
|
3688
3753
|
}, null, 2));
|
|
3689
3754
|
if (summary.exitCode === 1) {
|
|
3690
3755
|
throw createCliCommandError2({
|
|
3691
|
-
code:
|
|
3756
|
+
code: CLI_DIAGNOSTIC_CODES14.DOCTOR_CHECK_FAILED,
|
|
3692
3757
|
command: "doctor",
|
|
3693
3758
|
detailLines: getDoctorExitFailureDetailLines(checks, { exitPolicy }),
|
|
3694
3759
|
summary: "One or more doctor checks failed."
|
|
@@ -3710,7 +3775,7 @@ async function dispatchNodeFallbackDoctor({
|
|
|
3710
3775
|
|
|
3711
3776
|
// src/node-fallback/dispatchers/add.ts
|
|
3712
3777
|
import {
|
|
3713
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3778
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES15,
|
|
3714
3779
|
createCliCommandError as createCliCommandError3
|
|
3715
3780
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3716
3781
|
function resolveNodeFallbackAddName(positionals) {
|
|
@@ -3732,7 +3797,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3732
3797
|
printLine(formatAddHelpText());
|
|
3733
3798
|
}
|
|
3734
3799
|
throw createCliCommandError3({
|
|
3735
|
-
code:
|
|
3800
|
+
code: CLI_DIAGNOSTIC_CODES15.MISSING_ARGUMENT,
|
|
3736
3801
|
command: "add",
|
|
3737
3802
|
detailLines: buildMissingAddKindDetailLines()
|
|
3738
3803
|
});
|
|
@@ -3782,7 +3847,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3782
3847
|
|
|
3783
3848
|
// src/node-fallback/dispatchers/create.ts
|
|
3784
3849
|
import {
|
|
3785
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3850
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES16,
|
|
3786
3851
|
createCliCommandError as createCliCommandError4
|
|
3787
3852
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3788
3853
|
async function dispatchNodeFallbackCreate({
|
|
@@ -3795,7 +3860,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3795
3860
|
const projectDir = positionals[1];
|
|
3796
3861
|
if (!projectDir) {
|
|
3797
3862
|
throw createCliCommandError4({
|
|
3798
|
-
code:
|
|
3863
|
+
code: CLI_DIAGNOSTIC_CODES16.MISSING_ARGUMENT,
|
|
3799
3864
|
command: "create",
|
|
3800
3865
|
detailLines: buildMissingCreateProjectDirDetailLines()
|
|
3801
3866
|
});
|
|
@@ -3828,7 +3893,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3828
3893
|
|
|
3829
3894
|
// src/node-fallback/errors.ts
|
|
3830
3895
|
import {
|
|
3831
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3896
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES17,
|
|
3832
3897
|
createCliCommandError as createCliCommandError6,
|
|
3833
3898
|
formatCliDiagnosticError,
|
|
3834
3899
|
isCliDiagnosticError,
|
|
@@ -3946,18 +4011,18 @@ var NODE_FALLBACK_HELP_RENDERERS = Object.fromEntries(Object.entries(NODE_FALLBA
|
|
|
3946
4011
|
// src/node-fallback/errors.ts
|
|
3947
4012
|
function createNodeFallbackNoCommandCliError() {
|
|
3948
4013
|
return createCliCommandError6({
|
|
3949
|
-
code:
|
|
4014
|
+
code: CLI_DIAGNOSTIC_CODES17.INVALID_COMMAND,
|
|
3950
4015
|
command: "wp-typia",
|
|
3951
4016
|
detailLines: [NODE_FALLBACK_NO_COMMAND_REASON_LINE],
|
|
3952
4017
|
summary: "No command was provided."
|
|
3953
4018
|
});
|
|
3954
4019
|
}
|
|
3955
4020
|
function isNodeFallbackNoCommandCliDiagnostic(error) {
|
|
3956
|
-
return isCliDiagnosticError(error) && error.code ===
|
|
4021
|
+
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES17.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(NODE_FALLBACK_NO_COMMAND_REASON_LINE);
|
|
3957
4022
|
}
|
|
3958
4023
|
function throwUnsupportedNodeFallbackCommand(command) {
|
|
3959
4024
|
throw createCliCommandError6({
|
|
3960
|
-
code:
|
|
4025
|
+
code: CLI_DIAGNOSTIC_CODES17.UNSUPPORTED_COMMAND,
|
|
3961
4026
|
command,
|
|
3962
4027
|
detailLines: [
|
|
3963
4028
|
[
|
|
@@ -3993,7 +4058,7 @@ async function handleNodeFallbackEntrypointError(error, argv) {
|
|
|
3993
4058
|
|
|
3994
4059
|
// src/node-fallback/templates.ts
|
|
3995
4060
|
import {
|
|
3996
|
-
CLI_DIAGNOSTIC_CODES as
|
|
4061
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES18,
|
|
3997
4062
|
createCliCommandError as createCliCommandError7
|
|
3998
4063
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3999
4064
|
import {
|
|
@@ -4010,7 +4075,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
4010
4075
|
const templateId = flags.id;
|
|
4011
4076
|
if (!templateId) {
|
|
4012
4077
|
throw createCliCommandError7({
|
|
4013
|
-
code:
|
|
4078
|
+
code: CLI_DIAGNOSTIC_CODES18.MISSING_ARGUMENT,
|
|
4014
4079
|
command: "templates",
|
|
4015
4080
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
4016
4081
|
});
|
|
@@ -4018,7 +4083,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
4018
4083
|
const template = getTemplateById(templateId);
|
|
4019
4084
|
if (!template) {
|
|
4020
4085
|
throw createCliCommandError7({
|
|
4021
|
-
code:
|
|
4086
|
+
code: CLI_DIAGNOSTIC_CODES18.INVALID_ARGUMENT,
|
|
4022
4087
|
command: "templates",
|
|
4023
4088
|
detailLines: [`Unknown template "${templateId}".`]
|
|
4024
4089
|
});
|
|
@@ -4037,7 +4102,7 @@ async function dispatchNodeFallbackTemplates({
|
|
|
4037
4102
|
const resolvedSubcommand = subcommand ?? (templateId ? "inspect" : "list");
|
|
4038
4103
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
4039
4104
|
throw createCliCommandError7({
|
|
4040
|
-
code:
|
|
4105
|
+
code: CLI_DIAGNOSTIC_CODES18.INVALID_COMMAND,
|
|
4041
4106
|
command: "templates",
|
|
4042
4107
|
detailLines: [
|
|
4043
4108
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -4295,4 +4360,4 @@ export {
|
|
|
4295
4360
|
hasFlagBeforeTerminator
|
|
4296
4361
|
};
|
|
4297
4362
|
|
|
4298
|
-
//# debugId=
|
|
4363
|
+
//# debugId=925E6E8A01768B3B64756E2164756E21
|