wp-typia 0.22.2 → 0.22.4

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.
@@ -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.2",
6
+ version: "0.22.4",
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.2",
76
+ "@wp-typia/project-tools": "0.22.4",
77
77
  "better-result": "^2.7.0",
78
78
  react: "^19.2.5",
79
79
  "react-dom": "^19.2.5",
@@ -97,9 +97,9 @@ var package_default = {
97
97
 
98
98
  // src/node-cli.ts
99
99
  import {
100
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
101
- createCliCommandError as createCliCommandError2,
102
- createCliDiagnosticCodeError as createCliDiagnosticCodeError5,
100
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
101
+ createCliCommandError as createCliCommandError3,
102
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError6,
103
103
  formatCliDiagnosticError,
104
104
  serializeCliDiagnosticError as serializeCliDiagnosticError2
105
105
  } from "@wp-typia/project-tools/cli-diagnostics";
@@ -336,7 +336,7 @@ var SYNC_OPTION_METADATA = {
336
336
  };
337
337
  var DOCTOR_OPTION_METADATA = {
338
338
  format: {
339
- description: "Use `json` for machine-readable doctor check output.",
339
+ description: "Use `json` for machine-readable doctor check output or `toon` for human-readable output.",
340
340
  type: "string"
341
341
  }
342
342
  };
@@ -353,7 +353,7 @@ var GLOBAL_OPTION_METADATA = {
353
353
  type: "string"
354
354
  },
355
355
  format: {
356
- description: "Output format for supported commands.",
356
+ description: "Output format for supported commands (`json` or `toon`).",
357
357
  type: "string"
358
358
  },
359
359
  id: {
@@ -580,10 +580,16 @@ function resolveCommandOptionValues(metadata, options) {
580
580
 
581
581
  // src/cli-diagnostic-output.ts
582
582
  import {
583
- createCliCommandError,
583
+ createCliCommandError as createCliCommandError2,
584
584
  serializeCliDiagnosticError
585
585
  } from "@wp-typia/project-tools/cli-diagnostics";
586
586
 
587
+ // src/cli-output-format.ts
588
+ import {
589
+ CLI_DIAGNOSTIC_CODES,
590
+ createCliCommandError
591
+ } from "@wp-typia/project-tools/cli-diagnostics";
592
+
587
593
  // bin/argv-walker.js
588
594
  function normalizeOptionSet(values) {
589
595
  return values instanceof Set ? values : new Set(values);
@@ -624,6 +630,60 @@ function findFirstPositionalIndex(argv, metadata) {
624
630
  const positionalIndexes = collectPositionalIndexes(argv, metadata);
625
631
  return positionalIndexes[0] ?? -1;
626
632
  }
633
+ function findFirstPositional(argv, metadata) {
634
+ const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
635
+ return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
636
+ }
637
+
638
+ // src/cli-output-format.ts
639
+ var SUPPORTED_CLI_OUTPUT_FORMATS = ["json", "toon"];
640
+ function formatSupportedCliOutputFormats() {
641
+ return SUPPORTED_CLI_OUTPUT_FORMATS.join(", ");
642
+ }
643
+ function isSupportedCliOutputFormat(value) {
644
+ return SUPPORTED_CLI_OUTPUT_FORMATS.includes(value);
645
+ }
646
+ function formatInvalidCliOutputFormatMessage(value) {
647
+ return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
648
+ }
649
+ function resolveEntrypointCliCommand(argv) {
650
+ return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
651
+ }
652
+ function assertSupportedCliOutputFormat(value, argv) {
653
+ if (isSupportedCliOutputFormat(value)) {
654
+ return;
655
+ }
656
+ throw createCliCommandError({
657
+ code: CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT,
658
+ command: resolveEntrypointCliCommand(argv),
659
+ detailLines: [formatInvalidCliOutputFormatMessage(value)]
660
+ });
661
+ }
662
+ function validateCliOutputFormatArgv(argv) {
663
+ for (let index = 0;index < argv.length; index += 1) {
664
+ const arg = argv[index];
665
+ if (!arg) {
666
+ continue;
667
+ }
668
+ if (arg === "--") {
669
+ return;
670
+ }
671
+ if (arg === "--format") {
672
+ const next = argv[index + 1];
673
+ if (next && !next.startsWith("-")) {
674
+ assertSupportedCliOutputFormat(next, argv);
675
+ index += 1;
676
+ }
677
+ continue;
678
+ }
679
+ if (arg.startsWith("--format=")) {
680
+ const value = arg.slice("--format=".length);
681
+ if (value) {
682
+ assertSupportedCliOutputFormat(value, argv);
683
+ }
684
+ }
685
+ }
686
+ }
627
687
 
628
688
  // src/cli-diagnostic-output.ts
629
689
  function prefersStructuredCliArgv(argv) {
@@ -653,8 +713,8 @@ import {
653
713
 
654
714
  // src/add-kind-registry.ts
655
715
  import {
656
- CLI_DIAGNOSTIC_CODES,
657
- createCliDiagnosticCodeError
716
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
717
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError2
658
718
  } from "@wp-typia/project-tools/cli-diagnostics";
659
719
 
660
720
  // src/add-kind-ids.ts
@@ -673,6 +733,66 @@ var ADD_KIND_IDS = [
673
733
  "editor-plugin"
674
734
  ];
675
735
 
736
+ // src/cli-string-flags.ts
737
+ import {
738
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
739
+ createCliDiagnosticCodeError
740
+ } from "@wp-typia/project-tools/cli-diagnostics";
741
+ function readOptionalCliStringFlagValue(flags, name, mode) {
742
+ const value = flags[name];
743
+ if (value === undefined || value === null) {
744
+ return;
745
+ }
746
+ if (typeof value !== "string") {
747
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
748
+ }
749
+ const trimmed = value.trim();
750
+ if (trimmed.length === 0) {
751
+ if (mode === "strict") {
752
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
753
+ }
754
+ return;
755
+ }
756
+ return mode === "strict" ? value : trimmed;
757
+ }
758
+ function readOptionalLooseStringFlag(flags, name) {
759
+ return readOptionalCliStringFlagValue(flags, name, "loose");
760
+ }
761
+ function readOptionalStrictStringFlag(flags, name) {
762
+ return readOptionalCliStringFlagValue(flags, name, "strict");
763
+ }
764
+ function requireStrictStringFlag(flags, name, message) {
765
+ const value = readOptionalStrictStringFlag(flags, name);
766
+ if (!value) {
767
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
768
+ }
769
+ return value;
770
+ }
771
+ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message) {
772
+ const leftValue = readOptionalStrictStringFlag(flags, leftName);
773
+ const rightValue = readOptionalStrictStringFlag(flags, rightName);
774
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
775
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
776
+ }
777
+ return [leftValue, rightValue];
778
+ }
779
+
780
+ // src/external-layer-prompt-options.ts
781
+ function formatExternalLayerSelectHint(option) {
782
+ const details = [
783
+ option.description,
784
+ option.extends.length > 0 ? `extends ${option.extends.join(", ")}` : undefined
785
+ ].filter((value) => typeof value === "string" && value.length > 0);
786
+ return details.length > 0 ? details.join(" · ") : undefined;
787
+ }
788
+ function toExternalLayerPromptOptions(options) {
789
+ return options.map((option) => ({
790
+ hint: formatExternalLayerSelectHint(option),
791
+ label: option.id,
792
+ value: option.id
793
+ }));
794
+ }
795
+
676
796
  // src/add-kind-registry.ts
677
797
  var BLOCK_VISIBLE_FIELD_ORDER = [
678
798
  "kind",
@@ -731,51 +851,12 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
731
851
  "name",
732
852
  "namespace"
733
853
  ];
734
- function readOptionalStringFlag(flags, name) {
735
- const value = flags[name];
736
- if (value === undefined || value === null) {
737
- return;
738
- }
739
- if (typeof value !== "string" || value.trim().length === 0) {
740
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
741
- }
742
- return value;
743
- }
744
- function requireStringFlag(flags, name, message) {
745
- const value = readOptionalStringFlag(flags, name);
746
- if (!value) {
747
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
748
- }
749
- return value;
750
- }
751
- function readOptionalPairedStringFlags(flags, leftName, rightName, message) {
752
- const leftValue = readOptionalStringFlag(flags, leftName);
753
- const rightValue = readOptionalStringFlag(flags, rightName);
754
- if (Boolean(leftValue) !== Boolean(rightValue)) {
755
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
756
- }
757
- return [leftValue, rightValue];
758
- }
759
854
  function requireAddKindName(context, message) {
760
855
  if (!context.name) {
761
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
856
+ throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, message);
762
857
  }
763
858
  return context.name;
764
859
  }
765
- function formatExternalLayerSelectHint(option) {
766
- const details = [
767
- option.description,
768
- option.extends.length > 0 ? `extends ${option.extends.join(", ")}` : undefined
769
- ].filter((value) => typeof value === "string" && value.length > 0);
770
- return details.length > 0 ? details.join(" · ") : undefined;
771
- }
772
- function toExternalLayerPromptOptions(options) {
773
- return options.map((option) => ({
774
- hint: formatExternalLayerSelectHint(option),
775
- label: option.id,
776
- value: option.id
777
- }));
778
- }
779
860
  function defineAddKindRegistryEntry(entry) {
780
861
  return entry;
781
862
  }
@@ -791,6 +872,18 @@ function createNamedExecutionPlan(context, options) {
791
872
  function isAddPersistenceTemplate(template) {
792
873
  return template === "persistence" || template === "compound";
793
874
  }
875
+ function formatAddBlockTemplateIds(addRuntime) {
876
+ return addRuntime.ADD_BLOCK_TEMPLATE_IDS.join(", ");
877
+ }
878
+ function assertAddBlockTemplateId(context, templateId) {
879
+ if (context.addRuntime.isAddBlockTemplateId(templateId)) {
880
+ return templateId;
881
+ }
882
+ if (templateId === "query-loop") {
883
+ throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.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.");
884
+ }
885
+ throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
886
+ }
794
887
  var ADD_KIND_REGISTRY = {
795
888
  "admin-view": defineAddKindRegistryEntry({
796
889
  completion: {
@@ -809,7 +902,7 @@ var ADD_KIND_REGISTRY = {
809
902
  nameLabel: "Admin view name",
810
903
  async prepareExecution(context) {
811
904
  const name = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
812
- const source = readOptionalStringFlag(context.flags, "source");
905
+ const source = readOptionalStrictStringFlag(context.flags, "source");
813
906
  return createNamedExecutionPlan(context, {
814
907
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
815
908
  adminViewName: name2,
@@ -849,7 +942,7 @@ var ADD_KIND_REGISTRY = {
849
942
  nameLabel: "Binding source name",
850
943
  async prepareExecution(context) {
851
944
  const name = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
852
- const [blockName, attributeName] = readOptionalPairedStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
945
+ const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
853
946
  return createNamedExecutionPlan(context, {
854
947
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
855
948
  attributeName,
@@ -889,15 +982,16 @@ var ADD_KIND_REGISTRY = {
889
982
  nameLabel: "Block name",
890
983
  async prepareExecution(context) {
891
984
  const name = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
892
- const externalLayerId = readOptionalStringFlag(context.flags, "external-layer-id");
893
- const externalLayerSource = readOptionalStringFlag(context.flags, "external-layer-source");
985
+ const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
986
+ const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
894
987
  const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
895
988
  const selectPrompt = shouldPromptForLayerSelection ? await context.getOrCreatePrompt() : undefined;
896
- const alternateRenderTargets = readOptionalStringFlag(context.flags, "alternate-render-targets");
897
- const dataStorageMode = readOptionalStringFlag(context.flags, "data-storage");
898
- const innerBlocksPreset = readOptionalStringFlag(context.flags, "inner-blocks-preset");
899
- const persistencePolicy = readOptionalStringFlag(context.flags, "persistence-policy");
900
- let resolvedTemplateId = readOptionalStringFlag(context.flags, "template");
989
+ const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
990
+ const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
991
+ const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
992
+ const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
993
+ const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
994
+ let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
901
995
  if (!resolvedTemplateId && context.isInteractiveSession) {
902
996
  const templatePrompt = await context.getOrCreatePrompt();
903
997
  resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
@@ -994,7 +1088,7 @@ var ADD_KIND_REGISTRY = {
994
1088
  nameLabel: "Editor plugin name",
995
1089
  async prepareExecution(context) {
996
1090
  const name = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
997
- const slot = readOptionalStringFlag(context.flags, "slot");
1091
+ const slot = readOptionalStrictStringFlag(context.flags, "slot");
998
1092
  return createNamedExecutionPlan(context, {
999
1093
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
1000
1094
  cwd,
@@ -1032,8 +1126,8 @@ var ADD_KIND_REGISTRY = {
1032
1126
  nameLabel: "Target block",
1033
1127
  async prepareExecution(context) {
1034
1128
  const name = requireAddKindName(context, "`wp-typia add hooked-block` requires <block-slug>. Usage: wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild>.");
1035
- const anchorBlockName = requireStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
1036
- const position = requireStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
1129
+ const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
1130
+ const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
1037
1131
  return createNamedExecutionPlan(context, {
1038
1132
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddHookedBlockCommand({
1039
1133
  anchorBlockName,
@@ -1103,7 +1197,7 @@ var ADD_KIND_REGISTRY = {
1103
1197
  nameLabel: "Style name",
1104
1198
  async prepareExecution(context) {
1105
1199
  const name = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
1106
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
1200
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
1107
1201
  return createNamedExecutionPlan(context, {
1108
1202
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
1109
1203
  blockName: blockSlug,
@@ -1141,8 +1235,8 @@ var ADD_KIND_REGISTRY = {
1141
1235
  nameLabel: "Transform name",
1142
1236
  async prepareExecution(context) {
1143
1237
  const name = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
1144
- const fromBlockName = requireStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
1145
- const toBlockName = requireStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
1238
+ const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
1239
+ const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
1146
1240
  return createNamedExecutionPlan(context, {
1147
1241
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockTransformCommand({
1148
1242
  cwd,
@@ -1183,8 +1277,8 @@ var ADD_KIND_REGISTRY = {
1183
1277
  nameLabel: "REST resource name",
1184
1278
  async prepareExecution(context) {
1185
1279
  const name = requireAddKindName(context, "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].");
1186
- const methods = readOptionalStringFlag(context.flags, "methods");
1187
- const namespace = readOptionalStringFlag(context.flags, "namespace");
1280
+ const methods = readOptionalStrictStringFlag(context.flags, "methods");
1281
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1188
1282
  return createNamedExecutionPlan(context, {
1189
1283
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
1190
1284
  cwd,
@@ -1223,7 +1317,7 @@ var ADD_KIND_REGISTRY = {
1223
1317
  nameLabel: "AI feature name",
1224
1318
  async prepareExecution(context) {
1225
1319
  const name = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
1226
- const namespace = readOptionalStringFlag(context.flags, "namespace");
1320
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1227
1321
  return createNamedExecutionPlan(context, {
1228
1322
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
1229
1323
  aiFeatureName: name2,
@@ -1262,7 +1356,7 @@ var ADD_KIND_REGISTRY = {
1262
1356
  nameLabel: "Variation name",
1263
1357
  async prepareExecution(context) {
1264
1358
  const name = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
1265
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
1359
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
1266
1360
  return createNamedExecutionPlan(context, {
1267
1361
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
1268
1362
  blockName: blockSlug,
@@ -1313,8 +1407,8 @@ import os from "node:os";
1313
1407
  import path from "node:path";
1314
1408
  import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
1315
1409
  import {
1316
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
1317
- createCliDiagnosticCodeError as createCliDiagnosticCodeError2
1410
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
1411
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError3
1318
1412
  } from "@wp-typia/project-tools/cli-diagnostics";
1319
1413
  var WP_TYPIA_CONFIG_SOURCES = [
1320
1414
  "~/.config/wp-typia/config.json",
@@ -1351,7 +1445,7 @@ async function readJsonFile(filePath) {
1351
1445
  return isRecord(parsed) ? parsed : null;
1352
1446
  } catch (error) {
1353
1447
  const message = error instanceof Error ? error.message : String(error);
1354
- throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES2.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
1448
+ throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
1355
1449
  }
1356
1450
  }
1357
1451
  function resolveConfigPath(cwd, source) {
@@ -1404,8 +1498,8 @@ function extractWpTypiaConfigOverride(argv) {
1404
1498
 
1405
1499
  // src/runtime-bridge.ts
1406
1500
  import {
1407
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
1408
- createCliDiagnosticCodeError as createCliDiagnosticCodeError4
1501
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
1502
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError5
1409
1503
  } from "@wp-typia/project-tools/cli-diagnostics";
1410
1504
 
1411
1505
  // src/runtime-bridge-add-dry-run.ts
@@ -1536,9 +1630,10 @@ async function simulateWorkspaceAddDryRun({
1536
1630
  }
1537
1631
 
1538
1632
  // src/runtime-bridge-output.ts
1539
- import fs3 from "node:fs";
1540
- import path3 from "node:path";
1541
- import { formatPackageExecCommand } from "@wp-typia/project-tools/package-managers";
1633
+ import {
1634
+ formatPackageExecCommand,
1635
+ inferPackageManagerId
1636
+ } from "@wp-typia/project-tools/package-managers";
1542
1637
 
1543
1638
  // src/output-markers.ts
1544
1639
  var UNICODE_OUTPUT_MARKERS = {
@@ -1785,32 +1880,6 @@ function buildInitCompletionPayload(plan, markerOptions) {
1785
1880
  warningLines: plan.notes
1786
1881
  };
1787
1882
  }
1788
- function inferProjectPackageManager(projectDir) {
1789
- try {
1790
- const packageJsonPath = path3.join(projectDir, "package.json");
1791
- if (fs3.existsSync(packageJsonPath)) {
1792
- const manifest = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
1793
- if (manifest.packageManager?.startsWith("bun@"))
1794
- return "bun";
1795
- if (manifest.packageManager?.startsWith("pnpm@"))
1796
- return "pnpm";
1797
- if (manifest.packageManager?.startsWith("yarn@"))
1798
- return "yarn";
1799
- if (manifest.packageManager?.startsWith("npm@"))
1800
- return "npm";
1801
- }
1802
- } catch {}
1803
- if (fs3.existsSync(path3.join(projectDir, "bun.lock")) || fs3.existsSync(path3.join(projectDir, "bun.lockb"))) {
1804
- return "bun";
1805
- }
1806
- if (fs3.existsSync(path3.join(projectDir, "pnpm-lock.yaml"))) {
1807
- return "pnpm";
1808
- }
1809
- if (fs3.existsSync(path3.join(projectDir, "yarn.lock")) || fs3.existsSync(path3.join(projectDir, ".yarnrc.yml"))) {
1810
- return "yarn";
1811
- }
1812
- return "npm";
1813
- }
1814
1883
  function buildMigrationCompletionPayload(options, markerOptions) {
1815
1884
  const summaryLines = options.lines.filter((line) => line.trim().length > 0);
1816
1885
  return {
@@ -1820,7 +1889,7 @@ function buildMigrationCompletionPayload(options, markerOptions) {
1820
1889
  }
1821
1890
  function buildAddCompletionPayload(options, markerOptions) {
1822
1891
  const verificationLines = [
1823
- formatPackageExecCommand(options.packageManager ?? inferProjectPackageManager(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
1892
+ formatPackageExecCommand(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
1824
1893
  ];
1825
1894
  const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
1826
1895
  const completion = buildAddKindCompletionDetails(options.kind, {
@@ -1870,20 +1939,6 @@ function printBlock(lines, printLine) {
1870
1939
  printLine(line);
1871
1940
  }
1872
1941
  }
1873
- function formatExternalLayerSelectHint2(option) {
1874
- const details = [
1875
- option.description,
1876
- option.extends.length > 0 ? `extends ${option.extends.join(", ")}` : undefined
1877
- ].filter((value) => typeof value === "string" && value.length > 0);
1878
- return details.length > 0 ? details.join(" · ") : undefined;
1879
- }
1880
- function toExternalLayerPromptOptions2(options) {
1881
- return options.map((option) => ({
1882
- hint: formatExternalLayerSelectHint2(option),
1883
- label: option.id,
1884
- value: option.id
1885
- }));
1886
- }
1887
1942
 
1888
1943
  // src/runtime-capabilities.ts
1889
1944
  function isInteractiveTerminal({
@@ -1895,12 +1950,17 @@ function isInteractiveTerminal({
1895
1950
  }
1896
1951
  // src/runtime-bridge-sync.ts
1897
1952
  import { spawnSync } from "node:child_process";
1898
- import fs4 from "node:fs";
1899
- import path4 from "node:path";
1953
+ import fs3 from "node:fs";
1954
+ import path3 from "node:path";
1900
1955
  import {
1901
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
1902
- createCliDiagnosticCodeError as createCliDiagnosticCodeError3
1956
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
1957
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError4
1903
1958
  } from "@wp-typia/project-tools/cli-diagnostics";
1959
+ import {
1960
+ formatInstallCommand,
1961
+ formatRunScript,
1962
+ inferPackageManagerId as inferPackageManagerId2
1963
+ } from "@wp-typia/project-tools/package-managers";
1904
1964
  var SYNC_INSTALL_MARKERS = [
1905
1965
  "node_modules",
1906
1966
  ".pnp.cjs",
@@ -1915,66 +1975,17 @@ function resolveSyncExecutionTarget(subcommand) {
1915
1975
  if (subcommand === "ai") {
1916
1976
  return "ai";
1917
1977
  }
1918
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
1919
- }
1920
- function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
1921
- const args = extraArgs.trim();
1922
- if (packageManagerId === "bun") {
1923
- return args ? `bun run ${scriptName} ${args}` : `bun run ${scriptName}`;
1924
- }
1925
- if (packageManagerId === "npm") {
1926
- return args ? `npm run ${scriptName} -- ${args}` : `npm run ${scriptName}`;
1927
- }
1928
- if (packageManagerId === "pnpm") {
1929
- return args ? `pnpm run ${scriptName} ${args}` : `pnpm run ${scriptName}`;
1930
- }
1931
- return args ? `yarn run ${scriptName} ${args}` : `yarn run ${scriptName}`;
1932
- }
1933
- function formatInstallCommand(packageManagerId) {
1934
- switch (packageManagerId) {
1935
- case "bun":
1936
- return "bun install";
1937
- case "pnpm":
1938
- return "pnpm install";
1939
- case "yarn":
1940
- return "yarn install";
1941
- default:
1942
- return "npm install";
1943
- }
1978
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
1944
1979
  }
1945
1980
  function getSyncRootError(cwd) {
1946
- return createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.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.`);
1947
- }
1948
- function inferSyncPackageManager(cwd, packageManagerField) {
1949
- const field = String(packageManagerField ?? "");
1950
- if (field.startsWith("bun@"))
1951
- return "bun";
1952
- if (field.startsWith("npm@"))
1953
- return "npm";
1954
- if (field.startsWith("pnpm@"))
1955
- return "pnpm";
1956
- if (field.startsWith("yarn@"))
1957
- return "yarn";
1958
- if (fs4.existsSync(path4.join(cwd, "bun.lock")) || fs4.existsSync(path4.join(cwd, "bun.lockb"))) {
1959
- return "bun";
1960
- }
1961
- if (fs4.existsSync(path4.join(cwd, "pnpm-lock.yaml"))) {
1962
- return "pnpm";
1963
- }
1964
- if (fs4.existsSync(path4.join(cwd, "yarn.lock")) || fs4.existsSync(path4.join(cwd, ".pnp.cjs")) || fs4.existsSync(path4.join(cwd, ".pnp.loader.mjs")) || fs4.existsSync(path4.join(cwd, ".yarnrc.yml"))) {
1965
- return "yarn";
1966
- }
1967
- if (fs4.existsSync(path4.join(cwd, "package-lock.json")) || fs4.existsSync(path4.join(cwd, "npm-shrinkwrap.json"))) {
1968
- return "npm";
1969
- }
1970
- return "npm";
1981
+ return createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.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.`);
1971
1982
  }
1972
1983
  function resolveSyncProjectContext(cwd) {
1973
- const packageJsonPath = path4.join(cwd, "package.json");
1974
- if (!fs4.existsSync(packageJsonPath)) {
1984
+ const packageJsonPath = path3.join(cwd, "package.json");
1985
+ if (!fs3.existsSync(packageJsonPath)) {
1975
1986
  throw getSyncRootError(cwd);
1976
1987
  }
1977
- const packageJson = JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
1988
+ const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
1978
1989
  const scripts = packageJson.scripts ?? {};
1979
1990
  const syncScripts = {
1980
1991
  sync: typeof scripts.sync === "string" ? {
@@ -2000,17 +2011,17 @@ function resolveSyncProjectContext(cwd) {
2000
2011
  return {
2001
2012
  cwd,
2002
2013
  packageJsonPath,
2003
- packageManager: inferSyncPackageManager(cwd, packageJson.packageManager),
2014
+ packageManager: inferPackageManagerId2(cwd, packageJson.packageManager),
2004
2015
  scripts: syncScripts
2005
2016
  };
2006
2017
  }
2007
2018
  function findInstalledDependencyMarkerDir(projectDir) {
2008
- let currentDir = path4.resolve(projectDir);
2019
+ let currentDir = path3.resolve(projectDir);
2009
2020
  while (true) {
2010
- if (SYNC_INSTALL_MARKERS.some((marker) => fs4.existsSync(path4.join(currentDir, marker)))) {
2021
+ if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path3.join(currentDir, marker)))) {
2011
2022
  return currentDir;
2012
2023
  }
2013
- const parentDir = path4.dirname(currentDir);
2024
+ const parentDir = path3.dirname(currentDir);
2014
2025
  if (parentDir === currentDir) {
2015
2026
  return null;
2016
2027
  }
@@ -2033,7 +2044,7 @@ function assertSyncDependenciesInstalled(project, target) {
2033
2044
  if (markerDir) {
2034
2045
  return;
2035
2046
  }
2036
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.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\`.`);
2047
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.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\`.`);
2037
2048
  }
2038
2049
  function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
2039
2050
  switch (packageManager) {
@@ -2071,7 +2082,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
2071
2082
  if (target === "ai") {
2072
2083
  const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2073
2084
  if (!syncAiCommand2) {
2074
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2085
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2075
2086
  }
2076
2087
  return [syncAiCommand2];
2077
2088
  }
@@ -2080,7 +2091,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
2080
2091
  }
2081
2092
  const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
2082
2093
  if (!syncTypesCommand) {
2083
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2094
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2084
2095
  }
2085
2096
  const plannedCommands = [syncTypesCommand];
2086
2097
  const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
@@ -2154,8 +2165,8 @@ var loadCliScaffoldRuntime = () => import("@wp-typia/project-tools/cli-scaffold"
2154
2165
  var loadCliTemplatesRuntime = () => import("@wp-typia/project-tools/cli-templates");
2155
2166
  var loadMigrationsRuntime = () => import("@wp-typia/project-tools/migrations");
2156
2167
  async function wrapCliCommandError(command, error) {
2157
- const { createCliCommandError: createCliCommandError2 } = await loadCliDiagnosticsRuntime();
2158
- return createCliCommandError2({ command, error });
2168
+ const { createCliCommandError: createCliCommandError3 } = await loadCliDiagnosticsRuntime();
2169
+ return createCliCommandError3({ command, error });
2159
2170
  }
2160
2171
  function shouldWrapCliCommandError(options) {
2161
2172
  if (options.emitOutput === false) {
@@ -2166,17 +2177,6 @@ function shouldWrapCliCommandError(options) {
2166
2177
  }
2167
2178
  return true;
2168
2179
  }
2169
- function readOptionalLooseStringFlag(flags, name) {
2170
- const value = flags[name];
2171
- if (value === undefined || value === null) {
2172
- return;
2173
- }
2174
- if (typeof value !== "string") {
2175
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
2176
- }
2177
- const trimmed = value.trim();
2178
- return trimmed.length > 0 ? trimmed : undefined;
2179
- }
2180
2180
  function pushFlag(argv, name, value) {
2181
2181
  if (value === undefined || value === null || value === false) {
2182
2182
  return;
@@ -2318,7 +2318,7 @@ async function executeCreateCommand({
2318
2318
  promptText: activePrompt ? (message, defaultValue, validate) => activePrompt.text(message, defaultValue, validate) : undefined,
2319
2319
  queryPostType: readOptionalLooseStringFlag(flags, "query-post-type"),
2320
2320
  selectDataStorage: activePrompt ? () => activePrompt.select("Select a data storage mode", [...DATA_STORAGE_PROMPT_OPTIONS], 1) : undefined,
2321
- selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions2(options), 1) : undefined,
2321
+ selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
2322
2322
  selectPackageManager: activePrompt ? () => activePrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
2323
2323
  selectPersistencePolicy: activePrompt ? () => activePrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
2324
2324
  selectTemplate: activePrompt ? () => activePrompt.select("Select a template", getTemplateSelectOptions(), 1) : undefined,
@@ -2371,13 +2371,13 @@ async function executeAddCommand({
2371
2371
  if (emitOutput) {
2372
2372
  printLine(addRuntime.formatAddHelpText());
2373
2373
  }
2374
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
2374
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
2375
2375
  }
2376
2376
  if (!isAddKindId(kind)) {
2377
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2377
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2378
2378
  }
2379
2379
  if (dryRun && !supportsAddKindDryRun(kind)) {
2380
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2380
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2381
2381
  }
2382
2382
  const executionContext = {
2383
2383
  addRuntime,
@@ -2429,16 +2429,16 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
2429
2429
  }
2430
2430
  if (subcommand === "inspect") {
2431
2431
  if (!flags.id) {
2432
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2432
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2433
2433
  }
2434
2434
  const template = getTemplateById(flags.id);
2435
2435
  if (!template) {
2436
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2436
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2437
2437
  }
2438
2438
  printBlock([formatTemplateDetails(template)], printLine);
2439
2439
  return;
2440
2440
  }
2441
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2441
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2442
2442
  }
2443
2443
  async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
2444
2444
  try {
@@ -2526,7 +2526,7 @@ async function executeMigrateCommand({
2526
2526
  }
2527
2527
 
2528
2528
  // src/command-contract.ts
2529
- import path5 from "node:path";
2529
+ import path4 from "node:path";
2530
2530
 
2531
2531
  // src/command-registry.ts
2532
2532
  var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
@@ -2740,7 +2740,7 @@ function looksLikeStructuredProjectInput(value) {
2740
2740
  return value.startsWith("@") && value.includes("/");
2741
2741
  }
2742
2742
  function assertPositionalAliasProjectDir(projectDir) {
2743
- const normalizedProjectDir = path5.normalize(projectDir).replace(/[\\/]+$/u, "") || path5.normalize(projectDir);
2743
+ const normalizedProjectDir = path4.normalize(projectDir).replace(/[\\/]+$/u, "") || path4.normalize(projectDir);
2744
2744
  if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
2745
2745
  throw new Error(`The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
2746
2746
  }
@@ -2823,7 +2823,7 @@ function parseGlobalFlags(argv) {
2823
2823
  };
2824
2824
  } catch (error) {
2825
2825
  if (error instanceof Error && /\`--format\` requires a value\.|\`--id\` requires a value\./.test(error.message)) {
2826
- throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT, error.message);
2826
+ throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, error.message);
2827
2827
  }
2828
2828
  throw error;
2829
2829
  }
@@ -2986,16 +2986,16 @@ function renderTemplatesJson(flags, subcommand) {
2986
2986
  }
2987
2987
  const templateId = flags.id;
2988
2988
  if (!templateId) {
2989
- throw createCliCommandError2({
2990
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
2989
+ throw createCliCommandError3({
2990
+ code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
2991
2991
  command: "templates",
2992
2992
  detailLines: ["`wp-typia templates inspect` requires <template-id>."]
2993
2993
  });
2994
2994
  }
2995
2995
  const template = getTemplateById(templateId);
2996
2996
  if (!template) {
2997
- throw createCliCommandError2({
2998
- code: CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT,
2997
+ throw createCliCommandError3({
2998
+ code: CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT,
2999
2999
  command: "templates",
3000
3000
  detailLines: [`Unknown template "${templateId}".`]
3001
3001
  });
@@ -3005,8 +3005,8 @@ function renderTemplatesJson(flags, subcommand) {
3005
3005
  }, null, 2));
3006
3006
  }
3007
3007
  function renderUnsupportedCommand(command) {
3008
- throw createCliCommandError2({
3009
- code: CLI_DIAGNOSTIC_CODES5.UNSUPPORTED_COMMAND,
3008
+ throw createCliCommandError3({
3009
+ code: CLI_DIAGNOSTIC_CODES7.UNSUPPORTED_COMMAND,
3010
3010
  command,
3011
3011
  detailLines: [
3012
3012
  [
@@ -3021,7 +3021,7 @@ function renderUnsupportedCommand(command) {
3021
3021
  async function renderDoctorJson() {
3022
3022
  const [
3023
3023
  { getDoctorChecks },
3024
- { createCliCommandError: createCliCommandError3, getDoctorFailureDetailLines }
3024
+ { createCliCommandError: createCliCommandError4, getDoctorFailureDetailLines }
3025
3025
  ] = await Promise.all([
3026
3026
  import("@wp-typia/project-tools/cli-doctor"),
3027
3027
  import("@wp-typia/project-tools/cli-diagnostics")
@@ -3031,8 +3031,8 @@ async function renderDoctorJson() {
3031
3031
  checks
3032
3032
  }, null, 2));
3033
3033
  if (checks.some((check) => check.status === "fail")) {
3034
- throw createCliCommandError3({
3035
- code: CLI_DIAGNOSTIC_CODES5.DOCTOR_CHECK_FAILED,
3034
+ throw createCliCommandError4({
3035
+ code: CLI_DIAGNOSTIC_CODES7.DOCTOR_CHECK_FAILED,
3036
3036
  command: "doctor",
3037
3037
  detailLines: getDoctorFailureDetailLines(checks),
3038
3038
  summary: "One or more doctor checks failed."
@@ -3048,8 +3048,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3048
3048
  if (!positionals[1]) {
3049
3049
  const { formatAddHelpText } = await import("@wp-typia/project-tools/cli-add");
3050
3050
  printLine(formatAddHelpText());
3051
- throw createCliCommandError2({
3052
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
3051
+ throw createCliCommandError3({
3052
+ code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
3053
3053
  command: "add",
3054
3054
  detailLines: [
3055
3055
  `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`
@@ -3068,7 +3068,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3068
3068
  name: positionals[2]
3069
3069
  });
3070
3070
  } catch (error) {
3071
- throw createCliCommandError2({
3071
+ throw createCliCommandError3({
3072
3072
  command: "add",
3073
3073
  error
3074
3074
  });
@@ -3096,8 +3096,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3096
3096
  }) => {
3097
3097
  const projectDir = positionals[1];
3098
3098
  if (!projectDir) {
3099
- throw createCliCommandError2({
3100
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
3099
+ throw createCliCommandError3({
3100
+ code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
3101
3101
  command: "create",
3102
3102
  detailLines: [
3103
3103
  "`wp-typia create` requires <project-dir>.",
@@ -3115,7 +3115,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3115
3115
  projectDir
3116
3116
  });
3117
3117
  } catch (error) {
3118
- throw createCliCommandError2({
3118
+ throw createCliCommandError3({
3119
3119
  command: "create",
3120
3120
  error
3121
3121
  });
@@ -3193,7 +3193,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3193
3193
  }));
3194
3194
  }
3195
3195
  } catch (error) {
3196
- throw createCliCommandError2({
3196
+ throw createCliCommandError3({
3197
3197
  command: "sync",
3198
3198
  error
3199
3199
  });
@@ -3207,8 +3207,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3207
3207
  const templateId = typeof mergedFlags.id === "string" ? mergedFlags.id : positionals[2];
3208
3208
  const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
3209
3209
  if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
3210
- throw createCliCommandError2({
3211
- code: CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND,
3210
+ throw createCliCommandError3({
3211
+ code: CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND,
3212
3212
  command: "templates",
3213
3213
  detailLines: [
3214
3214
  `Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
@@ -3233,6 +3233,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3233
3233
  async function runNodeCli(argv = process.argv.slice(2)) {
3234
3234
  const normalizedArgv = normalizeWpTypiaArgv(argv);
3235
3235
  const { argv: argvWithoutConfigOverride, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
3236
+ validateCliOutputFormatArgv(argvWithoutConfigOverride);
3236
3237
  const { argv: cliArgv, flags } = parseGlobalFlags(argvWithoutConfigOverride);
3237
3238
  const { flags: commandFlags, positionals } = parseArgv(cliArgv);
3238
3239
  const rawMergedFlags = {
@@ -3240,9 +3241,14 @@ async function runNodeCli(argv = process.argv.slice(2)) {
3240
3241
  ...flags
3241
3242
  };
3242
3243
  const [command, subcommand] = positionals;
3243
- const helpRequested = cliArgv.length === 0 || hasFlagBeforeTerminator(cliArgv, "--help") || command === "help";
3244
+ const helpRequested = hasFlagBeforeTerminator(cliArgv, "--help") || command === "help";
3244
3245
  const helpTarget = command === "help" ? subcommand : command;
3245
3246
  const versionRequested = hasFlagBeforeTerminator(cliArgv, "--version") || command === "version";
3247
+ if (cliArgv.length === 0) {
3248
+ renderGeneralHelp();
3249
+ process.exitCode = 1;
3250
+ return;
3251
+ }
3246
3252
  if (helpRequested) {
3247
3253
  if (helpTarget) {
3248
3254
  const helpRenderer = NODE_FALLBACK_HELP_RENDERERS[helpTarget];
@@ -3304,4 +3310,4 @@ export {
3304
3310
  hasFlagBeforeTerminator
3305
3311
  };
3306
3312
 
3307
- //# debugId=F8B7C97D684FB07764756E2164756E21
3313
+ //# debugId=8CAE70B24462975F64756E2164756E21