wp-typia 0.22.2 → 0.22.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.
@@ -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.3",
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.3",
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,
100
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
101
101
  createCliCommandError as createCliCommandError2,
102
- createCliDiagnosticCodeError as createCliDiagnosticCodeError5,
102
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError6,
103
103
  formatCliDiagnosticError,
104
104
  serializeCliDiagnosticError as serializeCliDiagnosticError2
105
105
  } from "@wp-typia/project-tools/cli-diagnostics";
@@ -653,8 +653,8 @@ import {
653
653
 
654
654
  // src/add-kind-registry.ts
655
655
  import {
656
- CLI_DIAGNOSTIC_CODES,
657
- createCliDiagnosticCodeError
656
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
657
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError2
658
658
  } from "@wp-typia/project-tools/cli-diagnostics";
659
659
 
660
660
  // src/add-kind-ids.ts
@@ -673,6 +673,66 @@ var ADD_KIND_IDS = [
673
673
  "editor-plugin"
674
674
  ];
675
675
 
676
+ // src/cli-string-flags.ts
677
+ import {
678
+ CLI_DIAGNOSTIC_CODES,
679
+ createCliDiagnosticCodeError
680
+ } from "@wp-typia/project-tools/cli-diagnostics";
681
+ function readOptionalCliStringFlagValue(flags, name, mode) {
682
+ const value = flags[name];
683
+ if (value === undefined || value === null) {
684
+ return;
685
+ }
686
+ if (typeof value !== "string") {
687
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
688
+ }
689
+ const trimmed = value.trim();
690
+ if (trimmed.length === 0) {
691
+ if (mode === "strict") {
692
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
693
+ }
694
+ return;
695
+ }
696
+ return mode === "strict" ? value : trimmed;
697
+ }
698
+ function readOptionalLooseStringFlag(flags, name) {
699
+ return readOptionalCliStringFlagValue(flags, name, "loose");
700
+ }
701
+ function readOptionalStrictStringFlag(flags, name) {
702
+ return readOptionalCliStringFlagValue(flags, name, "strict");
703
+ }
704
+ function requireStrictStringFlag(flags, name, message) {
705
+ const value = readOptionalStrictStringFlag(flags, name);
706
+ if (!value) {
707
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
708
+ }
709
+ return value;
710
+ }
711
+ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message) {
712
+ const leftValue = readOptionalStrictStringFlag(flags, leftName);
713
+ const rightValue = readOptionalStrictStringFlag(flags, rightName);
714
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
715
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
716
+ }
717
+ return [leftValue, rightValue];
718
+ }
719
+
720
+ // src/external-layer-prompt-options.ts
721
+ function formatExternalLayerSelectHint(option) {
722
+ const details = [
723
+ option.description,
724
+ option.extends.length > 0 ? `extends ${option.extends.join(", ")}` : undefined
725
+ ].filter((value) => typeof value === "string" && value.length > 0);
726
+ return details.length > 0 ? details.join(" · ") : undefined;
727
+ }
728
+ function toExternalLayerPromptOptions(options) {
729
+ return options.map((option) => ({
730
+ hint: formatExternalLayerSelectHint(option),
731
+ label: option.id,
732
+ value: option.id
733
+ }));
734
+ }
735
+
676
736
  // src/add-kind-registry.ts
677
737
  var BLOCK_VISIBLE_FIELD_ORDER = [
678
738
  "kind",
@@ -731,51 +791,12 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
731
791
  "name",
732
792
  "namespace"
733
793
  ];
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
794
  function requireAddKindName(context, message) {
760
795
  if (!context.name) {
761
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
796
+ throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
762
797
  }
763
798
  return context.name;
764
799
  }
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
800
  function defineAddKindRegistryEntry(entry) {
780
801
  return entry;
781
802
  }
@@ -809,7 +830,7 @@ var ADD_KIND_REGISTRY = {
809
830
  nameLabel: "Admin view name",
810
831
  async prepareExecution(context) {
811
832
  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");
833
+ const source = readOptionalStrictStringFlag(context.flags, "source");
813
834
  return createNamedExecutionPlan(context, {
814
835
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
815
836
  adminViewName: name2,
@@ -849,7 +870,7 @@ var ADD_KIND_REGISTRY = {
849
870
  nameLabel: "Binding source name",
850
871
  async prepareExecution(context) {
851
872
  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.");
873
+ const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
853
874
  return createNamedExecutionPlan(context, {
854
875
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
855
876
  attributeName,
@@ -889,15 +910,15 @@ var ADD_KIND_REGISTRY = {
889
910
  nameLabel: "Block name",
890
911
  async prepareExecution(context) {
891
912
  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");
913
+ const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
914
+ const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
894
915
  const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
895
916
  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");
917
+ const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
918
+ const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
919
+ const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
920
+ const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
921
+ let resolvedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
901
922
  if (!resolvedTemplateId && context.isInteractiveSession) {
902
923
  const templatePrompt = await context.getOrCreatePrompt();
903
924
  resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
@@ -994,7 +1015,7 @@ var ADD_KIND_REGISTRY = {
994
1015
  nameLabel: "Editor plugin name",
995
1016
  async prepareExecution(context) {
996
1017
  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");
1018
+ const slot = readOptionalStrictStringFlag(context.flags, "slot");
998
1019
  return createNamedExecutionPlan(context, {
999
1020
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
1000
1021
  cwd,
@@ -1032,8 +1053,8 @@ var ADD_KIND_REGISTRY = {
1032
1053
  nameLabel: "Target block",
1033
1054
  async prepareExecution(context) {
1034
1055
  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>.");
1056
+ const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
1057
+ const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
1037
1058
  return createNamedExecutionPlan(context, {
1038
1059
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddHookedBlockCommand({
1039
1060
  anchorBlockName,
@@ -1103,7 +1124,7 @@ var ADD_KIND_REGISTRY = {
1103
1124
  nameLabel: "Style name",
1104
1125
  async prepareExecution(context) {
1105
1126
  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>.");
1127
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
1107
1128
  return createNamedExecutionPlan(context, {
1108
1129
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
1109
1130
  blockName: blockSlug,
@@ -1141,8 +1162,8 @@ var ADD_KIND_REGISTRY = {
1141
1162
  nameLabel: "Transform name",
1142
1163
  async prepareExecution(context) {
1143
1164
  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>.");
1165
+ const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
1166
+ const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
1146
1167
  return createNamedExecutionPlan(context, {
1147
1168
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockTransformCommand({
1148
1169
  cwd,
@@ -1183,8 +1204,8 @@ var ADD_KIND_REGISTRY = {
1183
1204
  nameLabel: "REST resource name",
1184
1205
  async prepareExecution(context) {
1185
1206
  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");
1207
+ const methods = readOptionalStrictStringFlag(context.flags, "methods");
1208
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1188
1209
  return createNamedExecutionPlan(context, {
1189
1210
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
1190
1211
  cwd,
@@ -1223,7 +1244,7 @@ var ADD_KIND_REGISTRY = {
1223
1244
  nameLabel: "AI feature name",
1224
1245
  async prepareExecution(context) {
1225
1246
  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");
1247
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1227
1248
  return createNamedExecutionPlan(context, {
1228
1249
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
1229
1250
  aiFeatureName: name2,
@@ -1262,7 +1283,7 @@ var ADD_KIND_REGISTRY = {
1262
1283
  nameLabel: "Variation name",
1263
1284
  async prepareExecution(context) {
1264
1285
  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>.");
1286
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
1266
1287
  return createNamedExecutionPlan(context, {
1267
1288
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
1268
1289
  blockName: blockSlug,
@@ -1313,8 +1334,8 @@ import os from "node:os";
1313
1334
  import path from "node:path";
1314
1335
  import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
1315
1336
  import {
1316
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
1317
- createCliDiagnosticCodeError as createCliDiagnosticCodeError2
1337
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
1338
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError3
1318
1339
  } from "@wp-typia/project-tools/cli-diagnostics";
1319
1340
  var WP_TYPIA_CONFIG_SOURCES = [
1320
1341
  "~/.config/wp-typia/config.json",
@@ -1351,7 +1372,7 @@ async function readJsonFile(filePath) {
1351
1372
  return isRecord(parsed) ? parsed : null;
1352
1373
  } catch (error) {
1353
1374
  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);
1375
+ throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
1355
1376
  }
1356
1377
  }
1357
1378
  function resolveConfigPath(cwd, source) {
@@ -1404,8 +1425,8 @@ function extractWpTypiaConfigOverride(argv) {
1404
1425
 
1405
1426
  // src/runtime-bridge.ts
1406
1427
  import {
1407
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
1408
- createCliDiagnosticCodeError as createCliDiagnosticCodeError4
1428
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
1429
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError5
1409
1430
  } from "@wp-typia/project-tools/cli-diagnostics";
1410
1431
 
1411
1432
  // src/runtime-bridge-add-dry-run.ts
@@ -1870,20 +1891,6 @@ function printBlock(lines, printLine) {
1870
1891
  printLine(line);
1871
1892
  }
1872
1893
  }
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
1894
 
1888
1895
  // src/runtime-capabilities.ts
1889
1896
  function isInteractiveTerminal({
@@ -1898,8 +1905,8 @@ import { spawnSync } from "node:child_process";
1898
1905
  import fs4 from "node:fs";
1899
1906
  import path4 from "node:path";
1900
1907
  import {
1901
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
1902
- createCliDiagnosticCodeError as createCliDiagnosticCodeError3
1908
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
1909
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError4
1903
1910
  } from "@wp-typia/project-tools/cli-diagnostics";
1904
1911
  var SYNC_INSTALL_MARKERS = [
1905
1912
  "node_modules",
@@ -1915,7 +1922,7 @@ function resolveSyncExecutionTarget(subcommand) {
1915
1922
  if (subcommand === "ai") {
1916
1923
  return "ai";
1917
1924
  }
1918
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
1925
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
1919
1926
  }
1920
1927
  function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
1921
1928
  const args = extraArgs.trim();
@@ -1943,7 +1950,7 @@ function formatInstallCommand(packageManagerId) {
1943
1950
  }
1944
1951
  }
1945
1952
  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.`);
1953
+ return createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.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
1954
  }
1948
1955
  function inferSyncPackageManager(cwd, packageManagerField) {
1949
1956
  const field = String(packageManagerField ?? "");
@@ -2033,7 +2040,7 @@ function assertSyncDependenciesInstalled(project, target) {
2033
2040
  if (markerDir) {
2034
2041
  return;
2035
2042
  }
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\`.`);
2043
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.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
2044
  }
2038
2045
  function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
2039
2046
  switch (packageManager) {
@@ -2071,7 +2078,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
2071
2078
  if (target === "ai") {
2072
2079
  const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2073
2080
  if (!syncAiCommand2) {
2074
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2081
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2075
2082
  }
2076
2083
  return [syncAiCommand2];
2077
2084
  }
@@ -2080,7 +2087,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
2080
2087
  }
2081
2088
  const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
2082
2089
  if (!syncTypesCommand) {
2083
- throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES3.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2090
+ throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2084
2091
  }
2085
2092
  const plannedCommands = [syncTypesCommand];
2086
2093
  const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
@@ -2166,17 +2173,6 @@ function shouldWrapCliCommandError(options) {
2166
2173
  }
2167
2174
  return true;
2168
2175
  }
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
2176
  function pushFlag(argv, name, value) {
2181
2177
  if (value === undefined || value === null || value === false) {
2182
2178
  return;
@@ -2318,7 +2314,7 @@ async function executeCreateCommand({
2318
2314
  promptText: activePrompt ? (message, defaultValue, validate) => activePrompt.text(message, defaultValue, validate) : undefined,
2319
2315
  queryPostType: readOptionalLooseStringFlag(flags, "query-post-type"),
2320
2316
  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,
2317
+ selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
2322
2318
  selectPackageManager: activePrompt ? () => activePrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
2323
2319
  selectPersistencePolicy: activePrompt ? () => activePrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
2324
2320
  selectTemplate: activePrompt ? () => activePrompt.select("Select a template", getTemplateSelectOptions(), 1) : undefined,
@@ -2371,13 +2367,13 @@ async function executeAddCommand({
2371
2367
  if (emitOutput) {
2372
2368
  printLine(addRuntime.formatAddHelpText());
2373
2369
  }
2374
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
2370
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
2375
2371
  }
2376
2372
  if (!isAddKindId(kind)) {
2377
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2373
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2378
2374
  }
2379
2375
  if (dryRun && !supportsAddKindDryRun(kind)) {
2380
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2376
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2381
2377
  }
2382
2378
  const executionContext = {
2383
2379
  addRuntime,
@@ -2429,16 +2425,16 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
2429
2425
  }
2430
2426
  if (subcommand === "inspect") {
2431
2427
  if (!flags.id) {
2432
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2428
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2433
2429
  }
2434
2430
  const template = getTemplateById(flags.id);
2435
2431
  if (!template) {
2436
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2432
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2437
2433
  }
2438
2434
  printBlock([formatTemplateDetails(template)], printLine);
2439
2435
  return;
2440
2436
  }
2441
- throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2437
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2442
2438
  }
2443
2439
  async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
2444
2440
  try {
@@ -2823,7 +2819,7 @@ function parseGlobalFlags(argv) {
2823
2819
  };
2824
2820
  } catch (error) {
2825
2821
  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);
2822
+ throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, error.message);
2827
2823
  }
2828
2824
  throw error;
2829
2825
  }
@@ -2987,7 +2983,7 @@ function renderTemplatesJson(flags, subcommand) {
2987
2983
  const templateId = flags.id;
2988
2984
  if (!templateId) {
2989
2985
  throw createCliCommandError2({
2990
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
2986
+ code: CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT,
2991
2987
  command: "templates",
2992
2988
  detailLines: ["`wp-typia templates inspect` requires <template-id>."]
2993
2989
  });
@@ -2995,7 +2991,7 @@ function renderTemplatesJson(flags, subcommand) {
2995
2991
  const template = getTemplateById(templateId);
2996
2992
  if (!template) {
2997
2993
  throw createCliCommandError2({
2998
- code: CLI_DIAGNOSTIC_CODES5.INVALID_ARGUMENT,
2994
+ code: CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT,
2999
2995
  command: "templates",
3000
2996
  detailLines: [`Unknown template "${templateId}".`]
3001
2997
  });
@@ -3006,7 +3002,7 @@ function renderTemplatesJson(flags, subcommand) {
3006
3002
  }
3007
3003
  function renderUnsupportedCommand(command) {
3008
3004
  throw createCliCommandError2({
3009
- code: CLI_DIAGNOSTIC_CODES5.UNSUPPORTED_COMMAND,
3005
+ code: CLI_DIAGNOSTIC_CODES6.UNSUPPORTED_COMMAND,
3010
3006
  command,
3011
3007
  detailLines: [
3012
3008
  [
@@ -3032,7 +3028,7 @@ async function renderDoctorJson() {
3032
3028
  }, null, 2));
3033
3029
  if (checks.some((check) => check.status === "fail")) {
3034
3030
  throw createCliCommandError3({
3035
- code: CLI_DIAGNOSTIC_CODES5.DOCTOR_CHECK_FAILED,
3031
+ code: CLI_DIAGNOSTIC_CODES6.DOCTOR_CHECK_FAILED,
3036
3032
  command: "doctor",
3037
3033
  detailLines: getDoctorFailureDetailLines(checks),
3038
3034
  summary: "One or more doctor checks failed."
@@ -3049,7 +3045,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3049
3045
  const { formatAddHelpText } = await import("@wp-typia/project-tools/cli-add");
3050
3046
  printLine(formatAddHelpText());
3051
3047
  throw createCliCommandError2({
3052
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
3048
+ code: CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT,
3053
3049
  command: "add",
3054
3050
  detailLines: [
3055
3051
  `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`
@@ -3097,7 +3093,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3097
3093
  const projectDir = positionals[1];
3098
3094
  if (!projectDir) {
3099
3095
  throw createCliCommandError2({
3100
- code: CLI_DIAGNOSTIC_CODES5.MISSING_ARGUMENT,
3096
+ code: CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT,
3101
3097
  command: "create",
3102
3098
  detailLines: [
3103
3099
  "`wp-typia create` requires <project-dir>.",
@@ -3208,7 +3204,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3208
3204
  const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
3209
3205
  if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
3210
3206
  throw createCliCommandError2({
3211
- code: CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND,
3207
+ code: CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND,
3212
3208
  command: "templates",
3213
3209
  detailLines: [
3214
3210
  `Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
@@ -3240,9 +3236,14 @@ async function runNodeCli(argv = process.argv.slice(2)) {
3240
3236
  ...flags
3241
3237
  };
3242
3238
  const [command, subcommand] = positionals;
3243
- const helpRequested = cliArgv.length === 0 || hasFlagBeforeTerminator(cliArgv, "--help") || command === "help";
3239
+ const helpRequested = hasFlagBeforeTerminator(cliArgv, "--help") || command === "help";
3244
3240
  const helpTarget = command === "help" ? subcommand : command;
3245
3241
  const versionRequested = hasFlagBeforeTerminator(cliArgv, "--version") || command === "version";
3242
+ if (cliArgv.length === 0) {
3243
+ renderGeneralHelp();
3244
+ process.exitCode = 1;
3245
+ return;
3246
+ }
3246
3247
  if (helpRequested) {
3247
3248
  if (helpTarget) {
3248
3249
  const helpRenderer = NODE_FALLBACK_HELP_RENDERERS[helpTarget];
@@ -3304,4 +3305,4 @@ export {
3304
3305
  hasFlagBeforeTerminator
3305
3306
  };
3306
3307
 
3307
- //# debugId=F8B7C97D684FB07764756E2164756E21
3308
+ //# debugId=2746E868E408BAB564756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-typia",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
4
4
  "description": "Canonical CLI package for wp-typia scaffolding and project workflows",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -70,7 +70,7 @@
70
70
  "@bunli/tui": "0.6.0",
71
71
  "@bunli/utils": "0.6.0",
72
72
  "@wp-typia/api-client": "^0.4.5",
73
- "@wp-typia/project-tools": "0.22.2",
73
+ "@wp-typia/project-tools": "0.22.3",
74
74
  "better-result": "^2.7.0",
75
75
  "react": "^19.2.5",
76
76
  "react-dom": "^19.2.5",