wp-typia 0.24.1 → 0.24.3
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 +346 -323
- package/dist-bunli/{cli-gaq29kzp.js → cli-377p86mf.js} +1 -1
- package/dist-bunli/{cli-1xt99e09.js → cli-4pzxbk4s.js} +36 -13
- package/dist-bunli/{cli-zjw3eqfj.js → cli-84c7wff4.js} +1 -1
- package/dist-bunli/{cli-add-mr731xtv.js → cli-add-mxxk5rep.js} +20 -12
- package/dist-bunli/{cli-doctor-kf9gwdhh.js → cli-doctor-6fyxq940.js} +2 -2
- package/dist-bunli/{cli-h2v72j8q.js → cli-fv4h3ydt.js} +188 -188
- package/dist-bunli/{cli-init-557vq109.js → cli-init-7avk42dh.js} +2 -2
- package/dist-bunli/{cli-4ah8dawy.js → cli-kfm9mm68.js} +3130 -3132
- package/dist-bunli/{cli-scaffold-bt1ttnkg.js → cli-scaffold-0bb6pr3w.js} +95 -133
- package/dist-bunli/{cli-fzhkqzc7.js → cli-tj7ajdvf.js} +1 -1
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-bd2582k1.js → command-list-bgwaa2f4.js} +73 -33
- package/dist-bunli/{migrations-ky53fj2h.js → migrations-3vngdy51.js} +2 -2
- package/dist-bunli/node-cli.js +154 -161
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -146,11 +146,11 @@ var ADD_OPTION_METADATA = {
|
|
|
146
146
|
type: "string"
|
|
147
147
|
},
|
|
148
148
|
scope: {
|
|
149
|
-
description: "Pattern catalog scope for pattern workflows
|
|
149
|
+
description: "Pattern catalog scope for pattern workflows; one of full or section.",
|
|
150
150
|
type: "string"
|
|
151
151
|
},
|
|
152
152
|
"section-role": {
|
|
153
|
-
description: "Typed section role for section-scoped pattern catalog entries.",
|
|
153
|
+
description: "Typed section role for section-scoped pattern catalog entries; requires --scope section.",
|
|
154
154
|
type: "string"
|
|
155
155
|
},
|
|
156
156
|
"secret-field": {
|
|
@@ -194,12 +194,12 @@ var ADD_OPTION_METADATA = {
|
|
|
194
194
|
type: "string"
|
|
195
195
|
},
|
|
196
196
|
tags: {
|
|
197
|
-
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
198
|
repeatable: true,
|
|
199
199
|
type: "string"
|
|
200
200
|
},
|
|
201
201
|
tag: {
|
|
202
|
-
description: "Repeatable
|
|
202
|
+
description: "Repeatable single tag for typed pattern catalog entries; use --tags for comma-separated lists.",
|
|
203
203
|
repeatable: true,
|
|
204
204
|
type: "string"
|
|
205
205
|
},
|
|
@@ -492,22 +492,29 @@ function createMissingOptionValueError(optionLabel) {
|
|
|
492
492
|
function createUnknownOptionError(optionLabel) {
|
|
493
493
|
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unknown option \`${optionLabel}\`.`);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function walkArgvOptions(argv, options) {
|
|
496
496
|
const flags = {};
|
|
497
497
|
const nextArgv = [];
|
|
498
|
-
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
|
+
}
|
|
499
503
|
for (let index = 0;index < argv.length; index += 1) {
|
|
500
504
|
const arg = argv[index];
|
|
501
505
|
if (!arg) {
|
|
502
506
|
continue;
|
|
503
507
|
}
|
|
504
508
|
if (arg === "--") {
|
|
505
|
-
nextArgv.push(...argv.slice(index));
|
|
509
|
+
nextArgv.push(...argv.slice(index + (options.strict ? 1 : 0)));
|
|
506
510
|
break;
|
|
507
511
|
}
|
|
508
512
|
if (arg.length === 2 && arg.startsWith("-")) {
|
|
509
513
|
const shortFlag = options.parser.shortFlagMap.get(arg.slice(1));
|
|
510
|
-
if (!shortFlag || !optionNames.has(shortFlag.name)) {
|
|
514
|
+
if (!shortFlag || !options.strict && !optionNames.has(shortFlag.name)) {
|
|
515
|
+
if (options.strict) {
|
|
516
|
+
throw createUnknownOptionError(arg);
|
|
517
|
+
}
|
|
511
518
|
nextArgv.push(arg);
|
|
512
519
|
continue;
|
|
513
520
|
}
|
|
@@ -532,15 +539,18 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
532
539
|
const separatorIndex = option.indexOf("=");
|
|
533
540
|
const rawName = separatorIndex === -1 ? option : option.slice(0, separatorIndex);
|
|
534
541
|
const inlineValue = separatorIndex === -1 ? undefined : option.slice(separatorIndex + 1);
|
|
535
|
-
if (!optionNames.has(rawName)) {
|
|
542
|
+
if (!options.strict && !optionNames.has(rawName)) {
|
|
536
543
|
nextArgv.push(arg);
|
|
537
544
|
continue;
|
|
538
545
|
}
|
|
539
|
-
if (
|
|
546
|
+
if (booleanOptionNames.has(rawName)) {
|
|
540
547
|
flags[rawName] = true;
|
|
541
548
|
continue;
|
|
542
549
|
}
|
|
543
550
|
if (!options.parser.stringOptionNames.has(rawName)) {
|
|
551
|
+
if (options.strict) {
|
|
552
|
+
throw createUnknownOptionError(`--${rawName}`);
|
|
553
|
+
}
|
|
544
554
|
nextArgv.push(arg);
|
|
545
555
|
continue;
|
|
546
556
|
}
|
|
@@ -567,6 +577,9 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
567
577
|
index += 1;
|
|
568
578
|
continue;
|
|
569
579
|
}
|
|
580
|
+
if (arg.startsWith("-") && options.strict) {
|
|
581
|
+
throw createUnknownOptionError(arg);
|
|
582
|
+
}
|
|
570
583
|
nextArgv.push(arg);
|
|
571
584
|
}
|
|
572
585
|
return {
|
|
@@ -574,83 +587,19 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
574
587
|
flags
|
|
575
588
|
};
|
|
576
589
|
}
|
|
590
|
+
function extractKnownOptionValuesFromArgv(argv, options) {
|
|
591
|
+
return walkArgvOptions(argv, {
|
|
592
|
+
optionNames: options.optionNames,
|
|
593
|
+
parser: options.parser,
|
|
594
|
+
strict: false
|
|
595
|
+
});
|
|
596
|
+
}
|
|
577
597
|
function parseCommandArgvWithMetadata(argv, options) {
|
|
578
|
-
const flags = {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
for (let index = 0;index < argv.length; index += 1) {
|
|
585
|
-
const arg = argv[index];
|
|
586
|
-
if (!arg) {
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
if (arg === "--") {
|
|
590
|
-
positionals.push(...argv.slice(index + 1));
|
|
591
|
-
break;
|
|
592
|
-
}
|
|
593
|
-
if (arg.length === 2 && arg.startsWith("-")) {
|
|
594
|
-
const shortFlag = options.parser.shortFlagMap.get(arg.slice(1));
|
|
595
|
-
if (!shortFlag) {
|
|
596
|
-
throw createUnknownOptionError(arg);
|
|
597
|
-
}
|
|
598
|
-
if (shortFlag.type === "boolean") {
|
|
599
|
-
flags[shortFlag.name] = true;
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
const next = argv[index + 1];
|
|
603
|
-
if (!next || next.startsWith("-")) {
|
|
604
|
-
throw createMissingOptionValueError(arg);
|
|
605
|
-
}
|
|
606
|
-
assignParsedOptionValue(flags, {
|
|
607
|
-
name: shortFlag.name,
|
|
608
|
-
parser: options.parser,
|
|
609
|
-
value: next
|
|
610
|
-
});
|
|
611
|
-
index += 1;
|
|
612
|
-
continue;
|
|
613
|
-
}
|
|
614
|
-
if (arg.startsWith("--")) {
|
|
615
|
-
const option = arg.slice(2);
|
|
616
|
-
const separatorIndex = option.indexOf("=");
|
|
617
|
-
const rawName = separatorIndex === -1 ? option : option.slice(0, separatorIndex);
|
|
618
|
-
const inlineValue = separatorIndex === -1 ? undefined : option.slice(separatorIndex + 1);
|
|
619
|
-
if (booleanOptionNames.has(rawName)) {
|
|
620
|
-
flags[rawName] = true;
|
|
621
|
-
continue;
|
|
622
|
-
}
|
|
623
|
-
if (!options.parser.stringOptionNames.has(rawName)) {
|
|
624
|
-
throw createUnknownOptionError(`--${rawName}`);
|
|
625
|
-
}
|
|
626
|
-
if (inlineValue !== undefined) {
|
|
627
|
-
if (!inlineValue) {
|
|
628
|
-
throw createMissingOptionValueError(`--${rawName}`);
|
|
629
|
-
}
|
|
630
|
-
assignParsedOptionValue(flags, {
|
|
631
|
-
name: rawName,
|
|
632
|
-
parser: options.parser,
|
|
633
|
-
value: inlineValue
|
|
634
|
-
});
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
const next = argv[index + 1];
|
|
638
|
-
if (!next || next.startsWith("-")) {
|
|
639
|
-
throw createMissingOptionValueError(`--${rawName}`);
|
|
640
|
-
}
|
|
641
|
-
assignParsedOptionValue(flags, {
|
|
642
|
-
name: rawName,
|
|
643
|
-
parser: options.parser,
|
|
644
|
-
value: next
|
|
645
|
-
});
|
|
646
|
-
index += 1;
|
|
647
|
-
continue;
|
|
648
|
-
}
|
|
649
|
-
if (arg.startsWith("-")) {
|
|
650
|
-
throw createUnknownOptionError(arg);
|
|
651
|
-
}
|
|
652
|
-
positionals.push(arg);
|
|
653
|
-
}
|
|
598
|
+
const { argv: positionals, flags } = walkArgvOptions(argv, {
|
|
599
|
+
extraBooleanOptionNames: options.extraBooleanOptionNames,
|
|
600
|
+
parser: options.parser,
|
|
601
|
+
strict: true
|
|
602
|
+
});
|
|
654
603
|
return {
|
|
655
604
|
flags,
|
|
656
605
|
positionals
|
|
@@ -1003,8 +952,8 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
1003
952
|
|
|
1004
953
|
// src/runtime-bridge-add.ts
|
|
1005
954
|
import {
|
|
1006
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1007
|
-
createCliDiagnosticCodeError as
|
|
955
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES10,
|
|
956
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError9
|
|
1008
957
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1009
958
|
|
|
1010
959
|
// src/add-kind-ids.ts
|
|
@@ -1035,6 +984,15 @@ var NAME_ONLY_VISIBLE_FIELDS = [
|
|
|
1035
984
|
"kind",
|
|
1036
985
|
"name"
|
|
1037
986
|
];
|
|
987
|
+
var PATTERN_CATALOG_VISIBLE_FIELDS = [
|
|
988
|
+
"kind",
|
|
989
|
+
"name",
|
|
990
|
+
"scope",
|
|
991
|
+
"section-role",
|
|
992
|
+
"catalog-title",
|
|
993
|
+
"tags",
|
|
994
|
+
"thumbnail-url"
|
|
995
|
+
];
|
|
1038
996
|
var NAME_SOURCE_VISIBLE_FIELDS = [
|
|
1039
997
|
"kind",
|
|
1040
998
|
"name",
|
|
@@ -1511,6 +1469,15 @@ import {
|
|
|
1511
1469
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1512
1470
|
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>.";
|
|
1513
1471
|
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>.";
|
|
1472
|
+
var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
|
|
1473
|
+
function formatCoreVariationMissingPositionalNameMessage(blockName) {
|
|
1474
|
+
return [
|
|
1475
|
+
`\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
|
|
1476
|
+
"Usage: wp-typia add core-variation <block-name> <name>",
|
|
1477
|
+
"Alternative: wp-typia add core-variation <name> --block <namespace/block>"
|
|
1478
|
+
].join(`
|
|
1479
|
+
`);
|
|
1480
|
+
}
|
|
1514
1481
|
function resolveCoreVariationInputs(context) {
|
|
1515
1482
|
const positionalTargetBlockName = context.positionalArgs?.[1];
|
|
1516
1483
|
const positionalVariationName = context.positionalArgs?.[2];
|
|
@@ -1523,16 +1490,17 @@ function resolveCoreVariationInputs(context) {
|
|
|
1523
1490
|
variationName: positionalVariationName
|
|
1524
1491
|
};
|
|
1525
1492
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1493
|
+
const targetBlockFlag = readOptionalStrictStringFlag(context.flags, "block");
|
|
1494
|
+
const missingPositionalNameTarget = context.name !== undefined && positionalTargetBlockName === context.name && CORE_VARIATION_BLOCK_NAME_PATTERN.test(context.name) ? context.name : undefined;
|
|
1495
|
+
if (missingPositionalNameTarget && !targetBlockFlag) {
|
|
1496
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, formatCoreVariationMissingPositionalNameMessage(missingPositionalNameTarget));
|
|
1528
1497
|
}
|
|
1529
1498
|
const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
|
|
1530
|
-
|
|
1531
|
-
if (!targetBlockName) {
|
|
1499
|
+
if (!targetBlockFlag) {
|
|
1532
1500
|
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
|
|
1533
1501
|
}
|
|
1534
1502
|
return {
|
|
1535
|
-
targetBlockName,
|
|
1503
|
+
targetBlockName: targetBlockFlag,
|
|
1536
1504
|
variationName
|
|
1537
1505
|
};
|
|
1538
1506
|
}
|
|
@@ -1711,10 +1679,15 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1711
1679
|
supportsDryRun: true,
|
|
1712
1680
|
usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
|
|
1713
1681
|
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
|
|
1714
|
-
hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
|
|
1682
|
+
hiddenBooleanSubmitFields: ["wp-env", "release-zip"],
|
|
1683
|
+
hiddenStringSubmitFields: ["service"]
|
|
1715
1684
|
});
|
|
1716
1685
|
|
|
1717
1686
|
// src/add-kinds/pattern.ts
|
|
1687
|
+
import {
|
|
1688
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
1689
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError6
|
|
1690
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1718
1691
|
var PATTERN_MISSING_NAME_MESSAGE = "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>.";
|
|
1719
1692
|
var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
1720
1693
|
completion: {
|
|
@@ -1730,19 +1703,12 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1730
1703
|
title: "Added workspace pattern"
|
|
1731
1704
|
},
|
|
1732
1705
|
description: "Add a PHP block pattern shell",
|
|
1733
|
-
hiddenStringSubmitFields: [
|
|
1734
|
-
"catalog-title",
|
|
1735
|
-
"scope",
|
|
1736
|
-
"section-role",
|
|
1737
|
-
"tag",
|
|
1738
|
-
"tags",
|
|
1739
|
-
"thumbnail-url"
|
|
1740
|
-
],
|
|
1706
|
+
hiddenStringSubmitFields: ["tag"],
|
|
1741
1707
|
nameLabel: "Pattern name",
|
|
1742
1708
|
async prepareExecution(context) {
|
|
1743
1709
|
const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
|
|
1744
|
-
const scope =
|
|
1745
|
-
const sectionRole =
|
|
1710
|
+
const scope = resolvePatternScopeFlag(context);
|
|
1711
|
+
const sectionRole = resolvePatternSectionRoleFlag(context, scope);
|
|
1746
1712
|
const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
|
|
1747
1713
|
const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
|
|
1748
1714
|
const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
|
|
@@ -1767,9 +1733,42 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1767
1733
|
},
|
|
1768
1734
|
sortOrder: 60,
|
|
1769
1735
|
supportsDryRun: true,
|
|
1770
|
-
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag
|
|
1771
|
-
visibleFieldNames: () =>
|
|
1736
|
+
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
|
|
1737
|
+
visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
|
|
1772
1738
|
});
|
|
1739
|
+
function createInvalidPatternArgumentError(message) {
|
|
1740
|
+
return createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, message);
|
|
1741
|
+
}
|
|
1742
|
+
function createMissingPatternArgumentError(message) {
|
|
1743
|
+
return createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, message);
|
|
1744
|
+
}
|
|
1745
|
+
function resolvePatternScopeFlag(context) {
|
|
1746
|
+
const scope = readOptionalLooseStringFlag(context.flags, "scope");
|
|
1747
|
+
if (!scope) {
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
if (context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.includes(scope)) {
|
|
1751
|
+
return scope;
|
|
1752
|
+
}
|
|
1753
|
+
throw createInvalidPatternArgumentError(`\`--scope\` must be one of: ${context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.join(", ")}. Usage: wp-typia add pattern <name> --scope <full|section>.`);
|
|
1754
|
+
}
|
|
1755
|
+
function resolvePatternSectionRoleFlag(context, scope) {
|
|
1756
|
+
const sectionRole = readOptionalLooseStringFlag(context.flags, "section-role");
|
|
1757
|
+
if (scope === "section" && sectionRole === undefined) {
|
|
1758
|
+
throw createMissingPatternArgumentError("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
|
|
1759
|
+
}
|
|
1760
|
+
if (scope !== "section" && sectionRole !== undefined) {
|
|
1761
|
+
throw createInvalidPatternArgumentError("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
|
|
1762
|
+
}
|
|
1763
|
+
const normalizedSectionRole = sectionRole === undefined ? undefined : context.addRuntime.normalizeBlockSlug(sectionRole);
|
|
1764
|
+
if (normalizedSectionRole && !context.addRuntime.PATTERN_SECTION_ROLE_PATTERN.test(normalizedSectionRole)) {
|
|
1765
|
+
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`.");
|
|
1766
|
+
}
|
|
1767
|
+
if (sectionRole !== undefined && !normalizedSectionRole) {
|
|
1768
|
+
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`.");
|
|
1769
|
+
}
|
|
1770
|
+
return normalizedSectionRole;
|
|
1771
|
+
}
|
|
1773
1772
|
function collectStringFlagValues(value) {
|
|
1774
1773
|
if (typeof value === "string") {
|
|
1775
1774
|
return [value];
|
|
@@ -1784,13 +1783,7 @@ function normalizePatternTagFlags(tagsFlag, tagFlag) {
|
|
|
1784
1783
|
...collectStringFlagValues(tagsFlag),
|
|
1785
1784
|
...collectStringFlagValues(tagFlag)
|
|
1786
1785
|
];
|
|
1787
|
-
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
if (tags.length === 1) {
|
|
1791
|
-
return tags[0];
|
|
1792
|
-
}
|
|
1793
|
-
return tags;
|
|
1786
|
+
return tags.length > 0 ? tags : undefined;
|
|
1794
1787
|
}
|
|
1795
1788
|
|
|
1796
1789
|
// src/add-kinds/post-meta.ts
|
|
@@ -1856,8 +1849,8 @@ var postMetaAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1856
1849
|
|
|
1857
1850
|
// src/add-kinds/rest-resource.ts
|
|
1858
1851
|
import {
|
|
1859
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1860
|
-
createCliDiagnosticCodeError as
|
|
1852
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
|
|
1853
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError7
|
|
1861
1854
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1862
1855
|
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]";
|
|
1863
1856
|
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]";
|
|
@@ -1880,11 +1873,11 @@ function readOptionalSecretPreserveOnEmptyFlag(flags) {
|
|
|
1880
1873
|
return value;
|
|
1881
1874
|
}
|
|
1882
1875
|
if (typeof value !== "string") {
|
|
1883
|
-
throw
|
|
1876
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1884
1877
|
}
|
|
1885
1878
|
const normalized = value.trim().toLowerCase();
|
|
1886
1879
|
if (normalized.length === 0) {
|
|
1887
|
-
throw
|
|
1880
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`--secret-preserve-on-empty` requires a value.");
|
|
1888
1881
|
}
|
|
1889
1882
|
if (SECRET_PRESERVE_ON_EMPTY_TRUE_VALUES.has(normalized)) {
|
|
1890
1883
|
return true;
|
|
@@ -1892,7 +1885,7 @@ function readOptionalSecretPreserveOnEmptyFlag(flags) {
|
|
|
1892
1885
|
if (SECRET_PRESERVE_ON_EMPTY_FALSE_VALUES.has(normalized)) {
|
|
1893
1886
|
return false;
|
|
1894
1887
|
}
|
|
1895
|
-
throw
|
|
1888
|
+
throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, "Manual REST contract --secret-preserve-on-empty must be true or false.");
|
|
1896
1889
|
}
|
|
1897
1890
|
var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
1898
1891
|
completion: {
|
|
@@ -2546,7 +2539,7 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
2546
2539
|
// package.json
|
|
2547
2540
|
var package_default = {
|
|
2548
2541
|
name: "wp-typia",
|
|
2549
|
-
version: "0.24.
|
|
2542
|
+
version: "0.24.3",
|
|
2550
2543
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
2551
2544
|
packageManager: "bun@1.3.11",
|
|
2552
2545
|
type: "module",
|
|
@@ -2616,7 +2609,7 @@ var package_default = {
|
|
|
2616
2609
|
"@bunli/tui": "0.6.0",
|
|
2617
2610
|
"@bunli/utils": "0.6.0",
|
|
2618
2611
|
"@wp-typia/api-client": "^0.4.5",
|
|
2619
|
-
"@wp-typia/project-tools": "0.24.
|
|
2612
|
+
"@wp-typia/project-tools": "0.24.3",
|
|
2620
2613
|
"better-result": "^2.7.0",
|
|
2621
2614
|
react: "^19.2.5",
|
|
2622
2615
|
"react-dom": "^19.2.5",
|
|
@@ -2645,8 +2638,8 @@ import {
|
|
|
2645
2638
|
parsePackageManagerField
|
|
2646
2639
|
} from "@wp-typia/project-tools/package-managers";
|
|
2647
2640
|
import {
|
|
2648
|
-
CLI_DIAGNOSTIC_CODES as
|
|
2649
|
-
createCliDiagnosticCodeError as
|
|
2641
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES9,
|
|
2642
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError8
|
|
2650
2643
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2651
2644
|
var LOOSE_CREATE_COMPLETION_PACKAGE_MANAGER_PATTERN = new RegExp(`^(?:corepack\\s+)?(${PACKAGE_MANAGER_IDS.map(escapeRegExp).join("|")})(?=$|[@:/+\\s])`, "iu");
|
|
2652
2645
|
function parseCreateCompletionPackageManager(packageManager) {
|
|
@@ -2664,7 +2657,7 @@ function resolveCreateCompletionPackageManager(packageManager) {
|
|
|
2664
2657
|
if (parsedPackageManager) {
|
|
2665
2658
|
return parsedPackageManager;
|
|
2666
2659
|
}
|
|
2667
|
-
throw
|
|
2660
|
+
throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
|
|
2668
2661
|
}
|
|
2669
2662
|
function formatCreateProgressLine(payload, markerOptions) {
|
|
2670
2663
|
return formatOutputMarker("progress", `${payload.title}: ${payload.detail}`, markerOptions);
|
|
@@ -2924,13 +2917,13 @@ async function executeAddCommand({
|
|
|
2924
2917
|
if (shouldPrintMissingAddKindHelp({ emitOutput })) {
|
|
2925
2918
|
printLine(addRuntime.formatAddHelpText());
|
|
2926
2919
|
}
|
|
2927
|
-
throw
|
|
2920
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
|
|
2928
2921
|
}
|
|
2929
2922
|
if (!isAddKindId(kind)) {
|
|
2930
|
-
throw
|
|
2923
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2931
2924
|
}
|
|
2932
2925
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2933
|
-
throw
|
|
2926
|
+
throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2934
2927
|
}
|
|
2935
2928
|
const executionContext = {
|
|
2936
2929
|
addRuntime,
|
|
@@ -3184,8 +3177,8 @@ async function executeMigrateCommand({
|
|
|
3184
3177
|
}
|
|
3185
3178
|
// src/runtime-bridge-templates.ts
|
|
3186
3179
|
import {
|
|
3187
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3188
|
-
createCliDiagnosticCodeError as
|
|
3180
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
|
|
3181
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError10
|
|
3189
3182
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3190
3183
|
var loadCliTemplatesRuntime2 = () => import("@wp-typia/project-tools/cli-templates");
|
|
3191
3184
|
async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
@@ -3205,24 +3198,24 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
3205
3198
|
}
|
|
3206
3199
|
if (subcommand === "inspect") {
|
|
3207
3200
|
if (!flags.id) {
|
|
3208
|
-
throw
|
|
3201
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
3209
3202
|
}
|
|
3210
3203
|
const template = getTemplateById(flags.id);
|
|
3211
3204
|
if (!template) {
|
|
3212
|
-
throw
|
|
3205
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
3213
3206
|
}
|
|
3214
3207
|
printBlock(printLine, [formatTemplateDetails(template)]);
|
|
3215
3208
|
return;
|
|
3216
3209
|
}
|
|
3217
|
-
throw
|
|
3210
|
+
throw createCliDiagnosticCodeError10(CLI_DIAGNOSTIC_CODES11.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
3218
3211
|
}
|
|
3219
3212
|
// src/runtime-bridge-sync.ts
|
|
3220
3213
|
import { spawnSync } from "node:child_process";
|
|
3221
3214
|
import fs3 from "node:fs";
|
|
3222
3215
|
import path4 from "node:path";
|
|
3223
3216
|
import {
|
|
3224
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3225
|
-
createCliDiagnosticCodeError as
|
|
3217
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
|
|
3218
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError11
|
|
3226
3219
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3227
3220
|
import {
|
|
3228
3221
|
formatInstallCommand,
|
|
@@ -3243,10 +3236,10 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
3243
3236
|
if (subcommand === "ai") {
|
|
3244
3237
|
return "ai";
|
|
3245
3238
|
}
|
|
3246
|
-
throw
|
|
3239
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
3247
3240
|
}
|
|
3248
3241
|
function getSyncRootError(cwd) {
|
|
3249
|
-
return
|
|
3242
|
+
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.`);
|
|
3250
3243
|
}
|
|
3251
3244
|
function readSyncPackageJson(packageJsonPath) {
|
|
3252
3245
|
const source = fs3.readFileSync(packageJsonPath, "utf8");
|
|
@@ -3254,7 +3247,7 @@ function readSyncPackageJson(packageJsonPath) {
|
|
|
3254
3247
|
return JSON.parse(source);
|
|
3255
3248
|
} catch (error) {
|
|
3256
3249
|
const message = error instanceof Error ? error.message : String(error);
|
|
3257
|
-
throw
|
|
3250
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT, `Unable to parse ${packageJsonPath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
3258
3251
|
}
|
|
3259
3252
|
}
|
|
3260
3253
|
function resolveSyncProjectContext(cwd) {
|
|
@@ -3321,7 +3314,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
3321
3314
|
if (markerDir) {
|
|
3322
3315
|
return;
|
|
3323
3316
|
}
|
|
3324
|
-
throw
|
|
3317
|
+
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\`.`);
|
|
3325
3318
|
}
|
|
3326
3319
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
3327
3320
|
switch (packageManager) {
|
|
@@ -3359,7 +3352,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3359
3352
|
if (target === "ai") {
|
|
3360
3353
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
3361
3354
|
if (!syncAiCommand2) {
|
|
3362
|
-
throw
|
|
3355
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
3363
3356
|
}
|
|
3364
3357
|
return [syncAiCommand2];
|
|
3365
3358
|
}
|
|
@@ -3368,7 +3361,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
3368
3361
|
}
|
|
3369
3362
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
3370
3363
|
if (!syncTypesCommand) {
|
|
3371
|
-
throw
|
|
3364
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
3372
3365
|
}
|
|
3373
3366
|
const plannedCommands = [syncTypesCommand];
|
|
3374
3367
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -3392,7 +3385,7 @@ function runProjectScript(project, plannedCommand, options) {
|
|
|
3392
3385
|
const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
|
|
3393
3386
|
const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
|
|
3394
3387
|
if (result.error || result.status !== 0) {
|
|
3395
|
-
throw
|
|
3388
|
+
throw createCliDiagnosticCodeError11(CLI_DIAGNOSTIC_CODES12.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
|
|
3396
3389
|
cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
|
|
3397
3390
|
});
|
|
3398
3391
|
}
|
|
@@ -3434,8 +3427,8 @@ async function executeSyncCommand({
|
|
|
3434
3427
|
// src/command-contract.ts
|
|
3435
3428
|
import path5 from "node:path";
|
|
3436
3429
|
import {
|
|
3437
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3438
|
-
createCliDiagnosticCodeError as
|
|
3430
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
|
|
3431
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError12
|
|
3439
3432
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3440
3433
|
|
|
3441
3434
|
// src/command-registry.ts
|
|
@@ -3706,10 +3699,10 @@ function looksLikeStructuredProjectInput(value) {
|
|
|
3706
3699
|
function assertPositionalAliasProjectDir(projectDir) {
|
|
3707
3700
|
const normalizedProjectDir = path5.normalize(projectDir).replace(/[\\/]+$/u, "") || path5.normalize(projectDir);
|
|
3708
3701
|
if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
|
|
3709
|
-
throw
|
|
3702
|
+
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.`);
|
|
3710
3703
|
}
|
|
3711
3704
|
if (looksLikeStructuredProjectInput(projectDir)) {
|
|
3712
|
-
throw
|
|
3705
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT, `The positional alias only accepts unambiguous local project directories. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for \`${projectDir}\`.`);
|
|
3713
3706
|
}
|
|
3714
3707
|
}
|
|
3715
3708
|
function normalizeWpTypiaArgv(argv) {
|
|
@@ -3723,7 +3716,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3723
3716
|
return argv;
|
|
3724
3717
|
}
|
|
3725
3718
|
if (firstPositional === "migrations") {
|
|
3726
|
-
throw
|
|
3719
|
+
throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT, "`wp-typia migrations` was removed in favor of `wp-typia migrate`. Use `wp-typia migrate <subcommand>` instead.");
|
|
3727
3720
|
}
|
|
3728
3721
|
if (isReservedTopLevelCommandName(firstPositional)) {
|
|
3729
3722
|
assertStringOptionValues(argv);
|
|
@@ -3731,7 +3724,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3731
3724
|
}
|
|
3732
3725
|
if (positionalIndexes.length > 1) {
|
|
3733
3726
|
const extraPositionals = positionalIndexes.slice(1).map((index) => argv[index]).filter((value) => typeof value === "string" && value.length > 0);
|
|
3734
|
-
throw
|
|
3727
|
+
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(", ")}.`);
|
|
3735
3728
|
}
|
|
3736
3729
|
assertPositionalAliasProjectDir(firstPositional);
|
|
3737
3730
|
const normalizedArgv = [
|
|
@@ -3745,7 +3738,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3745
3738
|
|
|
3746
3739
|
// src/node-fallback/doctor.ts
|
|
3747
3740
|
import {
|
|
3748
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3741
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES14,
|
|
3749
3742
|
createCliCommandError as createCliCommandError2
|
|
3750
3743
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3751
3744
|
async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
@@ -3762,7 +3755,7 @@ async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
|
3762
3755
|
}, null, 2));
|
|
3763
3756
|
if (summary.exitCode === 1) {
|
|
3764
3757
|
throw createCliCommandError2({
|
|
3765
|
-
code:
|
|
3758
|
+
code: CLI_DIAGNOSTIC_CODES14.DOCTOR_CHECK_FAILED,
|
|
3766
3759
|
command: "doctor",
|
|
3767
3760
|
detailLines: getDoctorExitFailureDetailLines(checks, { exitPolicy }),
|
|
3768
3761
|
summary: "One or more doctor checks failed."
|
|
@@ -3784,7 +3777,7 @@ async function dispatchNodeFallbackDoctor({
|
|
|
3784
3777
|
|
|
3785
3778
|
// src/node-fallback/dispatchers/add.ts
|
|
3786
3779
|
import {
|
|
3787
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3780
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES15,
|
|
3788
3781
|
createCliCommandError as createCliCommandError3
|
|
3789
3782
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3790
3783
|
function resolveNodeFallbackAddName(positionals) {
|
|
@@ -3806,7 +3799,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3806
3799
|
printLine(formatAddHelpText());
|
|
3807
3800
|
}
|
|
3808
3801
|
throw createCliCommandError3({
|
|
3809
|
-
code:
|
|
3802
|
+
code: CLI_DIAGNOSTIC_CODES15.MISSING_ARGUMENT,
|
|
3810
3803
|
command: "add",
|
|
3811
3804
|
detailLines: buildMissingAddKindDetailLines()
|
|
3812
3805
|
});
|
|
@@ -3856,7 +3849,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3856
3849
|
|
|
3857
3850
|
// src/node-fallback/dispatchers/create.ts
|
|
3858
3851
|
import {
|
|
3859
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3852
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES16,
|
|
3860
3853
|
createCliCommandError as createCliCommandError4
|
|
3861
3854
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3862
3855
|
async function dispatchNodeFallbackCreate({
|
|
@@ -3869,7 +3862,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3869
3862
|
const projectDir = positionals[1];
|
|
3870
3863
|
if (!projectDir) {
|
|
3871
3864
|
throw createCliCommandError4({
|
|
3872
|
-
code:
|
|
3865
|
+
code: CLI_DIAGNOSTIC_CODES16.MISSING_ARGUMENT,
|
|
3873
3866
|
command: "create",
|
|
3874
3867
|
detailLines: buildMissingCreateProjectDirDetailLines()
|
|
3875
3868
|
});
|
|
@@ -3902,7 +3895,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3902
3895
|
|
|
3903
3896
|
// src/node-fallback/errors.ts
|
|
3904
3897
|
import {
|
|
3905
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3898
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES17,
|
|
3906
3899
|
createCliCommandError as createCliCommandError6,
|
|
3907
3900
|
formatCliDiagnosticError,
|
|
3908
3901
|
isCliDiagnosticError,
|
|
@@ -4020,18 +4013,18 @@ var NODE_FALLBACK_HELP_RENDERERS = Object.fromEntries(Object.entries(NODE_FALLBA
|
|
|
4020
4013
|
// src/node-fallback/errors.ts
|
|
4021
4014
|
function createNodeFallbackNoCommandCliError() {
|
|
4022
4015
|
return createCliCommandError6({
|
|
4023
|
-
code:
|
|
4016
|
+
code: CLI_DIAGNOSTIC_CODES17.INVALID_COMMAND,
|
|
4024
4017
|
command: "wp-typia",
|
|
4025
4018
|
detailLines: [NODE_FALLBACK_NO_COMMAND_REASON_LINE],
|
|
4026
4019
|
summary: "No command was provided."
|
|
4027
4020
|
});
|
|
4028
4021
|
}
|
|
4029
4022
|
function isNodeFallbackNoCommandCliDiagnostic(error) {
|
|
4030
|
-
return isCliDiagnosticError(error) && error.code ===
|
|
4023
|
+
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES17.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(NODE_FALLBACK_NO_COMMAND_REASON_LINE);
|
|
4031
4024
|
}
|
|
4032
4025
|
function throwUnsupportedNodeFallbackCommand(command) {
|
|
4033
4026
|
throw createCliCommandError6({
|
|
4034
|
-
code:
|
|
4027
|
+
code: CLI_DIAGNOSTIC_CODES17.UNSUPPORTED_COMMAND,
|
|
4035
4028
|
command,
|
|
4036
4029
|
detailLines: [
|
|
4037
4030
|
[
|
|
@@ -4067,7 +4060,7 @@ async function handleNodeFallbackEntrypointError(error, argv) {
|
|
|
4067
4060
|
|
|
4068
4061
|
// src/node-fallback/templates.ts
|
|
4069
4062
|
import {
|
|
4070
|
-
CLI_DIAGNOSTIC_CODES as
|
|
4063
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES18,
|
|
4071
4064
|
createCliCommandError as createCliCommandError7
|
|
4072
4065
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
4073
4066
|
import {
|
|
@@ -4084,7 +4077,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
4084
4077
|
const templateId = flags.id;
|
|
4085
4078
|
if (!templateId) {
|
|
4086
4079
|
throw createCliCommandError7({
|
|
4087
|
-
code:
|
|
4080
|
+
code: CLI_DIAGNOSTIC_CODES18.MISSING_ARGUMENT,
|
|
4088
4081
|
command: "templates",
|
|
4089
4082
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
4090
4083
|
});
|
|
@@ -4092,7 +4085,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
4092
4085
|
const template = getTemplateById(templateId);
|
|
4093
4086
|
if (!template) {
|
|
4094
4087
|
throw createCliCommandError7({
|
|
4095
|
-
code:
|
|
4088
|
+
code: CLI_DIAGNOSTIC_CODES18.INVALID_ARGUMENT,
|
|
4096
4089
|
command: "templates",
|
|
4097
4090
|
detailLines: [`Unknown template "${templateId}".`]
|
|
4098
4091
|
});
|
|
@@ -4111,7 +4104,7 @@ async function dispatchNodeFallbackTemplates({
|
|
|
4111
4104
|
const resolvedSubcommand = subcommand ?? (templateId ? "inspect" : "list");
|
|
4112
4105
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
4113
4106
|
throw createCliCommandError7({
|
|
4114
|
-
code:
|
|
4107
|
+
code: CLI_DIAGNOSTIC_CODES18.INVALID_COMMAND,
|
|
4115
4108
|
command: "templates",
|
|
4116
4109
|
detailLines: [
|
|
4117
4110
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -4369,4 +4362,4 @@ export {
|
|
|
4369
4362
|
hasFlagBeforeTerminator
|
|
4370
4363
|
};
|
|
4371
4364
|
|
|
4372
|
-
//# debugId=
|
|
4365
|
+
//# debugId=5AEE5FBC0C6CEA8264756E2164756E21
|