wp-typia 0.22.9 → 0.22.10

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.9",
6
+ version: "0.22.10",
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.9",
76
+ "@wp-typia/project-tools": "0.22.10",
77
77
  "better-result": "^2.7.0",
78
78
  react: "^19.2.5",
79
79
  "react-dom": "^19.2.5",
@@ -97,7 +97,7 @@ var package_default = {
97
97
 
98
98
  // src/node-cli.ts
99
99
  import {
100
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
100
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
101
101
  createCliCommandError as createCliCommandError5,
102
102
  formatCliDiagnosticError,
103
103
  serializeCliDiagnosticError as serializeCliDiagnosticError2
@@ -109,6 +109,84 @@ import {
109
109
  CLI_DIAGNOSTIC_CODES,
110
110
  createCliDiagnosticCodeError
111
111
  } from "@wp-typia/project-tools/cli-diagnostics";
112
+
113
+ // src/command-options/add.ts
114
+ var ADD_OPTION_METADATA = {
115
+ "alternate-render-targets": {
116
+ description: "Comma-separated alternate render targets for dynamic block scaffolds (email,mjml,plain-text).",
117
+ type: "string"
118
+ },
119
+ anchor: {
120
+ description: "Anchor block name for hooked-block workflows.",
121
+ type: "string"
122
+ },
123
+ attribute: {
124
+ description: "Target block attribute for end-to-end binding-source workflows.",
125
+ type: "string"
126
+ },
127
+ block: {
128
+ description: "Target block slug for variation, style, and end-to-end binding-source workflows.",
129
+ type: "string"
130
+ },
131
+ "data-storage": {
132
+ description: "Persistence storage mode for persistence-capable templates.",
133
+ type: "string"
134
+ },
135
+ "dry-run": {
136
+ argumentKind: "flag",
137
+ description: "Preview workspace file updates and completion guidance without writing them.",
138
+ type: "boolean"
139
+ },
140
+ "external-layer-id": {
141
+ description: "Explicit layer id when an external layer package exposes multiple selectable layers.",
142
+ type: "string"
143
+ },
144
+ "external-layer-source": {
145
+ description: "Local path, GitHub locator, or npm package that exposes wp-typia.layers.json for built-in block templates.",
146
+ type: "string"
147
+ },
148
+ from: {
149
+ description: "Source full block name (namespace/block) for transform workflows.",
150
+ type: "string"
151
+ },
152
+ "inner-blocks-preset": {
153
+ description: "Compound-only InnerBlocks preset (freeform, ordered, horizontal, locked-structure).",
154
+ type: "string"
155
+ },
156
+ methods: {
157
+ description: "Comma-separated REST resource methods for rest-resource workflows.",
158
+ type: "string"
159
+ },
160
+ namespace: {
161
+ description: "REST namespace for rest-resource and ai-feature workflows.",
162
+ type: "string"
163
+ },
164
+ "persistence-policy": {
165
+ description: "Persistence write policy for persistence-capable templates.",
166
+ type: "string"
167
+ },
168
+ position: {
169
+ description: "Hook position for hooked-block workflows.",
170
+ type: "string"
171
+ },
172
+ slot: {
173
+ description: "Document editor shell slot for editor-plugin workflows (sidebar or document-setting-panel).",
174
+ type: "string"
175
+ },
176
+ source: {
177
+ description: "Optional data source locator for admin-view workflows, such as rest-resource:products or core-data:postType/post.",
178
+ type: "string"
179
+ },
180
+ template: {
181
+ description: "Optional built-in block family for the new block; interactive flows let you choose it when omitted and non-interactive runs default to basic.",
182
+ type: "string"
183
+ },
184
+ to: {
185
+ description: "Target workspace block slug or full block name for transform workflows.",
186
+ type: "string"
187
+ }
188
+ };
189
+ // src/command-options/create.ts
112
190
  var CREATE_OPTION_METADATA = {
113
191
  "alternate-render-targets": {
114
192
  description: "Comma-separated alternate render targets for dynamic block scaffolds (email,mjml,plain-text).",
@@ -196,81 +274,30 @@ var CREATE_OPTION_METADATA = {
196
274
  type: "boolean"
197
275
  }
198
276
  };
199
- var ADD_OPTION_METADATA = {
200
- "alternate-render-targets": {
201
- description: "Comma-separated alternate render targets for dynamic block scaffolds (email,mjml,plain-text).",
202
- type: "string"
203
- },
204
- anchor: {
205
- description: "Anchor block name for hooked-block workflows.",
206
- type: "string"
207
- },
208
- attribute: {
209
- description: "Target block attribute for end-to-end binding-source workflows.",
210
- type: "string"
211
- },
212
- block: {
213
- description: "Target block slug for variation, style, and end-to-end binding-source workflows.",
214
- type: "string"
215
- },
216
- "data-storage": {
217
- description: "Persistence storage mode for persistence-capable templates.",
218
- type: "string"
219
- },
220
- "dry-run": {
221
- argumentKind: "flag",
222
- description: "Preview workspace file updates and completion guidance without writing them.",
223
- type: "boolean"
224
- },
225
- "external-layer-id": {
226
- description: "Explicit layer id when an external layer package exposes multiple selectable layers.",
227
- type: "string"
228
- },
229
- "external-layer-source": {
230
- description: "Local path, GitHub locator, or npm package that exposes wp-typia.layers.json for built-in block templates.",
231
- type: "string"
232
- },
233
- from: {
234
- description: "Source full block name (namespace/block) for transform workflows.",
235
- type: "string"
236
- },
237
- "inner-blocks-preset": {
238
- description: "Compound-only InnerBlocks preset (freeform, ordered, horizontal, locked-structure).",
239
- type: "string"
240
- },
241
- methods: {
242
- description: "Comma-separated REST resource methods for rest-resource workflows.",
243
- type: "string"
244
- },
245
- namespace: {
246
- description: "REST namespace for rest-resource and ai-feature workflows.",
247
- type: "string"
248
- },
249
- "persistence-policy": {
250
- description: "Persistence write policy for persistence-capable templates.",
251
- type: "string"
252
- },
253
- position: {
254
- description: "Hook position for hooked-block workflows.",
255
- type: "string"
256
- },
257
- slot: {
258
- description: "Document editor shell slot for editor-plugin workflows (sidebar or document-setting-panel).",
277
+ // src/command-options/doctor.ts
278
+ var DOCTOR_OPTION_METADATA = {
279
+ format: {
280
+ description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
259
281
  type: "string"
260
- },
261
- source: {
262
- description: "Optional data source locator for admin-view workflows, such as rest-resource:products or core-data:postType/post.",
282
+ }
283
+ };
284
+ // src/command-options/global.ts
285
+ var GLOBAL_OPTION_METADATA = {
286
+ config: {
287
+ description: "Config override file path.",
288
+ short: "c",
263
289
  type: "string"
264
290
  },
265
- template: {
266
- description: "Optional built-in block family for the new block; interactive flows let you choose it when omitted and non-interactive runs default to basic.",
291
+ format: {
292
+ description: "Output format for supported commands (`json` or `text`).",
267
293
  type: "string"
268
294
  },
269
- to: {
270
- description: "Target workspace block slug or full block name for transform workflows.",
295
+ id: {
296
+ description: "Template id for top-level `templates inspect` convenience.",
271
297
  type: "string"
272
298
  }
273
299
  };
300
+ // src/command-options/init.ts
274
301
  var INIT_OPTION_METADATA = {
275
302
  apply: {
276
303
  argumentKind: "flag",
@@ -283,6 +310,14 @@ var INIT_OPTION_METADATA = {
283
310
  type: "string"
284
311
  }
285
312
  };
313
+ // src/command-options/mcp.ts
314
+ var MCP_OPTION_METADATA = {
315
+ "output-dir": {
316
+ description: "Output directory for generated MCP metadata.",
317
+ type: "string"
318
+ }
319
+ };
320
+ // src/command-options/migrate.ts
286
321
  var MIGRATE_OPTION_METADATA = {
287
322
  all: {
288
323
  argumentKind: "flag",
@@ -319,12 +354,7 @@ var MIGRATE_OPTION_METADATA = {
319
354
  type: "string"
320
355
  }
321
356
  };
322
- var MCP_OPTION_METADATA = {
323
- "output-dir": {
324
- description: "Output directory for generated MCP metadata.",
325
- type: "string"
326
- }
327
- };
357
+ // src/command-options/sync.ts
328
358
  var SYNC_OPTION_METADATA = {
329
359
  check: {
330
360
  argumentKind: "flag",
@@ -337,33 +367,14 @@ var SYNC_OPTION_METADATA = {
337
367
  type: "boolean"
338
368
  }
339
369
  };
340
- var DOCTOR_OPTION_METADATA = {
341
- format: {
342
- description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
343
- type: "string"
344
- }
345
- };
370
+ // src/command-options/templates.ts
346
371
  var TEMPLATES_OPTION_METADATA = {
347
372
  id: {
348
373
  description: "Template id for `templates inspect`.",
349
374
  type: "string"
350
375
  }
351
376
  };
352
- var GLOBAL_OPTION_METADATA = {
353
- config: {
354
- description: "Config override file path.",
355
- short: "c",
356
- type: "string"
357
- },
358
- format: {
359
- description: "Output format for supported commands (`json` or `text`).",
360
- type: "string"
361
- },
362
- id: {
363
- description: "Template id for top-level `templates inspect` convenience.",
364
- type: "string"
365
- }
366
- };
377
+ // src/command-option-metadata.ts
367
378
  var COMMAND_OPTION_METADATA_BY_GROUP = {
368
379
  add: ADD_OPTION_METADATA,
369
380
  create: CREATE_OPTION_METADATA,
@@ -927,14 +938,21 @@ function extractWpTypiaConfigOverride(argv) {
927
938
  };
928
939
  }
929
940
 
930
- // src/runtime-bridge.ts
941
+ // src/runtime-bridge-add.ts
931
942
  import {
932
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
933
- createCliDiagnosticCodeError as createCliDiagnosticCodeError7
943
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
944
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError6
934
945
  } from "@wp-typia/project-tools/cli-diagnostics";
935
946
 
936
947
  // src/add-kind-ids.ts
937
948
  import { ADD_KIND_IDS } from "@wp-typia/project-tools/cli-add-kind-ids";
949
+ import { ADD_KIND_IDS as ADD_KIND_IDS2 } from "@wp-typia/project-tools/cli-add-kind-ids";
950
+ function formatAddKindList() {
951
+ return ADD_KIND_IDS.join(", ");
952
+ }
953
+ function formatAddKindUsagePlaceholder() {
954
+ return `<${ADD_KIND_IDS.join("|")}>`;
955
+ }
938
956
 
939
957
  // src/add-kind-registry-shared.ts
940
958
  import {
@@ -1044,6 +1062,7 @@ function assertAddBlockTemplateId(context, templateId) {
1044
1062
  }
1045
1063
 
1046
1064
  // src/add-kinds/ability.ts
1065
+ var ABILITY_MISSING_NAME_MESSAGE = "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.";
1047
1066
  var abilityAddKindEntry = defineAddKindRegistryEntry({
1048
1067
  completion: {
1049
1068
  nextSteps: (values) => [
@@ -1068,7 +1087,7 @@ var abilityAddKindEntry = defineAddKindRegistryEntry({
1068
1087
  abilitySlug: result.abilitySlug
1069
1088
  }),
1070
1089
  getWarnings: (result) => result.warnings,
1071
- missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.",
1090
+ missingNameMessage: ABILITY_MISSING_NAME_MESSAGE,
1072
1091
  warnLine: context.warnLine
1073
1092
  });
1074
1093
  },
@@ -1123,6 +1142,7 @@ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message
1123
1142
  }
1124
1143
 
1125
1144
  // src/add-kinds/admin-view.ts
1145
+ var ADMIN_VIEW_MISSING_NAME_MESSAGE = "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].";
1126
1146
  var adminViewAddKindEntry = defineAddKindRegistryEntry({
1127
1147
  completion: {
1128
1148
  nextSteps: (values) => [
@@ -1139,7 +1159,7 @@ var adminViewAddKindEntry = defineAddKindRegistryEntry({
1139
1159
  description: "Add an opt-in DataViews-powered admin screen",
1140
1160
  nameLabel: "Admin view name",
1141
1161
  async prepareExecution(context) {
1142
- 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>].");
1162
+ const name = requireAddKindName(context, ADMIN_VIEW_MISSING_NAME_MESSAGE);
1143
1163
  const source = readOptionalStrictStringFlag(context.flags, "source");
1144
1164
  return createNamedExecutionPlan(context, {
1145
1165
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
@@ -1151,7 +1171,7 @@ var adminViewAddKindEntry = defineAddKindRegistryEntry({
1151
1171
  adminViewSlug: result.adminViewSlug,
1152
1172
  ...result.source ? { source: result.source } : {}
1153
1173
  }),
1154
- missingNameMessage: "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].",
1174
+ missingNameMessage: ADMIN_VIEW_MISSING_NAME_MESSAGE,
1155
1175
  name
1156
1176
  });
1157
1177
  },
@@ -1162,6 +1182,7 @@ var adminViewAddKindEntry = defineAddKindRegistryEntry({
1162
1182
  });
1163
1183
 
1164
1184
  // src/add-kinds/ai-feature.ts
1185
+ var AI_FEATURE_MISSING_NAME_MESSAGE = "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].";
1165
1186
  var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
1166
1187
  completion: {
1167
1188
  nextSteps: (values) => [
@@ -1178,7 +1199,7 @@ var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
1178
1199
  description: "Add a server-owned WordPress AI feature endpoint",
1179
1200
  nameLabel: "AI feature name",
1180
1201
  async prepareExecution(context) {
1181
- const name = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
1202
+ const name = requireAddKindName(context, AI_FEATURE_MISSING_NAME_MESSAGE);
1182
1203
  const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1183
1204
  return createNamedExecutionPlan(context, {
1184
1205
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
@@ -1191,7 +1212,7 @@ var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
1191
1212
  namespace: result.namespace
1192
1213
  }),
1193
1214
  getWarnings: (result) => result.warnings,
1194
- missingNameMessage: "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].",
1215
+ missingNameMessage: AI_FEATURE_MISSING_NAME_MESSAGE,
1195
1216
  name,
1196
1217
  warnLine: context.warnLine
1197
1218
  });
@@ -1203,6 +1224,7 @@ var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
1203
1224
  });
1204
1225
 
1205
1226
  // src/add-kinds/binding-source.ts
1227
+ var BINDING_SOURCE_MISSING_NAME_MESSAGE = "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].";
1206
1228
  var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
1207
1229
  completion: {
1208
1230
  nextSteps: (values) => [
@@ -1222,7 +1244,7 @@ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
1222
1244
  description: "Add a shared block bindings source",
1223
1245
  nameLabel: "Binding source name",
1224
1246
  async prepareExecution(context) {
1225
- 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>].");
1247
+ const name = requireAddKindName(context, BINDING_SOURCE_MISSING_NAME_MESSAGE);
1226
1248
  const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
1227
1249
  return createNamedExecutionPlan(context, {
1228
1250
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
@@ -1236,7 +1258,7 @@ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
1236
1258
  ...result.blockSlug ? { blockSlug: result.blockSlug } : {},
1237
1259
  bindingSourceSlug: result.bindingSourceSlug
1238
1260
  }),
1239
- missingNameMessage: "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].",
1261
+ missingNameMessage: BINDING_SOURCE_MISSING_NAME_MESSAGE,
1240
1262
  name
1241
1263
  });
1242
1264
  },
@@ -1263,6 +1285,7 @@ function toExternalLayerPromptOptions(options) {
1263
1285
  }
1264
1286
 
1265
1287
  // src/add-kinds/block.ts
1288
+ var BLOCK_MISSING_NAME_MESSAGE = "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]";
1266
1289
  var blockAddKindEntry = defineAddKindRegistryEntry({
1267
1290
  completion: {
1268
1291
  nextSteps: () => [
@@ -1280,7 +1303,7 @@ var blockAddKindEntry = defineAddKindRegistryEntry({
1280
1303
  hiddenStringSubmitFields: ["external-layer-id", "external-layer-source"],
1281
1304
  nameLabel: "Block name",
1282
1305
  async prepareExecution(context) {
1283
- const name = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
1306
+ const name = requireAddKindName(context, BLOCK_MISSING_NAME_MESSAGE);
1284
1307
  const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
1285
1308
  const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
1286
1309
  const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
@@ -1318,7 +1341,7 @@ var blockAddKindEntry = defineAddKindRegistryEntry({
1318
1341
  templateId: result.templateId
1319
1342
  }),
1320
1343
  getWarnings: (result) => result.warnings,
1321
- missingNameMessage: "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]",
1344
+ missingNameMessage: BLOCK_MISSING_NAME_MESSAGE,
1322
1345
  name,
1323
1346
  warnLine: context.warnLine
1324
1347
  });
@@ -1341,6 +1364,7 @@ var blockAddKindEntry = defineAddKindRegistryEntry({
1341
1364
  });
1342
1365
 
1343
1366
  // src/add-kinds/editor-plugin.ts
1367
+ var EDITOR_PLUGIN_MISSING_NAME_MESSAGE = "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].";
1344
1368
  var editorPluginAddKindEntry = defineAddKindRegistryEntry({
1345
1369
  completion: {
1346
1370
  nextSteps: (values) => [
@@ -1357,7 +1381,7 @@ var editorPluginAddKindEntry = defineAddKindRegistryEntry({
1357
1381
  description: "Add a slot-aware document editor extension shell",
1358
1382
  nameLabel: "Editor plugin name",
1359
1383
  async prepareExecution(context) {
1360
- const name = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
1384
+ const name = requireAddKindName(context, EDITOR_PLUGIN_MISSING_NAME_MESSAGE);
1361
1385
  const slot = readOptionalStrictStringFlag(context.flags, "slot");
1362
1386
  return createNamedExecutionPlan(context, {
1363
1387
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
@@ -1369,7 +1393,7 @@ var editorPluginAddKindEntry = defineAddKindRegistryEntry({
1369
1393
  editorPluginSlug: result.editorPluginSlug,
1370
1394
  slot: result.slot
1371
1395
  }),
1372
- missingNameMessage: "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].",
1396
+ missingNameMessage: EDITOR_PLUGIN_MISSING_NAME_MESSAGE,
1373
1397
  name
1374
1398
  });
1375
1399
  },
@@ -1380,6 +1404,7 @@ var editorPluginAddKindEntry = defineAddKindRegistryEntry({
1380
1404
  });
1381
1405
 
1382
1406
  // src/add-kinds/hooked-block.ts
1407
+ var HOOKED_BLOCK_MISSING_NAME_MESSAGE = "`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>.";
1383
1408
  var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
1384
1409
  completion: {
1385
1410
  nextSteps: (values) => [
@@ -1397,7 +1422,7 @@ var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
1397
1422
  description: "Add block.json hook metadata to an existing block",
1398
1423
  nameLabel: "Target block",
1399
1424
  async prepareExecution(context) {
1400
- 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>.");
1425
+ const name = requireAddKindName(context, HOOKED_BLOCK_MISSING_NAME_MESSAGE);
1401
1426
  const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
1402
1427
  const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
1403
1428
  return createNamedExecutionPlan(context, {
@@ -1412,7 +1437,7 @@ var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
1412
1437
  blockSlug: result.blockSlug,
1413
1438
  position: result.position
1414
1439
  }),
1415
- missingNameMessage: "`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>.",
1440
+ missingNameMessage: HOOKED_BLOCK_MISSING_NAME_MESSAGE,
1416
1441
  name
1417
1442
  });
1418
1443
  },
@@ -1423,6 +1448,7 @@ var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
1423
1448
  });
1424
1449
 
1425
1450
  // src/add-kinds/pattern.ts
1451
+ var PATTERN_MISSING_NAME_MESSAGE = "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>.";
1426
1452
  var patternAddKindEntry = defineAddKindRegistryEntry({
1427
1453
  completion: {
1428
1454
  nextSteps: (values) => [
@@ -1446,7 +1472,8 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
1446
1472
  getValues: (result) => ({
1447
1473
  patternSlug: result.patternSlug
1448
1474
  }),
1449
- missingNameMessage: "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>."
1475
+ missingNameMessage: PATTERN_MISSING_NAME_MESSAGE,
1476
+ warnLine: context.warnLine
1450
1477
  });
1451
1478
  },
1452
1479
  sortOrder: 60,
@@ -1456,6 +1483,7 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
1456
1483
  });
1457
1484
 
1458
1485
  // src/add-kinds/rest-resource.ts
1486
+ var REST_RESOURCE_MISSING_NAME_MESSAGE = "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>].";
1459
1487
  var restResourceAddKindEntry = defineAddKindRegistryEntry({
1460
1488
  completion: {
1461
1489
  nextSteps: (values) => [
@@ -1473,7 +1501,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
1473
1501
  description: "Add a plugin-level typed REST resource",
1474
1502
  nameLabel: "REST resource name",
1475
1503
  async prepareExecution(context) {
1476
- 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,update,delete>].");
1504
+ const name = requireAddKindName(context, REST_RESOURCE_MISSING_NAME_MESSAGE);
1477
1505
  const methods = readOptionalStrictStringFlag(context.flags, "methods");
1478
1506
  const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
1479
1507
  return createNamedExecutionPlan(context, {
@@ -1488,7 +1516,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
1488
1516
  namespace: result.namespace,
1489
1517
  restResourceSlug: result.restResourceSlug
1490
1518
  }),
1491
- missingNameMessage: "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>].",
1519
+ missingNameMessage: REST_RESOURCE_MISSING_NAME_MESSAGE,
1492
1520
  name
1493
1521
  });
1494
1522
  },
@@ -1499,6 +1527,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
1499
1527
  });
1500
1528
 
1501
1529
  // src/add-kinds/style.ts
1530
+ var STYLE_MISSING_NAME_MESSAGE = "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.";
1502
1531
  var styleAddKindEntry = defineAddKindRegistryEntry({
1503
1532
  completion: {
1504
1533
  nextSteps: (values) => [
@@ -1515,7 +1544,7 @@ var styleAddKindEntry = defineAddKindRegistryEntry({
1515
1544
  description: "Add a Block Styles registration to an existing block",
1516
1545
  nameLabel: "Style name",
1517
1546
  async prepareExecution(context) {
1518
- const name = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
1547
+ const name = requireAddKindName(context, STYLE_MISSING_NAME_MESSAGE);
1519
1548
  const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
1520
1549
  return createNamedExecutionPlan(context, {
1521
1550
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
@@ -1527,7 +1556,7 @@ var styleAddKindEntry = defineAddKindRegistryEntry({
1527
1556
  blockSlug: result.blockSlug,
1528
1557
  styleSlug: result.styleSlug
1529
1558
  }),
1530
- missingNameMessage: "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.",
1559
+ missingNameMessage: STYLE_MISSING_NAME_MESSAGE,
1531
1560
  name
1532
1561
  });
1533
1562
  },
@@ -1538,6 +1567,7 @@ var styleAddKindEntry = defineAddKindRegistryEntry({
1538
1567
  });
1539
1568
 
1540
1569
  // src/add-kinds/transform.ts
1570
+ var TRANSFORM_MISSING_NAME_MESSAGE = "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.";
1541
1571
  var transformAddKindEntry = defineAddKindRegistryEntry({
1542
1572
  completion: {
1543
1573
  nextSteps: (values) => [
@@ -1555,7 +1585,7 @@ var transformAddKindEntry = defineAddKindRegistryEntry({
1555
1585
  description: "Add a block-to-block transform into a workspace block",
1556
1586
  nameLabel: "Transform name",
1557
1587
  async prepareExecution(context) {
1558
- 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>.");
1588
+ const name = requireAddKindName(context, TRANSFORM_MISSING_NAME_MESSAGE);
1559
1589
  const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
1560
1590
  const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
1561
1591
  return createNamedExecutionPlan(context, {
@@ -1571,7 +1601,7 @@ var transformAddKindEntry = defineAddKindRegistryEntry({
1571
1601
  toBlockName: result.toBlockName,
1572
1602
  transformSlug: result.transformSlug
1573
1603
  }),
1574
- missingNameMessage: "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.",
1604
+ missingNameMessage: TRANSFORM_MISSING_NAME_MESSAGE,
1575
1605
  name
1576
1606
  });
1577
1607
  },
@@ -1582,6 +1612,7 @@ var transformAddKindEntry = defineAddKindRegistryEntry({
1582
1612
  });
1583
1613
 
1584
1614
  // src/add-kinds/variation.ts
1615
+ var VARIATION_MISSING_NAME_MESSAGE = "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>";
1585
1616
  var variationAddKindEntry = defineAddKindRegistryEntry({
1586
1617
  completion: {
1587
1618
  nextSteps: (values) => [
@@ -1598,7 +1629,7 @@ var variationAddKindEntry = defineAddKindRegistryEntry({
1598
1629
  description: "Add a variation to an existing block",
1599
1630
  nameLabel: "Variation name",
1600
1631
  async prepareExecution(context) {
1601
- const name = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
1632
+ const name = requireAddKindName(context, VARIATION_MISSING_NAME_MESSAGE);
1602
1633
  const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
1603
1634
  return createNamedExecutionPlan(context, {
1604
1635
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
@@ -1610,7 +1641,7 @@ var variationAddKindEntry = defineAddKindRegistryEntry({
1610
1641
  blockSlug: result.blockSlug,
1611
1642
  variationSlug: result.variationSlug
1612
1643
  }),
1613
- missingNameMessage: "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>",
1644
+ missingNameMessage: VARIATION_MISSING_NAME_MESSAGE,
1614
1645
  name
1615
1646
  });
1616
1647
  },
@@ -1636,7 +1667,7 @@ var ADD_KIND_REGISTRY = {
1636
1667
  "editor-plugin": editorPluginAddKindEntry
1637
1668
  };
1638
1669
  function isAddKindId(value) {
1639
- return typeof value === "string" && ADD_KIND_IDS.includes(value);
1670
+ return typeof value === "string" && ADD_KIND_IDS2.includes(value);
1640
1671
  }
1641
1672
  async function getAddKindExecutionPlan(kind, context) {
1642
1673
  return ADD_KIND_REGISTRY[kind].prepareExecution(context);
@@ -1649,12 +1680,6 @@ function buildAddKindCompletionDetails(kind, options) {
1649
1680
  title: descriptor.title
1650
1681
  };
1651
1682
  }
1652
- function formatAddKindList() {
1653
- return ADD_KIND_IDS.join(", ");
1654
- }
1655
- function formatAddKindUsagePlaceholder() {
1656
- return `<${ADD_KIND_IDS.join("|")}>`;
1657
- }
1658
1683
  function supportsAddKindDryRun(kind) {
1659
1684
  return ADD_KIND_REGISTRY[kind].supportsDryRun;
1660
1685
  }
@@ -1705,6 +1730,55 @@ async function copyWorkspaceProject(sourceDir, targetDir) {
1705
1730
  recursive: true
1706
1731
  });
1707
1732
  }
1733
+ function formatInstallMarkerError(error) {
1734
+ if (error instanceof Error) {
1735
+ return error.message;
1736
+ }
1737
+ return String(error);
1738
+ }
1739
+ function formatInstallMarkerFailures(failures) {
1740
+ return failures.map((failure) => `${failure.operation}: ${failure.reason}`).join("; ");
1741
+ }
1742
+ function ensureWorkspaceInstallMarker({
1743
+ fsAdapter = fs2,
1744
+ sourceMarker,
1745
+ targetMarker
1746
+ }) {
1747
+ const failures = [];
1748
+ try {
1749
+ fsAdapter.symlinkSync(sourceMarker, targetMarker);
1750
+ return;
1751
+ } catch (error) {
1752
+ failures.push({
1753
+ operation: "symlink",
1754
+ reason: formatInstallMarkerError(error)
1755
+ });
1756
+ }
1757
+ try {
1758
+ fsAdapter.linkSync(sourceMarker, targetMarker);
1759
+ return;
1760
+ } catch (error) {
1761
+ failures.push({
1762
+ operation: "hard link",
1763
+ reason: formatInstallMarkerError(error)
1764
+ });
1765
+ }
1766
+ try {
1767
+ fsAdapter.copyFileSync(sourceMarker, targetMarker);
1768
+ return;
1769
+ } catch (error) {
1770
+ failures.push({
1771
+ operation: "copy",
1772
+ reason: formatInstallMarkerError(error)
1773
+ });
1774
+ }
1775
+ throw new Error([
1776
+ "Failed to prepare dry-run install marker.",
1777
+ `Source: ${sourceMarker}`,
1778
+ `Target: ${targetMarker}`,
1779
+ `Fallback failures: ${formatInstallMarkerFailures(failures)}`
1780
+ ].join(" "));
1781
+ }
1708
1782
  function ensureWorkspaceInstallMarkers(sourceDir, targetDir) {
1709
1783
  const sourceNodeModules = path2.join(sourceDir, "node_modules");
1710
1784
  if (fs2.existsSync(sourceNodeModules)) {
@@ -1716,15 +1790,7 @@ function ensureWorkspaceInstallMarkers(sourceDir, targetDir) {
1716
1790
  continue;
1717
1791
  }
1718
1792
  const targetMarker = path2.join(targetDir, marker);
1719
- try {
1720
- fs2.symlinkSync(sourceMarker, targetMarker);
1721
- } catch {
1722
- try {
1723
- fs2.linkSync(sourceMarker, targetMarker);
1724
- } catch {
1725
- fs2.copyFileSync(sourceMarker, targetMarker);
1726
- }
1727
- }
1793
+ ensureWorkspaceInstallMarker({ sourceMarker, targetMarker });
1728
1794
  }
1729
1795
  }
1730
1796
  async function listWorkspaceFiles(rootDir) {
@@ -1807,18 +1873,6 @@ async function simulateWorkspaceAddDryRun({
1807
1873
  }
1808
1874
  }
1809
1875
 
1810
- // src/runtime-bridge-output.ts
1811
- import {
1812
- PACKAGE_MANAGER_IDS,
1813
- formatPackageExecCommand,
1814
- inferPackageManagerId,
1815
- parsePackageManagerField
1816
- } from "@wp-typia/project-tools/package-managers";
1817
- import {
1818
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
1819
- createCliDiagnosticCodeError as createCliDiagnosticCodeError5
1820
- } from "@wp-typia/project-tools/cli-diagnostics";
1821
-
1822
1876
  // src/output-markers.ts
1823
1877
  var UNICODE_OUTPUT_MARKERS = {
1824
1878
  dryRun: "\uD83E\uDDEA",
@@ -1897,47 +1951,38 @@ function stripLeadingOutputMarker(text, kind) {
1897
1951
  return text.replace(new RegExp(`^(?:${markerPattern})\\s*`, "u"), "");
1898
1952
  }
1899
1953
 
1900
- // src/print-block.ts
1901
- function printBlock(printLine, lines) {
1902
- for (const line of lines) {
1903
- printLine(line);
1904
- }
1905
- }
1906
-
1907
- // src/runtime-bridge-output.ts
1908
- function printCompletionPayload(payload, options = {}) {
1909
- const printLine = options.printLine ?? console.log;
1910
- const warnLine = options.warnLine ?? printLine;
1911
- for (const line of payload.preambleLines ?? []) {
1912
- printLine(line);
1913
- }
1914
- for (const warning of payload.warningLines ?? []) {
1915
- warnLine(formatOutputMarker("warning", warning, options.markerOptions));
1916
- }
1917
- const hasDetails = (payload.summaryLines?.length ?? 0) > 0 || (payload.nextSteps?.length ?? 0) > 0 || (payload.optionalLines?.length ?? 0) > 0 || Boolean(payload.optionalNote);
1918
- const hasLeadingContext = (payload.preambleLines?.length ?? 0) > 0 || (payload.warningLines?.length ?? 0) > 0;
1919
- printLine(hasLeadingContext && hasDetails ? `
1920
- ${payload.title}` : payload.title);
1921
- for (const line of payload.summaryLines ?? []) {
1922
- printLine(line);
1923
- }
1924
- if ((payload.nextSteps?.length ?? 0) > 0) {
1925
- printLine("Next steps:");
1926
- for (const step of payload.nextSteps ?? []) {
1927
- printLine(` ${step}`);
1928
- }
1929
- }
1930
- if ((payload.optionalLines?.length ?? 0) > 0) {
1931
- printLine(`
1932
- ${payload.optionalTitle ?? "Optional:"}`);
1933
- for (const step of payload.optionalLines ?? []) {
1934
- printLine(` ${step}`);
1935
- }
1936
- }
1937
- if (payload.optionalNote) {
1938
- printLine(`Note: ${payload.optionalNote}`);
1939
- }
1954
+ // src/runtime-output/init.ts
1955
+ function buildInitCompletionPayload(plan, markerOptions) {
1956
+ const changeLines = [
1957
+ ...plan.packageChanges.addDevDependencies.map((dependency) => `devDependency ${dependency.action} ${dependency.name} -> ${dependency.requiredValue}`),
1958
+ ...plan.packageChanges.packageManagerField ? [
1959
+ `packageManager ${plan.packageChanges.packageManagerField.action} -> ${plan.packageChanges.packageManagerField.requiredValue}`
1960
+ ] : [],
1961
+ ...plan.packageChanges.scripts.map((script) => `script ${script.action} ${script.name} -> ${script.requiredValue}`),
1962
+ ...plan.plannedFiles.map((filePlan) => `file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`),
1963
+ ...plan.commandMode === "preview-only" ? plan.generatedArtifacts.map((artifactPath) => `generated artifact ${artifactPath}`) : []
1964
+ ];
1965
+ const modeLine = plan.commandMode === "apply" ? plan.status === "already-initialized" ? "Mode: apply requested; no files were written because the retrofit surface already existed." : "Mode: apply; package.json and retrofit helper files were written." : "Mode: preview only; no files were written.";
1966
+ const optionalTitle = plan.commandMode === "apply" ? `Applied adoption changes (${changeLines.length}):` : `Planned adoption changes (${changeLines.length}):`;
1967
+ const title = plan.status === "already-initialized" ? formatOutputMarker("success", `wp-typia init: ${plan.projectName} is already initialized`, markerOptions) : plan.commandMode === "apply" ? formatOutputMarker("success", `Applied retrofit init for ${plan.projectName}`, markerOptions) : formatOutputMarker("dryRun", `Retrofit init plan for ${plan.projectName}`, markerOptions);
1968
+ return {
1969
+ nextSteps: plan.nextSteps,
1970
+ optionalLines: changeLines,
1971
+ optionalNote: plan.summary,
1972
+ optionalTitle,
1973
+ summaryLines: [
1974
+ `Project directory: ${plan.projectDir}`,
1975
+ `Detected layout: ${plan.detectedLayout.description}`,
1976
+ ...plan.detectedLayout.blockNames.length > 0 ? [`Block targets: ${plan.detectedLayout.blockNames.join(", ")}`] : [],
1977
+ `Package manager: ${plan.packageManager}`,
1978
+ modeLine
1979
+ ],
1980
+ title,
1981
+ warningLines: plan.notes
1982
+ };
1940
1983
  }
1984
+
1985
+ // src/runtime-output/structured.ts
1941
1986
  function toNonEmptyArray(values) {
1942
1987
  return values && values.length > 0 ? values : undefined;
1943
1988
  }
@@ -1946,13 +1991,6 @@ function extractPlannedFiles(payload) {
1946
1991
  return toNonEmptyArray(files);
1947
1992
  }
1948
1993
  var PROJECT_DIRECTORY_SUMMARY_PREFIX = "Project directory: ";
1949
- function resolveCreateCompletionPackageManager(packageManager) {
1950
- const parsedPackageManager = parsePackageManagerField(packageManager);
1951
- if (parsedPackageManager) {
1952
- return parsedPackageManager;
1953
- }
1954
- throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
1955
- }
1956
1994
  function extractCompletionProjectDir(completion) {
1957
1995
  const projectDir = completion?.summaryLines?.find((line) => line.startsWith(PROJECT_DIRECTORY_SUMMARY_PREFIX))?.slice(PROJECT_DIRECTORY_SUMMARY_PREFIX.length).trim();
1958
1996
  return projectDir && projectDir.length > 0 ? projectDir : undefined;
@@ -2005,6 +2043,37 @@ function buildStructuredInitSuccessPayload(plan) {
2005
2043
  }
2006
2044
  };
2007
2045
  }
2046
+ // src/runtime-output/create.ts
2047
+ import {
2048
+ PACKAGE_MANAGER_IDS,
2049
+ formatPackageExecCommand,
2050
+ parsePackageManagerField
2051
+ } from "@wp-typia/project-tools/package-managers";
2052
+ import {
2053
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
2054
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError5
2055
+ } from "@wp-typia/project-tools/cli-diagnostics";
2056
+ function escapeRegExp2(source) {
2057
+ return source.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
2058
+ }
2059
+ var LOOSE_CREATE_COMPLETION_PACKAGE_MANAGER_PATTERN = new RegExp(`^(?:corepack\\s+)?(${PACKAGE_MANAGER_IDS.map(escapeRegExp2).join("|")})(?=$|[@:/+\\s])`, "iu");
2060
+ function parseCreateCompletionPackageManager(packageManager) {
2061
+ const normalizedPackageManager = packageManager.trim();
2062
+ const parsedPackageManager = parsePackageManagerField(normalizedPackageManager);
2063
+ if (parsedPackageManager) {
2064
+ return parsedPackageManager;
2065
+ }
2066
+ const looseMatch = LOOSE_CREATE_COMPLETION_PACKAGE_MANAGER_PATTERN.exec(normalizedPackageManager);
2067
+ const loosePackageManager = looseMatch?.[1]?.toLowerCase();
2068
+ return PACKAGE_MANAGER_IDS.includes(loosePackageManager) ? loosePackageManager : null;
2069
+ }
2070
+ function resolveCreateCompletionPackageManager(packageManager) {
2071
+ const parsedPackageManager = parseCreateCompletionPackageManager(packageManager);
2072
+ if (parsedPackageManager) {
2073
+ return parsedPackageManager;
2074
+ }
2075
+ throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
2076
+ }
2008
2077
  function formatCreateProgressLine(payload, markerOptions) {
2009
2078
  return formatOutputMarker("progress", `${payload.title}: ${payload.detail}`, markerOptions);
2010
2079
  }
@@ -2050,45 +2119,14 @@ function buildCreateDryRunPayload(flow, markerOptions) {
2050
2119
  warningLines: flow.result.warnings
2051
2120
  };
2052
2121
  }
2053
- function buildInitCompletionPayload(plan, markerOptions) {
2054
- const changeLines = [
2055
- ...plan.packageChanges.addDevDependencies.map((dependency) => `devDependency ${dependency.action} ${dependency.name} -> ${dependency.requiredValue}`),
2056
- ...plan.packageChanges.packageManagerField ? [
2057
- `packageManager ${plan.packageChanges.packageManagerField.action} -> ${plan.packageChanges.packageManagerField.requiredValue}`
2058
- ] : [],
2059
- ...plan.packageChanges.scripts.map((script) => `script ${script.action} ${script.name} -> ${script.requiredValue}`),
2060
- ...plan.plannedFiles.map((filePlan) => `file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`),
2061
- ...plan.commandMode === "preview-only" ? plan.generatedArtifacts.map((artifactPath) => `generated artifact ${artifactPath}`) : []
2062
- ];
2063
- const modeLine = plan.commandMode === "apply" ? plan.status === "already-initialized" ? "Mode: apply requested; no files were written because the retrofit surface already existed." : "Mode: apply; package.json and retrofit helper files were written." : "Mode: preview only; no files were written.";
2064
- const optionalTitle = plan.commandMode === "apply" ? `Applied adoption changes (${changeLines.length}):` : `Planned adoption changes (${changeLines.length}):`;
2065
- const title = plan.status === "already-initialized" ? formatOutputMarker("success", `wp-typia init: ${plan.projectName} is already initialized`, markerOptions) : plan.commandMode === "apply" ? formatOutputMarker("success", `Applied retrofit init for ${plan.projectName}`, markerOptions) : formatOutputMarker("dryRun", `Retrofit init plan for ${plan.projectName}`, markerOptions);
2066
- return {
2067
- nextSteps: plan.nextSteps,
2068
- optionalLines: changeLines,
2069
- optionalNote: plan.summary,
2070
- optionalTitle,
2071
- summaryLines: [
2072
- `Project directory: ${plan.projectDir}`,
2073
- `Detected layout: ${plan.detectedLayout.description}`,
2074
- ...plan.detectedLayout.blockNames.length > 0 ? [`Block targets: ${plan.detectedLayout.blockNames.join(", ")}`] : [],
2075
- `Package manager: ${plan.packageManager}`,
2076
- modeLine
2077
- ],
2078
- title,
2079
- warningLines: plan.notes
2080
- };
2081
- }
2082
- function buildMigrationCompletionPayload(options, markerOptions) {
2083
- const summaryLines = options.lines.filter((line) => line.trim().length > 0);
2084
- return {
2085
- summaryLines,
2086
- title: formatOutputMarker("success", `Completed wp-typia migrate ${options.command}`, markerOptions)
2087
- };
2088
- }
2122
+ // src/runtime-output/add.ts
2123
+ import {
2124
+ formatPackageExecCommand as formatPackageExecCommand2,
2125
+ inferPackageManagerId
2126
+ } from "@wp-typia/project-tools/package-managers";
2089
2127
  function buildAddCompletionPayload(options, markerOptions) {
2090
2128
  const verificationLines = [
2091
- formatPackageExecCommand(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
2129
+ formatPackageExecCommand2(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
2092
2130
  ];
2093
2131
  const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
2094
2132
  const completion = buildAddKindCompletionDetails(options.kind, {
@@ -2117,6 +2155,15 @@ function buildAddDryRunPayload(options, markerOptions) {
2117
2155
  warningLines: options.completion.warningLines
2118
2156
  };
2119
2157
  }
2158
+ // src/runtime-output/migrate.ts
2159
+ function buildMigrationCompletionPayload(options, markerOptions) {
2160
+ const summaryLines = options.lines.filter((line) => line.trim().length > 0);
2161
+ return {
2162
+ summaryLines,
2163
+ title: formatOutputMarker("success", `Completed wp-typia migrate ${options.command}`, markerOptions)
2164
+ };
2165
+ }
2166
+ // src/runtime-output/sync.ts
2120
2167
  function buildSyncDryRunPayload(options, markerOptions) {
2121
2168
  const targetSuffix = options.target === "ai" ? " ai" : "";
2122
2169
  const targetSummary = options.target === "ai" ? "Sync target: AI artifacts only." : options.target === "default" ? "Sync target: generated project defaults." : undefined;
@@ -2133,232 +2180,58 @@ function buildSyncDryRunPayload(options, markerOptions) {
2133
2180
  title: formatOutputMarker("dryRun", `Dry run for wp-typia sync${targetSuffix}`, markerOptions)
2134
2181
  };
2135
2182
  }
2136
-
2137
- // src/runtime-capabilities.ts
2138
- function isInteractiveTerminal({
2139
- stdin = process.stdin,
2140
- stdout = process.stdout,
2141
- term = process.env.TERM
2142
- } = {}) {
2143
- return Boolean(stdin?.isTTY) && Boolean(stdout?.isTTY) && term !== "dumb";
2144
- }
2145
- // src/runtime-bridge-sync.ts
2146
- import { spawnSync } from "node:child_process";
2147
- import fs3 from "node:fs";
2148
- import path3 from "node:path";
2149
- import {
2150
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
2151
- createCliDiagnosticCodeError as createCliDiagnosticCodeError6
2152
- } from "@wp-typia/project-tools/cli-diagnostics";
2153
- import {
2154
- formatInstallCommand,
2155
- formatRunScript,
2156
- inferPackageManagerId as inferPackageManagerId2
2157
- } from "@wp-typia/project-tools/package-managers";
2158
- var SYNC_INSTALL_MARKERS = [
2159
- "node_modules",
2160
- ".pnp.cjs",
2161
- ".pnp.loader.mjs"
2162
- ];
2163
- var LOCAL_SYNC_TOOL_PATTERN = /(^|[\s;&|()])(?:tsx|wp-scripts)(?=($|[\s;&|()]))/u;
2164
- var CAPTURED_SYNC_OUTPUT_MAX_BUFFER = 16 * 1024 * 1024;
2165
- function resolveSyncExecutionTarget(subcommand) {
2166
- if (!subcommand) {
2167
- return "default";
2168
- }
2169
- if (subcommand === "ai") {
2170
- return "ai";
2171
- }
2172
- throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
2173
- }
2174
- function getSyncRootError(cwd) {
2175
- return createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.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.`);
2176
- }
2177
- function resolveSyncProjectContext(cwd) {
2178
- const packageJsonPath = path3.join(cwd, "package.json");
2179
- if (!fs3.existsSync(packageJsonPath)) {
2180
- throw getSyncRootError(cwd);
2181
- }
2182
- const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
2183
- const scripts = packageJson.scripts ?? {};
2184
- const syncScripts = {
2185
- sync: typeof scripts.sync === "string" ? {
2186
- command: scripts.sync,
2187
- scriptName: "sync"
2188
- } : undefined,
2189
- "sync-ai": typeof scripts["sync-ai"] === "string" ? {
2190
- command: scripts["sync-ai"],
2191
- scriptName: "sync-ai"
2192
- } : typeof scripts["sync-wordpress-ai"] === "string" ? {
2193
- command: scripts["sync-wordpress-ai"],
2194
- scriptName: "sync-wordpress-ai"
2195
- } : undefined,
2196
- "sync-rest": typeof scripts["sync-rest"] === "string" ? {
2197
- command: scripts["sync-rest"],
2198
- scriptName: "sync-rest"
2199
- } : undefined,
2200
- "sync-types": typeof scripts["sync-types"] === "string" ? {
2201
- command: scripts["sync-types"],
2202
- scriptName: "sync-types"
2203
- } : undefined
2204
- };
2205
- return {
2206
- cwd,
2207
- packageJsonPath,
2208
- packageManager: inferPackageManagerId2(cwd, packageJson.packageManager),
2209
- scripts: syncScripts
2210
- };
2211
- }
2212
- function findInstalledDependencyMarkerDir(projectDir) {
2213
- let currentDir = path3.resolve(projectDir);
2214
- while (true) {
2215
- if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path3.join(currentDir, marker)))) {
2216
- return currentDir;
2217
- }
2218
- const parentDir = path3.dirname(currentDir);
2219
- if (parentDir === currentDir) {
2220
- return null;
2221
- }
2222
- currentDir = parentDir;
2223
- }
2224
- }
2225
- function scriptsLikelyNeedInstalledDependencies(project, target) {
2226
- const candidateScripts = target === "ai" ? [project.scripts["sync-ai"]] : project.scripts.sync ? [project.scripts.sync] : [
2227
- project.scripts["sync-types"],
2228
- project.scripts["sync-rest"],
2229
- project.scripts["sync-ai"]
2230
- ];
2231
- return candidateScripts.some((script) => script !== undefined && LOCAL_SYNC_TOOL_PATTERN.test(script.command));
2232
- }
2233
- function assertSyncDependenciesInstalled(project, target) {
2234
- if (!scriptsLikelyNeedInstalledDependencies(project, target)) {
2235
- return;
2236
- }
2237
- const markerDir = findInstalledDependencyMarkerDir(project.cwd);
2238
- if (markerDir) {
2239
- return;
2240
- }
2241
- throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.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\`.`);
2242
- }
2243
- function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
2244
- switch (packageManager) {
2245
- case "bun":
2246
- return { args: ["run", scriptName, ...extraArgs], command: "bun" };
2247
- case "npm":
2248
- return {
2249
- args: [
2250
- "run",
2251
- scriptName,
2252
- ...extraArgs.length > 0 ? ["--", ...extraArgs] : []
2253
- ],
2254
- command: "npm"
2255
- };
2256
- case "pnpm":
2257
- return { args: ["run", scriptName, ...extraArgs], command: "pnpm" };
2258
- case "yarn":
2259
- return { args: ["run", scriptName, ...extraArgs], command: "yarn" };
2183
+ // src/print-block.ts
2184
+ function printBlock(printLine, lines) {
2185
+ for (const line of lines) {
2186
+ printLine(line);
2260
2187
  }
2261
2188
  }
2262
- function createSyncPlannedCommand(project, scriptName, extraArgs) {
2263
- const script = project.scripts[scriptName];
2264
- if (!script) {
2265
- return null;
2266
- }
2267
- const invocation = getPackageManagerRunInvocation(project.packageManager, script.scriptName, extraArgs);
2268
- return {
2269
- args: invocation.args,
2270
- command: invocation.command,
2271
- displayCommand: formatRunScript(project.packageManager, script.scriptName, extraArgs.join(" ")),
2272
- scriptName: script.scriptName
2273
- };
2274
- }
2275
- function buildSyncPlannedCommands(project, extraArgs, target) {
2276
- if (target === "ai") {
2277
- const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2278
- if (!syncAiCommand2) {
2279
- throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2280
- }
2281
- return [syncAiCommand2];
2189
+
2190
+ // src/runtime-output/print.ts
2191
+ function printCompletionPayload(payload, options = {}) {
2192
+ const printLine = options.printLine ?? console.log;
2193
+ const warnLine = options.warnLine ?? printLine;
2194
+ for (const line of payload.preambleLines ?? []) {
2195
+ printLine(line);
2282
2196
  }
2283
- if (project.scripts.sync) {
2284
- return [createSyncPlannedCommand(project, "sync", extraArgs)];
2197
+ for (const warning of payload.warningLines ?? []) {
2198
+ warnLine(formatOutputMarker("warning", warning, options.markerOptions));
2285
2199
  }
2286
- const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
2287
- if (!syncTypesCommand) {
2288
- throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2200
+ const hasDetails = (payload.summaryLines?.length ?? 0) > 0 || (payload.nextSteps?.length ?? 0) > 0 || (payload.optionalLines?.length ?? 0) > 0 || Boolean(payload.optionalNote);
2201
+ const hasLeadingContext = (payload.preambleLines?.length ?? 0) > 0 || (payload.warningLines?.length ?? 0) > 0;
2202
+ printLine(hasLeadingContext && hasDetails ? `
2203
+ ${payload.title}` : payload.title);
2204
+ for (const line of payload.summaryLines ?? []) {
2205
+ printLine(line);
2289
2206
  }
2290
- const plannedCommands = [syncTypesCommand];
2291
- const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
2292
- if (syncRestCommand) {
2293
- plannedCommands.push(syncRestCommand);
2207
+ if ((payload.nextSteps?.length ?? 0) > 0) {
2208
+ printLine("Next steps:");
2209
+ for (const step of payload.nextSteps ?? []) {
2210
+ printLine(` ${step}`);
2211
+ }
2294
2212
  }
2295
- const syncAiCommand = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2296
- if (syncAiCommand) {
2297
- plannedCommands.push(syncAiCommand);
2213
+ if ((payload.optionalLines?.length ?? 0) > 0) {
2214
+ printLine(`
2215
+ ${payload.optionalTitle ?? "Optional:"}`);
2216
+ for (const step of payload.optionalLines ?? []) {
2217
+ printLine(` ${step}`);
2218
+ }
2298
2219
  }
2299
- return plannedCommands;
2300
- }
2301
- function runProjectScript(project, plannedCommand, options) {
2302
- const result = spawnSync(plannedCommand.command, plannedCommand.args, {
2303
- cwd: project.cwd,
2304
- encoding: options.captureOutput ? "utf8" : undefined,
2305
- ...options.captureOutput ? { maxBuffer: CAPTURED_SYNC_OUTPUT_MAX_BUFFER } : {},
2306
- shell: process.platform === "win32",
2307
- stdio: options.captureOutput ? "pipe" : "inherit"
2308
- });
2309
- const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
2310
- const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
2311
- if (result.error || result.status !== 0) {
2312
- throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
2313
- cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
2314
- });
2220
+ if (payload.optionalNote) {
2221
+ printLine(`Note: ${payload.optionalNote}`);
2315
2222
  }
2316
- return {
2317
- ...plannedCommand,
2318
- exitCode: result.status ?? 0,
2319
- ...stderr !== undefined ? { stderr } : {},
2320
- ...stdout !== undefined ? { stdout } : {}
2321
- };
2322
2223
  }
2323
- async function executeSyncCommand({
2324
- captureOutput = false,
2325
- check = false,
2326
- cwd,
2327
- dryRun = false,
2328
- target = "default"
2329
- }) {
2330
- const project = resolveSyncProjectContext(cwd);
2331
- const extraArgs = check ? ["--check"] : [];
2332
- const plannedCommands = buildSyncPlannedCommands(project, extraArgs, target);
2333
- const result = {
2334
- check,
2335
- dryRun,
2336
- packageJsonPath: project.packageJsonPath,
2337
- packageManager: project.packageManager,
2338
- plannedCommands,
2339
- projectDir: project.cwd,
2340
- target
2341
- };
2342
- if (dryRun) {
2343
- return result;
2344
- }
2345
- assertSyncDependenciesInstalled(project, target);
2346
- result.executedCommands = plannedCommands.map((plannedCommand) => runProjectScript(project, plannedCommand, {
2347
- captureOutput
2348
- }));
2349
- return result;
2224
+ // src/runtime-capabilities.ts
2225
+ function isInteractiveTerminal({
2226
+ stdin = process.stdin,
2227
+ stdout = process.stdout,
2228
+ term = process.env.TERM
2229
+ } = {}) {
2230
+ return Boolean(stdin?.isTTY) && Boolean(stdout?.isTTY) && term !== "dumb";
2350
2231
  }
2351
2232
 
2352
- // src/runtime-bridge.ts
2353
- var loadCliAddRuntime = () => import("@wp-typia/project-tools/cli-add");
2233
+ // src/runtime-bridge-shared.ts
2354
2234
  var loadCliDiagnosticsRuntime = () => import("@wp-typia/project-tools/cli-diagnostics");
2355
- var loadCliDoctorRuntime = () => import("@wp-typia/project-tools/cli-doctor");
2356
- var loadCliInitRuntime = () => import("@wp-typia/project-tools/cli-init");
2357
- var loadCliPromptRuntime = () => import("@wp-typia/project-tools/cli-prompt");
2358
- var loadCliScaffoldRuntime = () => import("@wp-typia/project-tools/cli-scaffold");
2359
- var loadCliTemplatesRuntime = () => import("@wp-typia/project-tools/cli-templates");
2360
- var loadCreateTemplateValidationRuntime = () => import("@wp-typia/project-tools/create-template-validation");
2361
- var loadMigrationsRuntime = () => import("@wp-typia/project-tools/migrations");
2362
2235
  async function wrapCliCommandError(command, error) {
2363
2236
  const { createCliCommandError: createCliCommandError3 } = await loadCliDiagnosticsRuntime();
2364
2237
  return createCliCommandError3({ command, error });
@@ -2372,6 +2245,15 @@ function shouldWrapCliCommandError(options) {
2372
2245
  }
2373
2246
  return true;
2374
2247
  }
2248
+ function emitCompletion(payload, options) {
2249
+ if (options.emitOutput) {
2250
+ printCompletionPayload(payload, {
2251
+ printLine: options.printLine,
2252
+ warnLine: options.warnLine
2253
+ });
2254
+ }
2255
+ return payload;
2256
+ }
2375
2257
  function pushFlag(argv, name, value) {
2376
2258
  if (value === undefined || value === null || value === false) {
2377
2259
  return;
@@ -2382,6 +2264,10 @@ function pushFlag(argv, name, value) {
2382
2264
  }
2383
2265
  argv.push(`--${name}`, String(value));
2384
2266
  }
2267
+
2268
+ // src/runtime-bridge-add.ts
2269
+ var loadCliAddRuntime = () => import("@wp-typia/project-tools/cli-add");
2270
+ var loadCliPromptRuntime = () => import("@wp-typia/project-tools/cli-prompt");
2385
2271
  async function executeWorkspaceAddWithOptionalDryRun(options) {
2386
2272
  const simulated = options.dryRun ? await simulateWorkspaceAddDryRun({
2387
2273
  cwd: options.cwd,
@@ -2425,6 +2311,72 @@ async function executePlannedAddKind(kind, executionContext, context) {
2425
2311
  const plan = await getAddKindExecutionPlan(kind, executionContext);
2426
2312
  return executePreparedAddKind(kind, context, plan);
2427
2313
  }
2314
+ async function executeAddCommand({
2315
+ cwd,
2316
+ emitOutput = true,
2317
+ flags,
2318
+ interactive,
2319
+ kind,
2320
+ name,
2321
+ printLine = console.log,
2322
+ prompt,
2323
+ warnLine = console.warn
2324
+ }) {
2325
+ let activePrompt;
2326
+ const dryRun = Boolean(flags["dry-run"]);
2327
+ try {
2328
+ const addRuntime = await loadCliAddRuntime();
2329
+ const isInteractiveSession = interactive ?? isInteractiveTerminal();
2330
+ if (!kind) {
2331
+ if (shouldPrintMissingAddKindHelp({ emitOutput })) {
2332
+ printLine(addRuntime.formatAddHelpText());
2333
+ }
2334
+ throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
2335
+ }
2336
+ if (!isAddKindId(kind)) {
2337
+ throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2338
+ }
2339
+ if (dryRun && !supportsAddKindDryRun(kind)) {
2340
+ throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2341
+ }
2342
+ const executionContext = {
2343
+ addRuntime,
2344
+ cwd,
2345
+ flags,
2346
+ getOrCreatePrompt: async () => {
2347
+ if (activePrompt) {
2348
+ return activePrompt;
2349
+ }
2350
+ const { createReadlinePrompt } = await loadCliPromptRuntime();
2351
+ activePrompt = prompt ?? createReadlinePrompt();
2352
+ return activePrompt;
2353
+ },
2354
+ isInteractiveSession,
2355
+ name,
2356
+ warnLine
2357
+ };
2358
+ return await executePlannedAddKind(kind, executionContext, {
2359
+ cwd,
2360
+ dryRun,
2361
+ emitOutput,
2362
+ printLine
2363
+ });
2364
+ } catch (error) {
2365
+ if (!shouldWrapCliCommandError({ emitOutput })) {
2366
+ throw error;
2367
+ }
2368
+ throw await wrapCliCommandError("add", error);
2369
+ } finally {
2370
+ if (activePrompt && activePrompt !== prompt) {
2371
+ activePrompt.close();
2372
+ }
2373
+ }
2374
+ }
2375
+ // src/runtime-bridge-create.ts
2376
+ var loadCliPromptRuntime2 = () => import("@wp-typia/project-tools/cli-prompt");
2377
+ var loadCliScaffoldRuntime = () => import("@wp-typia/project-tools/cli-scaffold");
2378
+ var loadCliTemplatesRuntime = () => import("@wp-typia/project-tools/cli-templates");
2379
+ var loadCreateTemplateValidationRuntime = () => import("@wp-typia/project-tools/create-template-validation");
2428
2380
  var PACKAGE_MANAGER_PROMPT_OPTIONS = [
2429
2381
  { label: "npm", value: "npm", hint: "Use npm" },
2430
2382
  { label: "pnpm", value: "pnpm", hint: "Use pnpm" },
@@ -2451,15 +2403,6 @@ var BOOLEAN_PROMPT_OPTIONS = [
2451
2403
  { label: "Yes", value: "yes", hint: "Enable this option" },
2452
2404
  { label: "No", value: "no", hint: "Keep the default disabled state" }
2453
2405
  ];
2454
- function emitCompletion(payload, options) {
2455
- if (options.emitOutput) {
2456
- printCompletionPayload(payload, {
2457
- printLine: options.printLine,
2458
- warnLine: options.warnLine
2459
- });
2460
- }
2461
- return payload;
2462
- }
2463
2406
  async function executeCreateCommand({
2464
2407
  projectDir,
2465
2408
  cwd,
@@ -2480,7 +2423,7 @@ async function executeCreateCommand({
2480
2423
  { runScaffoldFlow },
2481
2424
  { getTemplateSelectOptions }
2482
2425
  ] = await Promise.all([
2483
- loadCliPromptRuntime(),
2426
+ loadCliPromptRuntime2(),
2484
2427
  loadCliScaffoldRuntime(),
2485
2428
  loadCliTemplatesRuntime()
2486
2429
  ]);
@@ -2550,99 +2493,23 @@ async function executeCreateCommand({
2550
2493
  }
2551
2494
  }
2552
2495
  }
2553
- async function executeAddCommand({
2554
- cwd,
2555
- emitOutput = true,
2556
- flags,
2557
- interactive,
2558
- kind,
2559
- name,
2560
- printLine = console.log,
2561
- prompt,
2562
- warnLine = console.warn
2563
- }) {
2564
- let activePrompt;
2565
- const dryRun = Boolean(flags["dry-run"]);
2496
+ // src/runtime-bridge-doctor.ts
2497
+ var loadCliDoctorRuntime = () => import("@wp-typia/project-tools/cli-doctor");
2498
+ async function executeDoctorCommand(cwd) {
2566
2499
  try {
2567
- const addRuntime = await loadCliAddRuntime();
2568
- const isInteractiveSession = interactive ?? isInteractiveTerminal();
2569
- if (!kind) {
2570
- if (shouldPrintMissingAddKindHelp({ emitOutput })) {
2571
- printLine(addRuntime.formatAddHelpText());
2572
- }
2573
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
2574
- }
2575
- if (!isAddKindId(kind)) {
2576
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
2577
- }
2578
- if (dryRun && !supportsAddKindDryRun(kind)) {
2579
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
2580
- }
2581
- const executionContext = {
2582
- addRuntime,
2583
- cwd,
2584
- flags,
2585
- getOrCreatePrompt: async () => {
2586
- if (activePrompt) {
2587
- return activePrompt;
2588
- }
2589
- const { createReadlinePrompt } = await loadCliPromptRuntime();
2590
- activePrompt = prompt ?? createReadlinePrompt();
2591
- return activePrompt;
2592
- },
2593
- isInteractiveSession,
2594
- name,
2595
- warnLine
2596
- };
2597
- return await executePlannedAddKind(kind, executionContext, {
2598
- cwd,
2599
- dryRun,
2600
- emitOutput,
2601
- printLine
2602
- });
2500
+ const { runDoctor } = await loadCliDoctorRuntime();
2501
+ await runDoctor(cwd);
2603
2502
  } catch (error) {
2604
- if (!shouldWrapCliCommandError({ emitOutput })) {
2605
- throw error;
2606
- }
2607
- throw await wrapCliCommandError("add", error);
2608
- } finally {
2609
- if (activePrompt && activePrompt !== prompt) {
2610
- activePrompt.close();
2611
- }
2612
- }
2613
- }
2614
- async function executeTemplatesCommand({ flags }, printLine = console.log) {
2615
- const {
2616
- formatTemplateDetails,
2617
- formatTemplateFeatures,
2618
- formatTemplateSummary,
2619
- getTemplateById,
2620
- listTemplates
2621
- } = await loadCliTemplatesRuntime();
2622
- const subcommand = flags.subcommand ?? "list";
2623
- if (subcommand === "list") {
2624
- for (const template of listTemplates()) {
2625
- printBlock(printLine, [formatTemplateSummary(template), formatTemplateFeatures(template)]);
2626
- }
2627
- return;
2628
- }
2629
- if (subcommand === "inspect") {
2630
- if (!flags.id) {
2631
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2632
- }
2633
- const template = getTemplateById(flags.id);
2634
- if (!template) {
2635
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2636
- }
2637
- printBlock(printLine, [formatTemplateDetails(template)]);
2638
- return;
2503
+ throw await wrapCliCommandError("doctor", error);
2639
2504
  }
2640
- throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2641
2505
  }
2506
+ // src/runtime-bridge-init.ts
2507
+ import path3 from "node:path";
2508
+ var loadCliInitRuntime = () => import("@wp-typia/project-tools/cli-init");
2642
2509
  async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
2643
2510
  try {
2644
2511
  const { runInitCommand } = await loadCliInitRuntime();
2645
- const resolvedProjectDir = projectDir ? (await import("node:path")).resolve(cwd, projectDir) : cwd;
2512
+ const resolvedProjectDir = projectDir ? path3.resolve(cwd, projectDir) : cwd;
2646
2513
  const plan = await runInitCommand({
2647
2514
  apply,
2648
2515
  packageManager,
@@ -2663,14 +2530,8 @@ async function executeInitCommand({ apply, cwd, packageManager, projectDir }, op
2663
2530
  throw await wrapCliCommandError("init", error);
2664
2531
  }
2665
2532
  }
2666
- async function executeDoctorCommand(cwd) {
2667
- try {
2668
- const { runDoctor } = await loadCliDoctorRuntime();
2669
- await runDoctor(cwd);
2670
- } catch (error) {
2671
- throw await wrapCliCommandError("doctor", error);
2672
- }
2673
- }
2533
+ // src/runtime-bridge-migrate.ts
2534
+ var loadMigrationsRuntime = () => import("@wp-typia/project-tools/migrations");
2674
2535
  async function executeMigrateCommand({
2675
2536
  command,
2676
2537
  cwd,
@@ -2678,12 +2539,17 @@ async function executeMigrateCommand({
2678
2539
  prompt,
2679
2540
  renderLine
2680
2541
  }) {
2681
- const { formatMigrationHelpText, parseMigrationArgs, runMigrationCommand } = await loadMigrationsRuntime();
2682
- if (!command) {
2683
- console.log(formatMigrationHelpText());
2684
- return;
2685
- }
2686
2542
  try {
2543
+ const { formatMigrationHelpText, parseMigrationArgs, runMigrationCommand } = await loadMigrationsRuntime();
2544
+ if (!command) {
2545
+ const helpText = formatMigrationHelpText();
2546
+ if (renderLine) {
2547
+ renderLine(helpText);
2548
+ } else {
2549
+ console.log(helpText);
2550
+ }
2551
+ return;
2552
+ }
2687
2553
  const argv = [command];
2688
2554
  pushFlag(argv, "all", flags.all);
2689
2555
  pushFlag(argv, "force", flags.force);
@@ -2723,13 +2589,261 @@ async function executeMigrateCommand({
2723
2589
  throw await wrapCliCommandError("migrate", error);
2724
2590
  }
2725
2591
  }
2726
-
2727
- // src/command-contract.ts
2592
+ // src/runtime-bridge-templates.ts
2593
+ import {
2594
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES8,
2595
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError7
2596
+ } from "@wp-typia/project-tools/cli-diagnostics";
2597
+ var loadCliTemplatesRuntime2 = () => import("@wp-typia/project-tools/cli-templates");
2598
+ async function executeTemplatesCommand({ flags }, printLine = console.log) {
2599
+ const {
2600
+ formatTemplateDetails,
2601
+ formatTemplateFeatures,
2602
+ formatTemplateSummary,
2603
+ getTemplateById,
2604
+ listTemplates
2605
+ } = await loadCliTemplatesRuntime2();
2606
+ const subcommand = flags.subcommand ?? "list";
2607
+ if (subcommand === "list") {
2608
+ for (const template of listTemplates()) {
2609
+ printBlock(printLine, [formatTemplateSummary(template), formatTemplateFeatures(template)]);
2610
+ }
2611
+ return;
2612
+ }
2613
+ if (subcommand === "inspect") {
2614
+ if (!flags.id) {
2615
+ throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
2616
+ }
2617
+ const template = getTemplateById(flags.id);
2618
+ if (!template) {
2619
+ throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
2620
+ }
2621
+ printBlock(printLine, [formatTemplateDetails(template)]);
2622
+ return;
2623
+ }
2624
+ throw createCliDiagnosticCodeError7(CLI_DIAGNOSTIC_CODES8.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
2625
+ }
2626
+ // src/runtime-bridge-sync.ts
2627
+ import { spawnSync } from "node:child_process";
2628
+ import fs3 from "node:fs";
2728
2629
  import path4 from "node:path";
2729
2630
  import {
2730
2631
  CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES9,
2731
2632
  createCliDiagnosticCodeError as createCliDiagnosticCodeError8
2732
2633
  } from "@wp-typia/project-tools/cli-diagnostics";
2634
+ import {
2635
+ formatInstallCommand,
2636
+ formatRunScript,
2637
+ inferPackageManagerId as inferPackageManagerId2
2638
+ } from "@wp-typia/project-tools/package-managers";
2639
+ var SYNC_INSTALL_MARKERS = [
2640
+ "node_modules",
2641
+ ".pnp.cjs",
2642
+ ".pnp.loader.mjs"
2643
+ ];
2644
+ var LOCAL_SYNC_TOOL_PATTERN = /(^|[\s;&|()])(?:tsx|wp-scripts)(?=($|[\s;&|()]))/u;
2645
+ var CAPTURED_SYNC_OUTPUT_MAX_BUFFER = 16 * 1024 * 1024;
2646
+ function resolveSyncExecutionTarget(subcommand) {
2647
+ if (!subcommand) {
2648
+ return "default";
2649
+ }
2650
+ if (subcommand === "ai") {
2651
+ return "ai";
2652
+ }
2653
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
2654
+ }
2655
+ function getSyncRootError(cwd) {
2656
+ return createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.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.`);
2657
+ }
2658
+ function readSyncPackageJson(packageJsonPath) {
2659
+ const source = fs3.readFileSync(packageJsonPath, "utf8");
2660
+ try {
2661
+ return JSON.parse(source);
2662
+ } catch (error) {
2663
+ const message = error instanceof Error ? error.message : String(error);
2664
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `Unable to parse ${packageJsonPath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
2665
+ }
2666
+ }
2667
+ function resolveSyncProjectContext(cwd) {
2668
+ const packageJsonPath = path4.join(cwd, "package.json");
2669
+ if (!fs3.existsSync(packageJsonPath)) {
2670
+ throw getSyncRootError(cwd);
2671
+ }
2672
+ const packageJson = readSyncPackageJson(packageJsonPath);
2673
+ const scripts = packageJson.scripts ?? {};
2674
+ const syncScripts = {
2675
+ sync: typeof scripts.sync === "string" ? {
2676
+ command: scripts.sync,
2677
+ scriptName: "sync"
2678
+ } : undefined,
2679
+ "sync-ai": typeof scripts["sync-ai"] === "string" ? {
2680
+ command: scripts["sync-ai"],
2681
+ scriptName: "sync-ai"
2682
+ } : typeof scripts["sync-wordpress-ai"] === "string" ? {
2683
+ command: scripts["sync-wordpress-ai"],
2684
+ scriptName: "sync-wordpress-ai"
2685
+ } : undefined,
2686
+ "sync-rest": typeof scripts["sync-rest"] === "string" ? {
2687
+ command: scripts["sync-rest"],
2688
+ scriptName: "sync-rest"
2689
+ } : undefined,
2690
+ "sync-types": typeof scripts["sync-types"] === "string" ? {
2691
+ command: scripts["sync-types"],
2692
+ scriptName: "sync-types"
2693
+ } : undefined
2694
+ };
2695
+ return {
2696
+ cwd,
2697
+ packageJsonPath,
2698
+ packageManager: inferPackageManagerId2(cwd, packageJson.packageManager),
2699
+ scripts: syncScripts
2700
+ };
2701
+ }
2702
+ function findInstalledDependencyMarkerDir(projectDir) {
2703
+ let currentDir = path4.resolve(projectDir);
2704
+ while (true) {
2705
+ if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path4.join(currentDir, marker)))) {
2706
+ return currentDir;
2707
+ }
2708
+ const parentDir = path4.dirname(currentDir);
2709
+ if (parentDir === currentDir) {
2710
+ return null;
2711
+ }
2712
+ currentDir = parentDir;
2713
+ }
2714
+ }
2715
+ function scriptsLikelyNeedInstalledDependencies(project, target) {
2716
+ const candidateScripts = target === "ai" ? [project.scripts["sync-ai"]] : project.scripts.sync ? [project.scripts.sync] : [
2717
+ project.scripts["sync-types"],
2718
+ project.scripts["sync-rest"],
2719
+ project.scripts["sync-ai"]
2720
+ ];
2721
+ return candidateScripts.some((script) => script !== undefined && LOCAL_SYNC_TOOL_PATTERN.test(script.command));
2722
+ }
2723
+ function assertSyncDependenciesInstalled(project, target) {
2724
+ if (!scriptsLikelyNeedInstalledDependencies(project, target)) {
2725
+ return;
2726
+ }
2727
+ const markerDir = findInstalledDependencyMarkerDir(project.cwd);
2728
+ if (markerDir) {
2729
+ return;
2730
+ }
2731
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.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\`.`);
2732
+ }
2733
+ function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
2734
+ switch (packageManager) {
2735
+ case "bun":
2736
+ return { args: ["run", scriptName, ...extraArgs], command: "bun" };
2737
+ case "npm":
2738
+ return {
2739
+ args: [
2740
+ "run",
2741
+ scriptName,
2742
+ ...extraArgs.length > 0 ? ["--", ...extraArgs] : []
2743
+ ],
2744
+ command: "npm"
2745
+ };
2746
+ case "pnpm":
2747
+ return { args: ["run", scriptName, ...extraArgs], command: "pnpm" };
2748
+ case "yarn":
2749
+ return { args: ["run", scriptName, ...extraArgs], command: "yarn" };
2750
+ }
2751
+ }
2752
+ function createSyncPlannedCommand(project, scriptName, extraArgs) {
2753
+ const script = project.scripts[scriptName];
2754
+ if (!script) {
2755
+ return null;
2756
+ }
2757
+ const invocation = getPackageManagerRunInvocation(project.packageManager, script.scriptName, extraArgs);
2758
+ return {
2759
+ args: invocation.args,
2760
+ command: invocation.command,
2761
+ displayCommand: formatRunScript(project.packageManager, script.scriptName, extraArgs.join(" ")),
2762
+ scriptName: script.scriptName
2763
+ };
2764
+ }
2765
+ function buildSyncPlannedCommands(project, extraArgs, target) {
2766
+ if (target === "ai") {
2767
+ const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2768
+ if (!syncAiCommand2) {
2769
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
2770
+ }
2771
+ return [syncAiCommand2];
2772
+ }
2773
+ if (project.scripts.sync) {
2774
+ return [createSyncPlannedCommand(project, "sync", extraArgs)];
2775
+ }
2776
+ const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
2777
+ if (!syncTypesCommand) {
2778
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
2779
+ }
2780
+ const plannedCommands = [syncTypesCommand];
2781
+ const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
2782
+ if (syncRestCommand) {
2783
+ plannedCommands.push(syncRestCommand);
2784
+ }
2785
+ const syncAiCommand = createSyncPlannedCommand(project, "sync-ai", extraArgs);
2786
+ if (syncAiCommand) {
2787
+ plannedCommands.push(syncAiCommand);
2788
+ }
2789
+ return plannedCommands;
2790
+ }
2791
+ function runProjectScript(project, plannedCommand, options) {
2792
+ const result = spawnSync(plannedCommand.command, plannedCommand.args, {
2793
+ cwd: project.cwd,
2794
+ encoding: options.captureOutput ? "utf8" : undefined,
2795
+ ...options.captureOutput ? { maxBuffer: CAPTURED_SYNC_OUTPUT_MAX_BUFFER } : {},
2796
+ shell: process.platform === "win32",
2797
+ stdio: options.captureOutput ? "pipe" : "inherit"
2798
+ });
2799
+ const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
2800
+ const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
2801
+ if (result.error || result.status !== 0) {
2802
+ throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
2803
+ cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
2804
+ });
2805
+ }
2806
+ return {
2807
+ ...plannedCommand,
2808
+ exitCode: result.status ?? 0,
2809
+ ...stderr !== undefined ? { stderr } : {},
2810
+ ...stdout !== undefined ? { stdout } : {}
2811
+ };
2812
+ }
2813
+ async function executeSyncCommand({
2814
+ captureOutput = false,
2815
+ check = false,
2816
+ cwd,
2817
+ dryRun = false,
2818
+ target = "default"
2819
+ }) {
2820
+ const project = resolveSyncProjectContext(cwd);
2821
+ const extraArgs = check ? ["--check"] : [];
2822
+ const plannedCommands = buildSyncPlannedCommands(project, extraArgs, target);
2823
+ const result = {
2824
+ check,
2825
+ dryRun,
2826
+ packageJsonPath: project.packageJsonPath,
2827
+ packageManager: project.packageManager,
2828
+ plannedCommands,
2829
+ projectDir: project.cwd,
2830
+ target
2831
+ };
2832
+ if (dryRun) {
2833
+ return result;
2834
+ }
2835
+ assertSyncDependenciesInstalled(project, target);
2836
+ result.executedCommands = plannedCommands.map((plannedCommand) => runProjectScript(project, plannedCommand, {
2837
+ captureOutput
2838
+ }));
2839
+ return result;
2840
+ }
2841
+ // src/command-contract.ts
2842
+ import path5 from "node:path";
2843
+ import {
2844
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES10,
2845
+ createCliDiagnosticCodeError as createCliDiagnosticCodeError9
2846
+ } from "@wp-typia/project-tools/cli-diagnostics";
2733
2847
 
2734
2848
  // src/command-registry.ts
2735
2849
  var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
@@ -2770,7 +2884,7 @@ var WP_TYPIA_COMMAND_REGISTRY = [
2770
2884
  nodeFallback: true,
2771
2885
  optionGroups: ["add"],
2772
2886
  requiresBunRuntime: false,
2773
- subcommands: ADD_KIND_IDS
2887
+ subcommands: ADD_KIND_IDS2
2774
2888
  },
2775
2889
  {
2776
2890
  commandTree: true,
@@ -2997,12 +3111,12 @@ function looksLikeStructuredProjectInput(value) {
2997
3111
  return value.startsWith("@") && value.includes("/");
2998
3112
  }
2999
3113
  function assertPositionalAliasProjectDir(projectDir) {
3000
- const normalizedProjectDir = path4.normalize(projectDir).replace(/[\\/]+$/u, "") || path4.normalize(projectDir);
3114
+ const normalizedProjectDir = path5.normalize(projectDir).replace(/[\\/]+$/u, "") || path5.normalize(projectDir);
3001
3115
  if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
3002
- throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
3116
+ throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
3003
3117
  }
3004
3118
  if (looksLikeStructuredProjectInput(projectDir)) {
3005
- throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `The positional alias only accepts unambiguous local project directories. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for \`${projectDir}\`.`);
3119
+ throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `The positional alias only accepts unambiguous local project directories. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for \`${projectDir}\`.`);
3006
3120
  }
3007
3121
  }
3008
3122
  function normalizeWpTypiaArgv(argv) {
@@ -3016,7 +3130,7 @@ function normalizeWpTypiaArgv(argv) {
3016
3130
  return argv;
3017
3131
  }
3018
3132
  if (firstPositional === "migrations") {
3019
- throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, "`wp-typia migrations` was removed in favor of `wp-typia migrate`. Use `wp-typia migrate <subcommand>` instead.");
3133
+ throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, "`wp-typia migrations` was removed in favor of `wp-typia migrate`. Use `wp-typia migrate <subcommand>` instead.");
3020
3134
  }
3021
3135
  if (isReservedTopLevelCommandName(firstPositional)) {
3022
3136
  assertStringOptionValues(argv);
@@ -3024,7 +3138,7 @@ function normalizeWpTypiaArgv(argv) {
3024
3138
  }
3025
3139
  if (positionalIndexes.length > 1) {
3026
3140
  const extraPositionals = positionalIndexes.slice(1).map((index) => argv[index]).filter((value) => typeof value === "string" && value.length > 0);
3027
- throw createCliDiagnosticCodeError8(CLI_DIAGNOSTIC_CODES9.INVALID_ARGUMENT, `The positional alias only accepts a single project directory. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for scaffold invocations with additional positional arguments, or check the command spelling if you meant another top-level command. Extra positional arguments: ${extraPositionals.map((value) => `\`${value}\``).join(", ")}.`);
3141
+ throw createCliDiagnosticCodeError9(CLI_DIAGNOSTIC_CODES10.INVALID_ARGUMENT, `The positional alias only accepts a single project directory. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for scaffold invocations with additional positional arguments, or check the command spelling if you meant another top-level command. Extra positional arguments: ${extraPositionals.map((value) => `\`${value}\``).join(", ")}.`);
3028
3142
  }
3029
3143
  assertPositionalAliasProjectDir(firstPositional);
3030
3144
  const normalizedArgv = [
@@ -3038,14 +3152,15 @@ function normalizeWpTypiaArgv(argv) {
3038
3152
 
3039
3153
  // src/node-fallback/dispatchers/add.ts
3040
3154
  import {
3041
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES10,
3155
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
3042
3156
  createCliCommandError as createCliCommandError3
3043
3157
  } from "@wp-typia/project-tools/cli-diagnostics";
3044
3158
  async function dispatchNodeFallbackAdd({
3045
3159
  cwd,
3046
3160
  mergedFlags,
3047
3161
  positionals,
3048
- printLine
3162
+ printLine,
3163
+ warnLine
3049
3164
  }) {
3050
3165
  if (!positionals[1]) {
3051
3166
  if (shouldPrintMissingAddKindHelp({ format: mergedFlags.format })) {
@@ -3053,7 +3168,7 @@ async function dispatchNodeFallbackAdd({
3053
3168
  printLine(formatAddHelpText());
3054
3169
  }
3055
3170
  throw createCliCommandError3({
3056
- code: CLI_DIAGNOSTIC_CODES10.MISSING_ARGUMENT,
3171
+ code: CLI_DIAGNOSTIC_CODES11.MISSING_ARGUMENT,
3057
3172
  command: "add",
3058
3173
  detailLines: buildMissingAddKindDetailLines()
3059
3174
  });
@@ -3067,7 +3182,9 @@ async function dispatchNodeFallbackAdd({
3067
3182
  flags: mergedFlags,
3068
3183
  interactive: false,
3069
3184
  kind: positionals[1],
3070
- name: positionals[2]
3185
+ name: positionals[2],
3186
+ printLine,
3187
+ warnLine
3071
3188
  });
3072
3189
  } catch (error) {
3073
3190
  throw createCliCommandError3({
@@ -3088,25 +3205,28 @@ async function dispatchNodeFallbackAdd({
3088
3205
  flags: mergedFlags,
3089
3206
  interactive: undefined,
3090
3207
  kind: positionals[1],
3091
- name: positionals[2]
3208
+ name: positionals[2],
3209
+ printLine,
3210
+ warnLine
3092
3211
  });
3093
3212
  }
3094
3213
 
3095
3214
  // src/node-fallback/dispatchers/create.ts
3096
3215
  import {
3097
- CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
3216
+ CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
3098
3217
  createCliCommandError as createCliCommandError4
3099
3218
  } from "@wp-typia/project-tools/cli-diagnostics";
3100
3219
  async function dispatchNodeFallbackCreate({
3101
3220
  cwd,
3102
3221
  mergedFlags,
3103
3222
  positionals,
3104
- printLine
3223
+ printLine,
3224
+ warnLine
3105
3225
  }) {
3106
3226
  const projectDir = positionals[1];
3107
3227
  if (!projectDir) {
3108
3228
  throw createCliCommandError4({
3109
- code: CLI_DIAGNOSTIC_CODES11.MISSING_ARGUMENT,
3229
+ code: CLI_DIAGNOSTIC_CODES12.MISSING_ARGUMENT,
3110
3230
  command: "create",
3111
3231
  detailLines: buildMissingCreateProjectDirDetailLines()
3112
3232
  });
@@ -3118,7 +3238,9 @@ async function dispatchNodeFallbackCreate({
3118
3238
  emitOutput: mergedFlags.format !== "json",
3119
3239
  flags: mergedFlags,
3120
3240
  interactive: mergedFlags.format === "json" ? false : undefined,
3121
- projectDir
3241
+ printLine,
3242
+ projectDir,
3243
+ warnLine
3122
3244
  });
3123
3245
  } catch (error) {
3124
3246
  throw createCliCommandError4({
@@ -3143,6 +3265,7 @@ var NODE_FALLBACK_RUNTIME_SUMMARY_LINES = [
3143
3265
  `Install Bun 1.3.11+ or use \`bunx wp-typia ...\` for the full Bunli/OpenTUI runtime and Bun-only command surfaces such as \`skills\`, \`completions\`, and \`mcp\`. ${STANDALONE_GUIDANCE_LINE}`,
3144
3266
  "Output markers: WP_TYPIA_ASCII=1 forces ASCII markers, WP_TYPIA_ASCII=0 opts back into Unicode markers, and non-empty NO_COLOR requests ASCII markers when WP_TYPIA_ASCII is unset."
3145
3267
  ];
3268
+ var NODE_FALLBACK_NO_COMMAND_REASON_LINE = "No command provided. Run wp-typia --help for usage information.";
3146
3269
  function renderGeneralHelp(printLine) {
3147
3270
  printBlock(printLine, [
3148
3271
  `wp-typia ${package_default.version}`,
@@ -3161,6 +3284,10 @@ function renderGeneralHelp(printLine) {
3161
3284
  `- ${WP_TYPIA_POSITIONAL_ALIAS_USAGE}`
3162
3285
  ]);
3163
3286
  }
3287
+ function renderNoCommandHelp(printLine) {
3288
+ printBlock(printLine, [NODE_FALLBACK_NO_COMMAND_REASON_LINE, ""]);
3289
+ renderGeneralHelp(printLine);
3290
+ }
3164
3291
  function renderNodeFallbackCommandHelp(printLine, config) {
3165
3292
  printBlock(printLine, [
3166
3293
  config.heading,
@@ -3220,6 +3347,9 @@ var NODE_FALLBACK_BOOLEAN_OPTION_NAMES = ["help", "version"];
3220
3347
  var printLine = (line) => {
3221
3348
  console.log(line);
3222
3349
  };
3350
+ var warnLine = (line) => {
3351
+ console.warn(line);
3352
+ };
3223
3353
  function hasFlagBeforeTerminator(argv, flag) {
3224
3354
  for (const arg of argv) {
3225
3355
  if (arg === "--") {
@@ -3300,7 +3430,7 @@ function renderTemplatesJson(flags, subcommand) {
3300
3430
  const templateId = flags.id;
3301
3431
  if (!templateId) {
3302
3432
  throw createCliCommandError5({
3303
- code: CLI_DIAGNOSTIC_CODES12.MISSING_ARGUMENT,
3433
+ code: CLI_DIAGNOSTIC_CODES13.MISSING_ARGUMENT,
3304
3434
  command: "templates",
3305
3435
  detailLines: ["`wp-typia templates inspect` requires <template-id>."]
3306
3436
  });
@@ -3308,7 +3438,7 @@ function renderTemplatesJson(flags, subcommand) {
3308
3438
  const template = getTemplateById(templateId);
3309
3439
  if (!template) {
3310
3440
  throw createCliCommandError5({
3311
- code: CLI_DIAGNOSTIC_CODES12.INVALID_ARGUMENT,
3441
+ code: CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT,
3312
3442
  command: "templates",
3313
3443
  detailLines: [`Unknown template "${templateId}".`]
3314
3444
  });
@@ -3319,7 +3449,7 @@ function renderTemplatesJson(flags, subcommand) {
3319
3449
  }
3320
3450
  function renderUnsupportedCommand(command) {
3321
3451
  throw createCliCommandError5({
3322
- code: CLI_DIAGNOSTIC_CODES12.UNSUPPORTED_COMMAND,
3452
+ code: CLI_DIAGNOSTIC_CODES13.UNSUPPORTED_COMMAND,
3323
3453
  command,
3324
3454
  detailLines: [
3325
3455
  [
@@ -3345,7 +3475,7 @@ async function renderDoctorJson() {
3345
3475
  }, null, 2));
3346
3476
  if (checks.some((check) => check.status === "fail")) {
3347
3477
  throw createCliCommandError6({
3348
- code: CLI_DIAGNOSTIC_CODES12.DOCTOR_CHECK_FAILED,
3478
+ code: CLI_DIAGNOSTIC_CODES13.DOCTOR_CHECK_FAILED,
3349
3479
  command: "doctor",
3350
3480
  detailLines: getDoctorFailureDetailLines(checks),
3351
3481
  summary: "One or more doctor checks failed."
@@ -3365,7 +3495,9 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3365
3495
  init: async ({
3366
3496
  cwd,
3367
3497
  mergedFlags,
3368
- positionals
3498
+ positionals,
3499
+ printLine: printLine2,
3500
+ warnLine: warnLine2
3369
3501
  }) => {
3370
3502
  const plan = await executeInitCommand({
3371
3503
  apply: Boolean(mergedFlags.apply),
@@ -3373,10 +3505,12 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3373
3505
  packageManager: typeof mergedFlags["package-manager"] === "string" ? mergedFlags["package-manager"] : undefined,
3374
3506
  projectDir: positionals[1]
3375
3507
  }, {
3376
- emitOutput: mergedFlags.format !== "json"
3508
+ emitOutput: mergedFlags.format !== "json",
3509
+ printLine: printLine2,
3510
+ warnLine: warnLine2
3377
3511
  });
3378
3512
  if (mergedFlags.format === "json") {
3379
- printLine(JSON.stringify(buildStructuredInitSuccessPayload(plan), null, 2));
3513
+ printLine2(JSON.stringify(buildStructuredInitSuccessPayload(plan), null, 2));
3380
3514
  }
3381
3515
  },
3382
3516
  migrate: async ({
@@ -3393,7 +3527,9 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3393
3527
  sync: async ({
3394
3528
  cwd,
3395
3529
  mergedFlags,
3396
- positionals
3530
+ positionals,
3531
+ printLine: printLine2,
3532
+ warnLine: warnLine2
3397
3533
  }) => {
3398
3534
  try {
3399
3535
  const syncTarget = resolveSyncExecutionTarget(positionals[1]);
@@ -3405,7 +3541,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3405
3541
  target: syncTarget
3406
3542
  });
3407
3543
  if (mergedFlags.format === "json") {
3408
- printLine(JSON.stringify({
3544
+ printLine2(JSON.stringify({
3409
3545
  sync
3410
3546
  }, null, 2));
3411
3547
  return;
@@ -3417,7 +3553,10 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3417
3553
  plannedCommands: sync.plannedCommands,
3418
3554
  projectDir: sync.projectDir,
3419
3555
  target: sync.target
3420
- }));
3556
+ }), {
3557
+ printLine: printLine2,
3558
+ warnLine: warnLine2
3559
+ });
3421
3560
  }
3422
3561
  } catch (error) {
3423
3562
  throw createCliCommandError5({
@@ -3435,7 +3574,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
3435
3574
  const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
3436
3575
  if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
3437
3576
  throw createCliCommandError5({
3438
- code: CLI_DIAGNOSTIC_CODES12.INVALID_COMMAND,
3577
+ code: CLI_DIAGNOSTIC_CODES13.INVALID_COMMAND,
3439
3578
  command: "templates",
3440
3579
  detailLines: [
3441
3580
  `Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
@@ -3473,7 +3612,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
3473
3612
  const helpTarget = command === "help" ? subcommand : command;
3474
3613
  const versionRequested = hasFlagBeforeTerminator(cliArgv, "--version") || command === "version";
3475
3614
  if (cliArgv.length === 0) {
3476
- renderGeneralHelp(printLine);
3615
+ renderNoCommandHelp(printLine);
3477
3616
  process.exitCode = 1;
3478
3617
  return;
3479
3618
  }
@@ -3508,7 +3647,8 @@ async function runNodeCli(argv = process.argv.slice(2)) {
3508
3647
  cwd: process.cwd(),
3509
3648
  mergedFlags,
3510
3649
  positionals,
3511
- printLine
3650
+ printLine,
3651
+ warnLine
3512
3652
  });
3513
3653
  return;
3514
3654
  }
@@ -3543,4 +3683,4 @@ export {
3543
3683
  hasFlagBeforeTerminator
3544
3684
  };
3545
3685
 
3546
- //# debugId=B5CA87A93189F22464756E2164756E21
3686
+ //# debugId=7726AE527215959664756E2164756E21