wp-typia 0.22.5 → 0.22.7
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 +7 -0
- package/bin/wp-typia.js +83 -0
- package/dist-bunli/.bunli/commands.gen.js +2000 -1256
- package/dist-bunli/{cli-xbzfx7qz.js → cli-27v2qpjg.js} +4 -4
- package/dist-bunli/{cli-1sm60g1z.js → cli-2hsp17nd.js} +2 -2
- package/dist-bunli/{cli-hb9vpsev.js → cli-2rqf6t0b.js} +1 -1
- package/dist-bunli/{cli-6bhfzq5e.js → cli-52ke0ptp.js} +2 -2
- package/dist-bunli/{cli-ctddkm3n.js → cli-8snabymq.js} +405 -204
- package/dist-bunli/{cli-add-1gqgshf0.js → cli-add-8jpdnz1r.js} +85 -64
- package/dist-bunli/{cli-nzwpmw4y.js → cli-cjygr56g.js} +98 -32
- package/dist-bunli/{cli-doctor-w35s8y9w.js → cli-doctor-h5tq4ztr.js} +15 -18
- package/dist-bunli/cli-fys8vm2t.js +20 -0
- package/dist-bunli/{cli-btbpt84c.js → cli-hhp1d348.js} +1 -1
- package/dist-bunli/{cli-init-z8sjmkvc.js → cli-init-w9p558th.js} +414 -393
- package/dist-bunli/{cli-scaffold-ad3bd555.js → cli-scaffold-qve8rqja.js} +9 -8
- package/dist-bunli/{cli-j30rk466.js → cli-ta3y0hp2.js} +697 -298
- package/dist-bunli/cli.js +8 -6
- package/dist-bunli/{command-list-scd6zqp8.js → command-list-6zr1tj96.js} +16 -12
- package/dist-bunli/{migrations-skkzdvhm.js → migrations-v0avgyg6.js} +7 -6
- package/dist-bunli/node-cli.js +253 -97
- package/dist-bunli/{workspace-project-7826tewa.js → workspace-project-csnnggz6.js} +2 -2
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -3,7 +3,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "wp-typia",
|
|
6
|
-
version: "0.22.
|
|
6
|
+
version: "0.22.7",
|
|
7
7
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
8
8
|
packageManager: "bun@1.3.11",
|
|
9
9
|
type: "module",
|
|
@@ -73,7 +73,7 @@ var package_default = {
|
|
|
73
73
|
"@bunli/tui": "0.6.0",
|
|
74
74
|
"@bunli/utils": "0.6.0",
|
|
75
75
|
"@wp-typia/api-client": "^0.4.5",
|
|
76
|
-
"@wp-typia/project-tools": "0.22.
|
|
76
|
+
"@wp-typia/project-tools": "0.22.7",
|
|
77
77
|
"better-result": "^2.7.0",
|
|
78
78
|
react: "^19.2.5",
|
|
79
79
|
"react-dom": "^19.2.5",
|
|
@@ -97,15 +97,18 @@ var package_default = {
|
|
|
97
97
|
|
|
98
98
|
// src/node-cli.ts
|
|
99
99
|
import {
|
|
100
|
-
CLI_DIAGNOSTIC_CODES as
|
|
100
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
|
|
101
101
|
createCliCommandError as createCliCommandError3,
|
|
102
|
-
createCliDiagnosticCodeError as createCliDiagnosticCodeError6,
|
|
103
102
|
formatCliDiagnosticError,
|
|
104
103
|
serializeCliDiagnosticError as serializeCliDiagnosticError2
|
|
105
104
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
106
105
|
|
|
107
106
|
// src/command-option-metadata.ts
|
|
108
107
|
import { z } from "zod";
|
|
108
|
+
import {
|
|
109
|
+
CLI_DIAGNOSTIC_CODES,
|
|
110
|
+
createCliDiagnosticCodeError
|
|
111
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
109
112
|
var CREATE_OPTION_METADATA = {
|
|
110
113
|
"alternate-render-targets": {
|
|
111
114
|
description: "Comma-separated alternate render targets for dynamic block scaffolds (email,mjml,plain-text).",
|
|
@@ -419,6 +422,12 @@ function buildArgvWalkerRoutingMetadata(...metadataMaps) {
|
|
|
419
422
|
};
|
|
420
423
|
}
|
|
421
424
|
var COMMAND_ROUTING_METADATA = buildArgvWalkerRoutingMetadata(ALL_COMMAND_OPTION_METADATA);
|
|
425
|
+
function createMissingOptionValueError(optionLabel) {
|
|
426
|
+
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`${optionLabel}\` requires a value.`);
|
|
427
|
+
}
|
|
428
|
+
function createUnknownOptionError(optionLabel) {
|
|
429
|
+
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unknown option \`${optionLabel}\`.`);
|
|
430
|
+
}
|
|
422
431
|
function extractKnownOptionValuesFromArgv(argv, options) {
|
|
423
432
|
const flags = {};
|
|
424
433
|
const nextArgv = [];
|
|
@@ -444,7 +453,7 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
444
453
|
}
|
|
445
454
|
const next = argv[index + 1];
|
|
446
455
|
if (!next || next.startsWith("-")) {
|
|
447
|
-
throw
|
|
456
|
+
throw createMissingOptionValueError(arg);
|
|
448
457
|
}
|
|
449
458
|
flags[shortFlag.name] = next;
|
|
450
459
|
index += 1;
|
|
@@ -469,14 +478,14 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
469
478
|
}
|
|
470
479
|
if (inlineValue !== undefined) {
|
|
471
480
|
if (!inlineValue) {
|
|
472
|
-
throw
|
|
481
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
473
482
|
}
|
|
474
483
|
flags[rawName] = inlineValue;
|
|
475
484
|
continue;
|
|
476
485
|
}
|
|
477
486
|
const next = argv[index + 1];
|
|
478
487
|
if (!next || next.startsWith("-")) {
|
|
479
|
-
throw
|
|
488
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
480
489
|
}
|
|
481
490
|
flags[rawName] = next;
|
|
482
491
|
index += 1;
|
|
@@ -508,7 +517,7 @@ function parseCommandArgvWithMetadata(argv, options) {
|
|
|
508
517
|
if (arg.length === 2 && arg.startsWith("-")) {
|
|
509
518
|
const shortFlag = options.parser.shortFlagMap.get(arg.slice(1));
|
|
510
519
|
if (!shortFlag) {
|
|
511
|
-
throw
|
|
520
|
+
throw createUnknownOptionError(arg);
|
|
512
521
|
}
|
|
513
522
|
if (shortFlag.type === "boolean") {
|
|
514
523
|
flags[shortFlag.name] = true;
|
|
@@ -516,7 +525,7 @@ function parseCommandArgvWithMetadata(argv, options) {
|
|
|
516
525
|
}
|
|
517
526
|
const next = argv[index + 1];
|
|
518
527
|
if (!next || next.startsWith("-")) {
|
|
519
|
-
throw
|
|
528
|
+
throw createMissingOptionValueError(arg);
|
|
520
529
|
}
|
|
521
530
|
flags[shortFlag.name] = next;
|
|
522
531
|
index += 1;
|
|
@@ -532,25 +541,25 @@ function parseCommandArgvWithMetadata(argv, options) {
|
|
|
532
541
|
continue;
|
|
533
542
|
}
|
|
534
543
|
if (!options.parser.stringOptionNames.has(rawName)) {
|
|
535
|
-
throw
|
|
544
|
+
throw createUnknownOptionError(`--${rawName}`);
|
|
536
545
|
}
|
|
537
546
|
if (inlineValue !== undefined) {
|
|
538
547
|
if (!inlineValue) {
|
|
539
|
-
throw
|
|
548
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
540
549
|
}
|
|
541
550
|
flags[rawName] = inlineValue;
|
|
542
551
|
continue;
|
|
543
552
|
}
|
|
544
553
|
const next = argv[index + 1];
|
|
545
554
|
if (!next || next.startsWith("-")) {
|
|
546
|
-
throw
|
|
555
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
547
556
|
}
|
|
548
557
|
flags[rawName] = next;
|
|
549
558
|
index += 1;
|
|
550
559
|
continue;
|
|
551
560
|
}
|
|
552
561
|
if (arg.startsWith("-")) {
|
|
553
|
-
throw
|
|
562
|
+
throw createUnknownOptionError(arg);
|
|
554
563
|
}
|
|
555
564
|
positionals.push(arg);
|
|
556
565
|
}
|
|
@@ -636,7 +645,7 @@ function resolveEntrypointCliCommand(argv) {
|
|
|
636
645
|
|
|
637
646
|
// src/cli-output-format.ts
|
|
638
647
|
import {
|
|
639
|
-
CLI_DIAGNOSTIC_CODES,
|
|
648
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
|
|
640
649
|
createCliCommandError
|
|
641
650
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
642
651
|
var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
|
|
@@ -652,6 +661,34 @@ function formatSupportedCliOutputFormats() {
|
|
|
652
661
|
function isSupportedCliOutputFormat(value) {
|
|
653
662
|
return typeof value === "string" && SUPPORTED_CLI_OUTPUT_FORMAT_VALUES.includes(value);
|
|
654
663
|
}
|
|
664
|
+
function normalizeCliOutputFormatArgv(argv) {
|
|
665
|
+
let normalized;
|
|
666
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
667
|
+
const arg = argv[index];
|
|
668
|
+
if (!arg) {
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (arg === "--") {
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
if (arg === "--format") {
|
|
675
|
+
const next = argv[index + 1];
|
|
676
|
+
if (next === "text") {
|
|
677
|
+
normalized ??= [...argv];
|
|
678
|
+
normalized[index + 1] = "toon";
|
|
679
|
+
}
|
|
680
|
+
if (next && !next.startsWith("-")) {
|
|
681
|
+
index += 1;
|
|
682
|
+
}
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (arg === "--format=text") {
|
|
686
|
+
normalized ??= [...argv];
|
|
687
|
+
normalized[index] = "--format=toon";
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
return normalized ?? argv;
|
|
691
|
+
}
|
|
655
692
|
function formatInvalidCliOutputFormatMessage(value) {
|
|
656
693
|
return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
|
|
657
694
|
}
|
|
@@ -660,7 +697,7 @@ function assertSupportedCliOutputFormat(value, argv) {
|
|
|
660
697
|
return;
|
|
661
698
|
}
|
|
662
699
|
throw createCliCommandError({
|
|
663
|
-
code:
|
|
700
|
+
code: CLI_DIAGNOSTIC_CODES2.INVALID_ARGUMENT,
|
|
664
701
|
command: resolveEntrypointCliCommand(argv),
|
|
665
702
|
detailLines: [formatInvalidCliOutputFormatMessage(value)]
|
|
666
703
|
});
|
|
@@ -719,30 +756,17 @@ import {
|
|
|
719
756
|
|
|
720
757
|
// src/add-kind-registry.ts
|
|
721
758
|
import {
|
|
722
|
-
CLI_DIAGNOSTIC_CODES as
|
|
723
|
-
createCliDiagnosticCodeError as
|
|
759
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
|
|
760
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError3
|
|
724
761
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
725
762
|
|
|
726
763
|
// src/add-kind-ids.ts
|
|
727
|
-
|
|
728
|
-
"admin-view",
|
|
729
|
-
"block",
|
|
730
|
-
"variation",
|
|
731
|
-
"style",
|
|
732
|
-
"transform",
|
|
733
|
-
"pattern",
|
|
734
|
-
"binding-source",
|
|
735
|
-
"rest-resource",
|
|
736
|
-
"ability",
|
|
737
|
-
"ai-feature",
|
|
738
|
-
"hooked-block",
|
|
739
|
-
"editor-plugin"
|
|
740
|
-
];
|
|
764
|
+
import { ADD_KIND_IDS } from "@wp-typia/project-tools/cli-add-kind-ids";
|
|
741
765
|
|
|
742
766
|
// src/cli-string-flags.ts
|
|
743
767
|
import {
|
|
744
|
-
CLI_DIAGNOSTIC_CODES as
|
|
745
|
-
createCliDiagnosticCodeError
|
|
768
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
|
|
769
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError2
|
|
746
770
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
747
771
|
function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
748
772
|
const value = flags[name];
|
|
@@ -750,12 +774,12 @@ function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
|
750
774
|
return;
|
|
751
775
|
}
|
|
752
776
|
if (typeof value !== "string") {
|
|
753
|
-
throw
|
|
777
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
754
778
|
}
|
|
755
779
|
const trimmed = value.trim();
|
|
756
780
|
if (trimmed.length === 0) {
|
|
757
781
|
if (mode === "strict") {
|
|
758
|
-
throw
|
|
782
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
759
783
|
}
|
|
760
784
|
return;
|
|
761
785
|
}
|
|
@@ -770,7 +794,7 @@ function readOptionalStrictStringFlag(flags, name) {
|
|
|
770
794
|
function requireStrictStringFlag(flags, name, message) {
|
|
771
795
|
const value = readOptionalStrictStringFlag(flags, name);
|
|
772
796
|
if (!value) {
|
|
773
|
-
throw
|
|
797
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, message);
|
|
774
798
|
}
|
|
775
799
|
return value;
|
|
776
800
|
}
|
|
@@ -778,7 +802,7 @@ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message
|
|
|
778
802
|
const leftValue = readOptionalStrictStringFlag(flags, leftName);
|
|
779
803
|
const rightValue = readOptionalStrictStringFlag(flags, rightName);
|
|
780
804
|
if (Boolean(leftValue) !== Boolean(rightValue)) {
|
|
781
|
-
throw
|
|
805
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, message);
|
|
782
806
|
}
|
|
783
807
|
return [leftValue, rightValue];
|
|
784
808
|
}
|
|
@@ -859,7 +883,7 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
|
|
|
859
883
|
];
|
|
860
884
|
function requireAddKindName(context, message) {
|
|
861
885
|
if (!context.name) {
|
|
862
|
-
throw
|
|
886
|
+
throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, message);
|
|
863
887
|
}
|
|
864
888
|
return context.name;
|
|
865
889
|
}
|
|
@@ -886,9 +910,9 @@ function assertAddBlockTemplateId(context, templateId) {
|
|
|
886
910
|
return templateId;
|
|
887
911
|
}
|
|
888
912
|
if (templateId === "query-loop") {
|
|
889
|
-
throw
|
|
913
|
+
throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
|
|
890
914
|
}
|
|
891
|
-
throw
|
|
915
|
+
throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
|
|
892
916
|
}
|
|
893
917
|
var ADD_KIND_REGISTRY = {
|
|
894
918
|
"admin-view": defineAddKindRegistryEntry({
|
|
@@ -1069,7 +1093,9 @@ var ADD_KIND_REGISTRY = {
|
|
|
1069
1093
|
getValues: (result) => ({
|
|
1070
1094
|
abilitySlug: result.abilitySlug
|
|
1071
1095
|
}),
|
|
1072
|
-
|
|
1096
|
+
getWarnings: (result) => result.warnings,
|
|
1097
|
+
missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.",
|
|
1098
|
+
warnLine: context.warnLine
|
|
1073
1099
|
});
|
|
1074
1100
|
},
|
|
1075
1101
|
sortOrder: 90,
|
|
@@ -1413,14 +1439,87 @@ import os from "node:os";
|
|
|
1413
1439
|
import path from "node:path";
|
|
1414
1440
|
import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
|
|
1415
1441
|
import {
|
|
1416
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1417
|
-
createCliDiagnosticCodeError as
|
|
1442
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
|
|
1443
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError4
|
|
1418
1444
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1445
|
+
import { z as z2 } from "zod";
|
|
1419
1446
|
var WP_TYPIA_CONFIG_SOURCES = [
|
|
1420
1447
|
"~/.config/wp-typia/config.json",
|
|
1421
1448
|
".wp-typiarc",
|
|
1422
1449
|
".wp-typiarc.json"
|
|
1423
1450
|
];
|
|
1451
|
+
var wpTypiaSchemaSourceSchema = z2.object({
|
|
1452
|
+
namespace: z2.string(),
|
|
1453
|
+
path: z2.string()
|
|
1454
|
+
}).strict();
|
|
1455
|
+
var createConfigSchema = z2.object({
|
|
1456
|
+
"alternate-render-targets": z2.string().optional(),
|
|
1457
|
+
"inner-blocks-preset": z2.string().optional(),
|
|
1458
|
+
"data-storage": z2.string().optional(),
|
|
1459
|
+
"dry-run": z2.boolean().optional(),
|
|
1460
|
+
"external-layer-id": z2.string().optional(),
|
|
1461
|
+
"external-layer-source": z2.string().optional(),
|
|
1462
|
+
namespace: z2.string().optional(),
|
|
1463
|
+
"no-install": z2.boolean().optional(),
|
|
1464
|
+
"package-manager": z2.string().optional(),
|
|
1465
|
+
"persistence-policy": z2.string().optional(),
|
|
1466
|
+
"php-prefix": z2.string().optional(),
|
|
1467
|
+
"query-post-type": z2.string().optional(),
|
|
1468
|
+
template: z2.string().optional(),
|
|
1469
|
+
"text-domain": z2.string().optional(),
|
|
1470
|
+
variant: z2.string().optional(),
|
|
1471
|
+
"with-migration-ui": z2.boolean().optional(),
|
|
1472
|
+
"with-test-preset": z2.boolean().optional(),
|
|
1473
|
+
"with-wp-env": z2.boolean().optional(),
|
|
1474
|
+
yes: z2.boolean().optional()
|
|
1475
|
+
}).strict();
|
|
1476
|
+
var addBlockConfigSchema = z2.object({
|
|
1477
|
+
"alternate-render-targets": z2.string().optional(),
|
|
1478
|
+
"data-storage": z2.string().optional(),
|
|
1479
|
+
"external-layer-id": z2.string().optional(),
|
|
1480
|
+
"external-layer-source": z2.string().optional(),
|
|
1481
|
+
"inner-blocks-preset": z2.string().optional(),
|
|
1482
|
+
"persistence-policy": z2.string().optional(),
|
|
1483
|
+
template: z2.string().optional()
|
|
1484
|
+
}).strict();
|
|
1485
|
+
var addConfigSchema = z2.object({
|
|
1486
|
+
block: addBlockConfigSchema.optional()
|
|
1487
|
+
}).strict();
|
|
1488
|
+
var mcpConfigSchema = z2.object({
|
|
1489
|
+
schemaSources: z2.array(wpTypiaSchemaSourceSchema).optional()
|
|
1490
|
+
}).strict();
|
|
1491
|
+
var wpTypiaUserConfigSchema = z2.object({
|
|
1492
|
+
add: addConfigSchema.optional(),
|
|
1493
|
+
create: createConfigSchema.optional(),
|
|
1494
|
+
mcp: mcpConfigSchema.optional()
|
|
1495
|
+
}).strict();
|
|
1496
|
+
function formatIssuePath(issuePath) {
|
|
1497
|
+
if (issuePath.length === 0) {
|
|
1498
|
+
return "config";
|
|
1499
|
+
}
|
|
1500
|
+
return issuePath.map((segment) => typeof segment === "number" ? `[${segment}]` : `.${String(segment)}`).join("").replace(/^\./u, "");
|
|
1501
|
+
}
|
|
1502
|
+
function formatConfigValidationIssue(issue) {
|
|
1503
|
+
const pathLabel = formatIssuePath(issue.path);
|
|
1504
|
+
if (issue.code === "unrecognized_keys") {
|
|
1505
|
+
const keys = issue.keys.map((key) => `"${String(key)}"`).join(", ");
|
|
1506
|
+
const label = issue.keys.length === 1 ? "unknown key" : "unknown keys";
|
|
1507
|
+
return `${pathLabel}: ${label} ${keys}. Unknown keys are errors in wp-typia config.`;
|
|
1508
|
+
}
|
|
1509
|
+
return `${pathLabel}: ${issue.message}`;
|
|
1510
|
+
}
|
|
1511
|
+
function validateWpTypiaUserConfig(value, source) {
|
|
1512
|
+
const result = wpTypiaUserConfigSchema.safeParse(value);
|
|
1513
|
+
if (result.success) {
|
|
1514
|
+
return result.data;
|
|
1515
|
+
}
|
|
1516
|
+
const issueLines = result.error.issues.map(formatConfigValidationIssue);
|
|
1517
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT, [
|
|
1518
|
+
`Invalid wp-typia config at ${source}.`,
|
|
1519
|
+
...issueLines.map((line) => `- ${line}`)
|
|
1520
|
+
].join(`
|
|
1521
|
+
`));
|
|
1522
|
+
}
|
|
1424
1523
|
function deepMerge(base, incoming) {
|
|
1425
1524
|
const merged = { ...base };
|
|
1426
1525
|
for (const [key, value] of Object.entries(incoming)) {
|
|
@@ -1442,18 +1541,21 @@ async function readJsonFile(filePath) {
|
|
|
1442
1541
|
source = await fs.readFile(filePath, "utf8");
|
|
1443
1542
|
} catch (error) {
|
|
1444
1543
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
1445
|
-
return
|
|
1544
|
+
return;
|
|
1446
1545
|
}
|
|
1447
1546
|
throw error;
|
|
1448
1547
|
}
|
|
1449
1548
|
try {
|
|
1450
|
-
|
|
1451
|
-
return isRecord(parsed) ? parsed : null;
|
|
1549
|
+
return JSON.parse(source);
|
|
1452
1550
|
} catch (error) {
|
|
1453
1551
|
const message = error instanceof Error ? error.message : String(error);
|
|
1454
|
-
throw
|
|
1552
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
1455
1553
|
}
|
|
1456
1554
|
}
|
|
1555
|
+
async function readWpTypiaConfigFile(filePath) {
|
|
1556
|
+
const parsed = await readJsonFile(filePath);
|
|
1557
|
+
return parsed === undefined ? null : validateWpTypiaUserConfig(parsed, filePath);
|
|
1558
|
+
}
|
|
1457
1559
|
function resolveConfigPath(cwd, source) {
|
|
1458
1560
|
if (source.startsWith("~/")) {
|
|
1459
1561
|
return path.join(os.homedir(), source.slice(2));
|
|
@@ -1464,21 +1566,23 @@ function mergeWpTypiaUserConfig(base, incoming) {
|
|
|
1464
1566
|
return deepMerge(base, incoming);
|
|
1465
1567
|
}
|
|
1466
1568
|
async function loadWpTypiaUserConfigFromSource(cwd, source) {
|
|
1467
|
-
const config = await
|
|
1569
|
+
const config = await readWpTypiaConfigFile(resolveConfigPath(cwd, source));
|
|
1468
1570
|
return config ?? {};
|
|
1469
1571
|
}
|
|
1470
1572
|
async function loadWpTypiaUserConfig(cwd) {
|
|
1471
1573
|
let merged = {};
|
|
1472
1574
|
for (const source of WP_TYPIA_CONFIG_SOURCES) {
|
|
1473
1575
|
const configPath = resolveConfigPath(cwd, source);
|
|
1474
|
-
const config = await
|
|
1576
|
+
const config = await readWpTypiaConfigFile(configPath);
|
|
1475
1577
|
if (config) {
|
|
1476
1578
|
merged = deepMerge(merged, config);
|
|
1477
1579
|
}
|
|
1478
1580
|
}
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1581
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
1582
|
+
const packageJson = await readJsonFile(packageJsonPath);
|
|
1583
|
+
if (isRecord(packageJson) && "wp-typia" in packageJson) {
|
|
1584
|
+
const packageConfig = validateWpTypiaUserConfig(packageJson["wp-typia"], `${packageJsonPath}#wp-typia`);
|
|
1585
|
+
merged = deepMerge(merged, packageConfig);
|
|
1482
1586
|
}
|
|
1483
1587
|
return merged;
|
|
1484
1588
|
}
|
|
@@ -1504,8 +1608,8 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
1504
1608
|
|
|
1505
1609
|
// src/runtime-bridge.ts
|
|
1506
1610
|
import {
|
|
1507
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1508
|
-
createCliDiagnosticCodeError as
|
|
1611
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
1612
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError6
|
|
1509
1613
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1510
1614
|
|
|
1511
1615
|
// src/runtime-bridge-add-dry-run.ts
|
|
@@ -1959,8 +2063,8 @@ import { spawnSync } from "node:child_process";
|
|
|
1959
2063
|
import fs3 from "node:fs";
|
|
1960
2064
|
import path3 from "node:path";
|
|
1961
2065
|
import {
|
|
1962
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1963
|
-
createCliDiagnosticCodeError as
|
|
2066
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
|
|
2067
|
+
createCliDiagnosticCodeError as createCliDiagnosticCodeError5
|
|
1964
2068
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1965
2069
|
import {
|
|
1966
2070
|
formatInstallCommand,
|
|
@@ -1981,10 +2085,10 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
1981
2085
|
if (subcommand === "ai") {
|
|
1982
2086
|
return "ai";
|
|
1983
2087
|
}
|
|
1984
|
-
throw
|
|
2088
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
1985
2089
|
}
|
|
1986
2090
|
function getSyncRootError(cwd) {
|
|
1987
|
-
return
|
|
2091
|
+
return createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.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.`);
|
|
1988
2092
|
}
|
|
1989
2093
|
function resolveSyncProjectContext(cwd) {
|
|
1990
2094
|
const packageJsonPath = path3.join(cwd, "package.json");
|
|
@@ -2050,7 +2154,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
2050
2154
|
if (markerDir) {
|
|
2051
2155
|
return;
|
|
2052
2156
|
}
|
|
2053
|
-
throw
|
|
2157
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.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\`.`);
|
|
2054
2158
|
}
|
|
2055
2159
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
2056
2160
|
switch (packageManager) {
|
|
@@ -2088,7 +2192,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2088
2192
|
if (target === "ai") {
|
|
2089
2193
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
2090
2194
|
if (!syncAiCommand2) {
|
|
2091
|
-
throw
|
|
2195
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
2092
2196
|
}
|
|
2093
2197
|
return [syncAiCommand2];
|
|
2094
2198
|
}
|
|
@@ -2097,7 +2201,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2097
2201
|
}
|
|
2098
2202
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
2099
2203
|
if (!syncTypesCommand) {
|
|
2100
|
-
throw
|
|
2204
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
2101
2205
|
}
|
|
2102
2206
|
const plannedCommands = [syncTypesCommand];
|
|
2103
2207
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -2377,13 +2481,13 @@ async function executeAddCommand({
|
|
|
2377
2481
|
if (emitOutput) {
|
|
2378
2482
|
printLine(addRuntime.formatAddHelpText());
|
|
2379
2483
|
}
|
|
2380
|
-
throw
|
|
2484
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
|
|
2381
2485
|
}
|
|
2382
2486
|
if (!isAddKindId(kind)) {
|
|
2383
|
-
throw
|
|
2487
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2384
2488
|
}
|
|
2385
2489
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2386
|
-
throw
|
|
2490
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2387
2491
|
}
|
|
2388
2492
|
const executionContext = {
|
|
2389
2493
|
addRuntime,
|
|
@@ -2435,16 +2539,16 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
2435
2539
|
}
|
|
2436
2540
|
if (subcommand === "inspect") {
|
|
2437
2541
|
if (!flags.id) {
|
|
2438
|
-
throw
|
|
2542
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
2439
2543
|
}
|
|
2440
2544
|
const template = getTemplateById(flags.id);
|
|
2441
2545
|
if (!template) {
|
|
2442
|
-
throw
|
|
2546
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
2443
2547
|
}
|
|
2444
2548
|
printBlock([formatTemplateDetails(template)], printLine);
|
|
2445
2549
|
return;
|
|
2446
2550
|
}
|
|
2447
|
-
throw
|
|
2551
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
2448
2552
|
}
|
|
2449
2553
|
async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
|
|
2450
2554
|
try {
|
|
@@ -2688,6 +2792,60 @@ var SHORT_OPTION_NAMES_WITH_VALUES = new Set([...SHARED_OPTION_PARSER.shortFlagM
|
|
|
2688
2792
|
function isReservedTopLevelCommandName(value) {
|
|
2689
2793
|
return WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES.includes(value);
|
|
2690
2794
|
}
|
|
2795
|
+
function getLongOptionName(arg) {
|
|
2796
|
+
return arg.slice(2).split("=", 1)[0] ?? "";
|
|
2797
|
+
}
|
|
2798
|
+
function hasUnknownOptionBefore(argv, endIndex) {
|
|
2799
|
+
for (let index = 0;index < endIndex; index += 1) {
|
|
2800
|
+
const arg = argv[index];
|
|
2801
|
+
if (arg === "--") {
|
|
2802
|
+
return false;
|
|
2803
|
+
}
|
|
2804
|
+
if (!arg.startsWith("-") || arg === "-") {
|
|
2805
|
+
continue;
|
|
2806
|
+
}
|
|
2807
|
+
if (arg.startsWith("--")) {
|
|
2808
|
+
const optionName = getLongOptionName(arg);
|
|
2809
|
+
if (!SHARED_OPTION_PARSER.booleanOptionNames.has(optionName) && !SHARED_OPTION_PARSER.stringOptionNames.has(optionName)) {
|
|
2810
|
+
return true;
|
|
2811
|
+
}
|
|
2812
|
+
if (!arg.includes("=") && SHARED_OPTION_PARSER.stringOptionNames.has(optionName) && argv[index + 1] && !argv[index + 1].startsWith("-")) {
|
|
2813
|
+
index += 1;
|
|
2814
|
+
}
|
|
2815
|
+
continue;
|
|
2816
|
+
}
|
|
2817
|
+
if (arg.length === 2) {
|
|
2818
|
+
const option = SHARED_OPTION_PARSER.shortFlagMap.get(arg.slice(1));
|
|
2819
|
+
if (!option) {
|
|
2820
|
+
return true;
|
|
2821
|
+
}
|
|
2822
|
+
if (option.type === "string" && argv[index + 1] && !argv[index + 1].startsWith("-")) {
|
|
2823
|
+
index += 1;
|
|
2824
|
+
}
|
|
2825
|
+
continue;
|
|
2826
|
+
}
|
|
2827
|
+
return true;
|
|
2828
|
+
}
|
|
2829
|
+
return false;
|
|
2830
|
+
}
|
|
2831
|
+
function resolveCanonicalCommandContext(argv) {
|
|
2832
|
+
const positionalIndexes = collectPositionalIndexes(argv, COMMAND_ROUTING_METADATA);
|
|
2833
|
+
const firstPositionalIndex = positionalIndexes[0] ?? -1;
|
|
2834
|
+
if (firstPositionalIndex === -1) {
|
|
2835
|
+
return "wp-typia";
|
|
2836
|
+
}
|
|
2837
|
+
const firstPositional = argv[firstPositionalIndex];
|
|
2838
|
+
if (!firstPositional) {
|
|
2839
|
+
return "wp-typia";
|
|
2840
|
+
}
|
|
2841
|
+
if (hasUnknownOptionBefore(argv, firstPositionalIndex)) {
|
|
2842
|
+
return "wp-typia";
|
|
2843
|
+
}
|
|
2844
|
+
if (isReservedTopLevelCommandName(firstPositional)) {
|
|
2845
|
+
return firstPositional;
|
|
2846
|
+
}
|
|
2847
|
+
return positionalIndexes.length === 1 ? "create" : firstPositional;
|
|
2848
|
+
}
|
|
2691
2849
|
function assertStringOptionValues(argv) {
|
|
2692
2850
|
const firstPositionalIndex = findFirstPositionalIndex(argv, COMMAND_ROUTING_METADATA);
|
|
2693
2851
|
if (firstPositionalIndex === -1) {
|
|
@@ -2707,7 +2865,7 @@ function assertStringOptionValues(argv) {
|
|
|
2707
2865
|
if (SHORT_OPTION_NAMES_WITH_VALUES.has(arg.slice(1))) {
|
|
2708
2866
|
const next2 = argv[index + 1];
|
|
2709
2867
|
if (!next2 || next2.startsWith("-")) {
|
|
2710
|
-
throw
|
|
2868
|
+
throw createMissingOptionValueError(arg);
|
|
2711
2869
|
}
|
|
2712
2870
|
index += 1;
|
|
2713
2871
|
}
|
|
@@ -2722,13 +2880,13 @@ function assertStringOptionValues(argv) {
|
|
|
2722
2880
|
}
|
|
2723
2881
|
if (arg.includes("=")) {
|
|
2724
2882
|
if (!inlineValue) {
|
|
2725
|
-
throw
|
|
2883
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
2726
2884
|
}
|
|
2727
2885
|
continue;
|
|
2728
2886
|
}
|
|
2729
2887
|
const next = argv[index + 1];
|
|
2730
2888
|
if (!next || next.startsWith("-")) {
|
|
2731
|
-
throw
|
|
2889
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
2732
2890
|
}
|
|
2733
2891
|
index += 1;
|
|
2734
2892
|
}
|
|
@@ -2815,24 +2973,17 @@ function hasFlagBeforeTerminator(argv, flag) {
|
|
|
2815
2973
|
return false;
|
|
2816
2974
|
}
|
|
2817
2975
|
function parseGlobalFlags(argv) {
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
flags:
|
|
2826
|
-
|
|
2827
|
-
id: typeof flags.id === "string" ? flags.id : undefined
|
|
2828
|
-
}
|
|
2829
|
-
};
|
|
2830
|
-
} catch (error) {
|
|
2831
|
-
if (error instanceof Error && /\`--format\` requires a value\.|\`--id\` requires a value\./.test(error.message)) {
|
|
2832
|
-
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, error.message);
|
|
2976
|
+
const { argv: nextArgv, flags } = extractKnownOptionValuesFromArgv(argv, {
|
|
2977
|
+
optionNames: ["format", "id"],
|
|
2978
|
+
parser: NODE_FALLBACK_OPTION_PARSER
|
|
2979
|
+
});
|
|
2980
|
+
return {
|
|
2981
|
+
argv: nextArgv,
|
|
2982
|
+
flags: {
|
|
2983
|
+
format: typeof flags.format === "string" ? flags.format : undefined,
|
|
2984
|
+
id: typeof flags.id === "string" ? flags.id : undefined
|
|
2833
2985
|
}
|
|
2834
|
-
|
|
2835
|
-
}
|
|
2986
|
+
};
|
|
2836
2987
|
}
|
|
2837
2988
|
async function applyNodeFallbackConfigDefaults(command, subcommand, flags, configOverridePath, cwd) {
|
|
2838
2989
|
let config = await loadWpTypiaUserConfig(cwd);
|
|
@@ -2960,7 +3111,7 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
2960
3111
|
const templateId = flags.id;
|
|
2961
3112
|
if (!templateId) {
|
|
2962
3113
|
throw createCliCommandError3({
|
|
2963
|
-
code:
|
|
3114
|
+
code: CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT,
|
|
2964
3115
|
command: "templates",
|
|
2965
3116
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
2966
3117
|
});
|
|
@@ -2968,7 +3119,7 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
2968
3119
|
const template = getTemplateById(templateId);
|
|
2969
3120
|
if (!template) {
|
|
2970
3121
|
throw createCliCommandError3({
|
|
2971
|
-
code:
|
|
3122
|
+
code: CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT,
|
|
2972
3123
|
command: "templates",
|
|
2973
3124
|
detailLines: [`Unknown template "${templateId}".`]
|
|
2974
3125
|
});
|
|
@@ -2979,7 +3130,7 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
2979
3130
|
}
|
|
2980
3131
|
function renderUnsupportedCommand(command) {
|
|
2981
3132
|
throw createCliCommandError3({
|
|
2982
|
-
code:
|
|
3133
|
+
code: CLI_DIAGNOSTIC_CODES8.UNSUPPORTED_COMMAND,
|
|
2983
3134
|
command,
|
|
2984
3135
|
detailLines: [
|
|
2985
3136
|
[
|
|
@@ -3005,7 +3156,7 @@ async function renderDoctorJson() {
|
|
|
3005
3156
|
}, null, 2));
|
|
3006
3157
|
if (checks.some((check) => check.status === "fail")) {
|
|
3007
3158
|
throw createCliCommandError4({
|
|
3008
|
-
code:
|
|
3159
|
+
code: CLI_DIAGNOSTIC_CODES8.DOCTOR_CHECK_FAILED,
|
|
3009
3160
|
command: "doctor",
|
|
3010
3161
|
detailLines: getDoctorFailureDetailLines(checks),
|
|
3011
3162
|
summary: "One or more doctor checks failed."
|
|
@@ -3022,7 +3173,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3022
3173
|
const { formatAddHelpText } = await import("@wp-typia/project-tools/cli-add");
|
|
3023
3174
|
printLine(formatAddHelpText());
|
|
3024
3175
|
throw createCliCommandError3({
|
|
3025
|
-
code:
|
|
3176
|
+
code: CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT,
|
|
3026
3177
|
command: "add",
|
|
3027
3178
|
detailLines: [
|
|
3028
3179
|
`\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`
|
|
@@ -3070,7 +3221,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3070
3221
|
const projectDir = positionals[1];
|
|
3071
3222
|
if (!projectDir) {
|
|
3072
3223
|
throw createCliCommandError3({
|
|
3073
|
-
code:
|
|
3224
|
+
code: CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT,
|
|
3074
3225
|
command: "create",
|
|
3075
3226
|
detailLines: [
|
|
3076
3227
|
"`wp-typia create` requires <project-dir>.",
|
|
@@ -3181,7 +3332,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3181
3332
|
const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
|
|
3182
3333
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3183
3334
|
throw createCliCommandError3({
|
|
3184
|
-
code:
|
|
3335
|
+
code: CLI_DIAGNOSTIC_CODES8.INVALID_COMMAND,
|
|
3185
3336
|
command: "templates",
|
|
3186
3337
|
detailLines: [
|
|
3187
3338
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -3207,7 +3358,8 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
3207
3358
|
const normalizedArgv = normalizeWpTypiaArgv(argv);
|
|
3208
3359
|
const { argv: argvWithoutConfigOverride, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
|
|
3209
3360
|
validateCliOutputFormatArgv(argvWithoutConfigOverride);
|
|
3210
|
-
const
|
|
3361
|
+
const outputFormatArgv = normalizeCliOutputFormatArgv(argvWithoutConfigOverride);
|
|
3362
|
+
const { argv: cliArgv, flags } = parseGlobalFlags(outputFormatArgv);
|
|
3211
3363
|
const { flags: commandFlags, positionals } = parseArgv(cliArgv);
|
|
3212
3364
|
const rawMergedFlags = {
|
|
3213
3365
|
...commandFlags,
|
|
@@ -3264,9 +3416,13 @@ async function runNodeCliEntrypoint(argv = process.argv.slice(2)) {
|
|
|
3264
3416
|
await runNodeCli(argv);
|
|
3265
3417
|
} catch (error) {
|
|
3266
3418
|
if (prefersStructuredErrorOutput) {
|
|
3419
|
+
const diagnostic = createCliCommandError3({
|
|
3420
|
+
command: resolveCanonicalCommandContext(argv),
|
|
3421
|
+
error
|
|
3422
|
+
});
|
|
3267
3423
|
process.stderr.write(`${JSON.stringify({
|
|
3268
3424
|
ok: false,
|
|
3269
|
-
error: serializeCliDiagnosticError2(
|
|
3425
|
+
error: serializeCliDiagnosticError2(diagnostic)
|
|
3270
3426
|
}, null, 2)}
|
|
3271
3427
|
`);
|
|
3272
3428
|
process.exitCode = 1;
|
|
@@ -3283,4 +3439,4 @@ export {
|
|
|
3283
3439
|
hasFlagBeforeTerminator
|
|
3284
3440
|
};
|
|
3285
3441
|
|
|
3286
|
-
//# debugId=
|
|
3442
|
+
//# debugId=5D4E56BAE8A1432964756E2164756E21
|