wp-typia 0.22.8 → 0.22.9

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.
@@ -36255,6 +36255,48 @@ var init_scaffold_identifiers = __esm(() => {
36255
36255
  PHP_PREFIX_PATTERN = /^[a-z_][a-z0-9_]*$/;
36256
36256
  });
36257
36257
 
36258
+ // ../wp-typia-project-tools/src/runtime/id-suggestions.ts
36259
+ function normalizeCloseId(value2) {
36260
+ return value2.trim().toLowerCase();
36261
+ }
36262
+ function getEditDistance(left, right) {
36263
+ const previous = Array.from({ length: right.length + 1 }, (_2, index) => index);
36264
+ const current = new Array(right.length + 1);
36265
+ for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
36266
+ current[0] = leftIndex + 1;
36267
+ for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
36268
+ const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
36269
+ current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
36270
+ }
36271
+ for (let index = 0;index < current.length; index += 1) {
36272
+ previous[index] = current[index];
36273
+ }
36274
+ }
36275
+ return previous[right.length];
36276
+ }
36277
+ function suggestCloseId(input, candidates, options = {}) {
36278
+ const normalize = options.normalize ?? normalizeCloseId;
36279
+ const normalizedInput = normalize(input);
36280
+ if (normalizedInput.length === 0) {
36281
+ return null;
36282
+ }
36283
+ const maxDistance = options.maxDistance ?? 2;
36284
+ if (maxDistance < 0) {
36285
+ return null;
36286
+ }
36287
+ let bestCandidate = null;
36288
+ for (const candidateId of candidates) {
36289
+ const distance = getEditDistance(normalizedInput, normalize(candidateId));
36290
+ if (bestCandidate === null || distance < bestCandidate.distance) {
36291
+ bestCandidate = {
36292
+ distance,
36293
+ id: candidateId
36294
+ };
36295
+ }
36296
+ }
36297
+ return bestCandidate && bestCandidate.distance <= maxDistance ? bestCandidate.id : null;
36298
+ }
36299
+
36258
36300
  // ../wp-typia-project-tools/src/runtime/cli-add-types.ts
36259
36301
  function resolveEditorPluginSlotAlias(slot) {
36260
36302
  const trimmed = slot.trim();
@@ -36263,6 +36305,9 @@ function resolveEditorPluginSlotAlias(slot) {
36263
36305
  }
36264
36306
  return EDITOR_PLUGIN_SLOT_ALIASES[trimmed];
36265
36307
  }
36308
+ function suggestAddBlockTemplateId(templateId) {
36309
+ return suggestCloseId(templateId, ADD_BLOCK_TEMPLATE_IDS);
36310
+ }
36266
36311
  var REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, EDITOR_PLUGIN_SLOT_ALIASES, ADD_BLOCK_TEMPLATE_IDS;
36267
36312
  var init_cli_add_types = __esm(() => {
36268
36313
  init_cli_add_kind_ids();
@@ -211547,8 +211592,8 @@ var init_ts_property_names = __esm(() => {
211547
211592
  import { readFileSync } from "fs";
211548
211593
  import path26 from "path";
211549
211594
  import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
211550
- function defineInventoryEntryParser(descriptor) {
211551
- return descriptor;
211595
+ function defineInventoryEntryParser() {
211596
+ return (descriptor) => descriptor;
211552
211597
  }
211553
211598
  function findExportedArrayLiteral(sourceFile, exportName) {
211554
211599
  for (const statement of sourceFile.statements) {
@@ -211595,14 +211640,7 @@ function getOptionalStringProperty(entryName, elementIndex, objectLiteral, key2)
211595
211640
  }
211596
211641
  return;
211597
211642
  }
211598
- function getRequiredStringProperty(entryName, elementIndex, objectLiteral, key2) {
211599
- const value2 = getOptionalStringProperty(entryName, elementIndex, objectLiteral, key2);
211600
- if (!value2) {
211601
- throw new Error(`${entryName}[${elementIndex}] is missing required "${key2}" in scripts/block-config.ts.`);
211602
- }
211603
- return value2;
211604
- }
211605
- function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral, key2) {
211643
+ function getOptionalStringArrayProperty(entryName, elementIndex, objectLiteral, key2) {
211606
211644
  for (const property of objectLiteral.properties) {
211607
211645
  if (!import_typescript2.default.isPropertyAssignment(property)) {
211608
211646
  continue;
@@ -211621,7 +211659,19 @@ function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral,
211621
211659
  return element.text;
211622
211660
  });
211623
211661
  }
211624
- throw new Error(`${entryName}[${elementIndex}] is missing required "${key2}" in scripts/block-config.ts.`);
211662
+ return;
211663
+ }
211664
+ function isMissingRequiredInventoryValue(value2) {
211665
+ return value2 === undefined || typeof value2 === "string" && value2.length === 0;
211666
+ }
211667
+ function formatMissingRequiredInventoryFields(keys) {
211668
+ return keys.length === 1 ? `required "${keys[0]}"` : `required fields ${keys.map((key2) => `"${key2}"`).join(", ")}`;
211669
+ }
211670
+ function assertParsedInventoryEntry(entry, descriptor, elementIndex) {
211671
+ const missingRequiredKeys = descriptor.fields.filter((field) => field.required === true && isMissingRequiredInventoryValue(entry[field.key])).map((field) => field.key);
211672
+ if (missingRequiredKeys.length > 0) {
211673
+ throw new Error(`${descriptor.entryName}[${elementIndex}] is missing ${formatMissingRequiredInventoryFields(missingRequiredKeys)} in scripts/block-config.ts.`);
211674
+ }
211625
211675
  }
211626
211676
  function parseInventoryEntries(arrayLiteral, descriptor) {
211627
211677
  return arrayLiteral.elements.map((element, elementIndex) => {
@@ -211631,7 +211681,7 @@ function parseInventoryEntries(arrayLiteral, descriptor) {
211631
211681
  const entry = {};
211632
211682
  for (const field of descriptor.fields) {
211633
211683
  const kind = field.kind ?? "string";
211634
- const value2 = kind === "stringArray" ? getRequiredStringArrayProperty(descriptor.entryName, elementIndex, element, field.key) : field.required ? getRequiredStringProperty(descriptor.entryName, elementIndex, element, field.key) : getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
211684
+ const value2 = kind === "stringArray" ? getOptionalStringArrayProperty(descriptor.entryName, elementIndex, element, field.key) : getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
211635
211685
  field.validate?.(value2, {
211636
211686
  elementIndex,
211637
211687
  entryName: descriptor.entryName,
@@ -211639,6 +211689,7 @@ function parseInventoryEntries(arrayLiteral, descriptor) {
211639
211689
  });
211640
211690
  entry[field.key] = value2;
211641
211691
  }
211692
+ assertParsedInventoryEntry(entry, descriptor, elementIndex);
211642
211693
  return entry;
211643
211694
  });
211644
211695
  }
@@ -211745,13 +211796,19 @@ async function readWorkspaceInventoryAsync(projectDir) {
211745
211796
  ...parseWorkspaceInventorySource(source)
211746
211797
  };
211747
211798
  }
211748
- function getWorkspaceBlockSelectOptions(projectDir) {
211749
- return readWorkspaceInventory(projectDir).blocks.map((block) => ({
211799
+ function toWorkspaceBlockSelectOptions(blocks) {
211800
+ return blocks.map((block) => ({
211750
211801
  description: block.typesFile,
211751
211802
  name: block.slug,
211752
211803
  value: block.slug
211753
211804
  }));
211754
211805
  }
211806
+ function getWorkspaceBlockSelectOptions(projectDir) {
211807
+ return toWorkspaceBlockSelectOptions(readWorkspaceInventory(projectDir).blocks);
211808
+ }
211809
+ async function getWorkspaceBlockSelectOptionsAsync(projectDir) {
211810
+ return toWorkspaceBlockSelectOptions((await readWorkspaceInventoryAsync(projectDir)).blocks);
211811
+ }
211755
211812
  function ensureWorkspaceInventorySections(source) {
211756
211813
  let nextSource = source.trimEnd();
211757
211814
  for (const section of INVENTORY_SECTIONS) {
@@ -212038,7 +212095,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212038
212095
  },
212039
212096
  parse: {
212040
212097
  entriesKey: "blocks",
212041
- entry: defineInventoryEntryParser({
212098
+ entry: defineInventoryEntryParser()({
212042
212099
  entryName: "BLOCKS",
212043
212100
  fields: [
212044
212101
  { key: "apiTypesFile" },
@@ -212064,7 +212121,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212064
212121
  },
212065
212122
  parse: {
212066
212123
  entriesKey: "variations",
212067
- entry: defineInventoryEntryParser({
212124
+ entry: defineInventoryEntryParser()({
212068
212125
  entryName: "VARIATIONS",
212069
212126
  fields: [
212070
212127
  { key: "block", required: true },
@@ -212090,7 +212147,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212090
212147
  },
212091
212148
  parse: {
212092
212149
  entriesKey: "blockStyles",
212093
- entry: defineInventoryEntryParser({
212150
+ entry: defineInventoryEntryParser()({
212094
212151
  entryName: "BLOCK_STYLES",
212095
212152
  fields: [
212096
212153
  { key: "block", required: true },
@@ -212116,7 +212173,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212116
212173
  },
212117
212174
  parse: {
212118
212175
  entriesKey: "blockTransforms",
212119
- entry: defineInventoryEntryParser({
212176
+ entry: defineInventoryEntryParser()({
212120
212177
  entryName: "BLOCK_TRANSFORMS",
212121
212178
  fields: [
212122
212179
  { key: "block", required: true },
@@ -212144,7 +212201,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212144
212201
  },
212145
212202
  parse: {
212146
212203
  entriesKey: "patterns",
212147
- entry: defineInventoryEntryParser({
212204
+ entry: defineInventoryEntryParser()({
212148
212205
  entryName: "PATTERNS",
212149
212206
  fields: [
212150
212207
  { key: "file", required: true },
@@ -212169,7 +212226,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212169
212226
  },
212170
212227
  parse: {
212171
212228
  entriesKey: "bindingSources",
212172
- entry: defineInventoryEntryParser({
212229
+ entry: defineInventoryEntryParser()({
212173
212230
  entryName: "BINDING_SOURCES",
212174
212231
  fields: [
212175
212232
  { key: "attribute" },
@@ -212197,7 +212254,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212197
212254
  },
212198
212255
  parse: {
212199
212256
  entriesKey: "restResources",
212200
- entry: defineInventoryEntryParser({
212257
+ entry: defineInventoryEntryParser()({
212201
212258
  entryName: "REST_RESOURCES",
212202
212259
  fields: [
212203
212260
  { key: "apiFile", required: true },
@@ -212241,7 +212298,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212241
212298
  },
212242
212299
  parse: {
212243
212300
  entriesKey: "abilities",
212244
- entry: defineInventoryEntryParser({
212301
+ entry: defineInventoryEntryParser()({
212245
212302
  entryName: "ABILITIES",
212246
212303
  fields: [
212247
212304
  { key: "clientFile", required: true },
@@ -212274,7 +212331,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212274
212331
  },
212275
212332
  parse: {
212276
212333
  entriesKey: "aiFeatures",
212277
- entry: defineInventoryEntryParser({
212334
+ entry: defineInventoryEntryParser()({
212278
212335
  entryName: "AI_FEATURES",
212279
212336
  fields: [
212280
212337
  { key: "aiSchemaFile", required: true },
@@ -212307,7 +212364,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212307
212364
  },
212308
212365
  parse: {
212309
212366
  entriesKey: "adminViews",
212310
- entry: defineInventoryEntryParser({
212367
+ entry: defineInventoryEntryParser()({
212311
212368
  entryName: "ADMIN_VIEWS",
212312
212369
  fields: [
212313
212370
  { key: "file", required: true },
@@ -212334,7 +212391,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212334
212391
  },
212335
212392
  parse: {
212336
212393
  entriesKey: "editorPlugins",
212337
- entry: defineInventoryEntryParser({
212394
+ entry: defineInventoryEntryParser()({
212338
212395
  entryName: "EDITOR_PLUGINS",
212339
212396
  fields: [
212340
212397
  { key: "file", required: true },
@@ -216471,7 +216528,6 @@ var init_scaffold_apply_utils = __esm(() => {
216471
216528
  });
216472
216529
 
216473
216530
  // ../wp-typia-project-tools/src/runtime/template-builtins.ts
216474
- import fs26 from "fs";
216475
216531
  import path39 from "path";
216476
216532
  import { promises as fsp11 } from "fs";
216477
216533
  function isBuiltInSharedTemplateLayerId(layerId) {
@@ -216521,20 +216577,23 @@ function getBuiltInTemplateLayerDirs(templateId, options = {}) {
216521
216577
  function isOmittableBuiltInTemplateLayerDir(templateId, layerDir) {
216522
216578
  return OMITTABLE_BUILT_IN_OVERLAY_TEMPLATE_IDS.has(templateId) && layerDir === getTemplateById(templateId).templateDir;
216523
216579
  }
216524
- function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
216525
- return layerDirs.flatMap((layerDir) => {
216526
- if (fs26.existsSync(layerDir)) {
216527
- return [layerDir];
216580
+ async function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
216581
+ const materializedLayerDirs = [];
216582
+ for (const layerDir of layerDirs) {
216583
+ if (await pathExists(layerDir)) {
216584
+ materializedLayerDirs.push(layerDir);
216585
+ continue;
216528
216586
  }
216529
216587
  if (isOmittableBuiltInTemplateLayerDir(templateId, layerDir)) {
216530
- return [];
216588
+ continue;
216531
216589
  }
216532
216590
  throw new Error(`Built-in template layer is missing: ${layerDir}`);
216533
- });
216591
+ }
216592
+ return materializedLayerDirs;
216534
216593
  }
216535
216594
  async function materializeBuiltInTemplateSource(templateId, layerDirs) {
216536
216595
  const template = getTemplateById(templateId);
216537
- const materializedLayerDirs = resolveMaterializedTemplateLayerDirs(templateId, layerDirs);
216596
+ const materializedLayerDirs = await resolveMaterializedTemplateLayerDirs(templateId, layerDirs);
216538
216597
  const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-");
216539
216598
  const templateDir = path39.join(tempRoot, templateId);
216540
216599
  try {
@@ -216567,6 +216626,7 @@ async function resolveBuiltInTemplateSource(templateId, options = {}) {
216567
216626
  }
216568
216627
  var BUILT_IN_SHARED_TEMPLATE_LAYERS, BUILT_IN_SHARED_TEMPLATE_LAYER_DIRS, OMITTABLE_BUILT_IN_OVERLAY_TEMPLATE_IDS;
216569
216628
  var init_template_builtins = __esm(() => {
216629
+ init_fs_async();
216570
216630
  init_temp_roots();
216571
216631
  init_template_registry();
216572
216632
  BUILT_IN_SHARED_TEMPLATE_LAYERS = Object.freeze([
@@ -220231,7 +220291,6 @@ var init_template_source_locators = __esm(() => {
220231
220291
  });
220232
220292
 
220233
220293
  // ../wp-typia-project-tools/src/runtime/template-layers.ts
220234
- import fs27 from "fs";
220235
220294
  import path41 from "path";
220236
220295
  import { promises as fsp12 } from "fs";
220237
220296
  function resolveLayerPath(sourceRoot, relativePath) {
@@ -220281,7 +220340,7 @@ function parseLayerDefinition(layerId, value2) {
220281
220340
  }
220282
220341
  async function loadExternalTemplateLayerManifest(sourceRoot) {
220283
220342
  const manifestPath = path41.join(sourceRoot, TEMPLATE_LAYER_MANIFEST_FILENAME);
220284
- if (!fs27.existsSync(manifestPath)) {
220343
+ if (!await pathExists(manifestPath)) {
220285
220344
  return null;
220286
220345
  }
220287
220346
  const raw = JSON.parse(await fsp12.readFile(manifestPath, "utf8"));
@@ -220416,13 +220475,14 @@ async function assertExternalTemplateLayersDoNotWriteProtectedOutputs({
220416
220475
  }
220417
220476
  var TEMPLATE_LAYER_MANIFEST_FILENAME = "wp-typia.layers.json", TEMPLATE_LAYER_MANIFEST_VERSION = 1;
220418
220477
  var init_template_layers = __esm(() => {
220478
+ init_fs_async();
220419
220479
  init_object_utils();
220420
220480
  init_template_builtins();
220421
220481
  init_template_render();
220422
220482
  });
220423
220483
 
220424
220484
  // ../wp-typia-project-tools/src/runtime/external-template-guards.ts
220425
- import fs28 from "fs";
220485
+ import fs26 from "fs";
220426
220486
  function parsePositiveIntegerEnv(value2, fallback) {
220427
220487
  if (typeof value2 !== "string" || value2.trim().length === 0) {
220428
220488
  return fallback;
@@ -220457,7 +220517,7 @@ function createExternalTemplateTooLargeError(label, maxBytes) {
220457
220517
  return createTemplateGuardError(TEMPLATE_SOURCE_TOO_LARGE_CODE, `${label} exceeded the external template size limit (${maxBytes} bytes).`);
220458
220518
  }
220459
220519
  function assertExternalTemplateFileSize(filePath, options) {
220460
- const stats = fs28.statSync(filePath);
220520
+ const stats = fs26.statSync(filePath);
220461
220521
  if (stats.size > options.maxBytes) {
220462
220522
  throw createExternalTemplateTooLargeError(options.label, options.maxBytes);
220463
220523
  }
@@ -220551,7 +220611,6 @@ var init_external_template_guards = __esm(() => {
220551
220611
  });
220552
220612
 
220553
220613
  // ../wp-typia-project-tools/src/runtime/template-source-external.ts
220554
- import fs29 from "fs";
220555
220614
  import { promises as fsp13 } from "fs";
220556
220615
  import path42 from "path";
220557
220616
  import { pathToFileURL } from "url";
@@ -220696,9 +220755,9 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
220696
220755
  const view = await buildExternalTemplateView(context, config2, selectedVariant, variantConfig);
220697
220756
  const blockTemplateDir = resolveSourceSubpath(sourceDir, templatePath);
220698
220757
  await copyRenderedDirectory(blockTemplateDir, blockDir, view, {
220699
- filter: (sourcePath, _destinationPath, entry) => {
220758
+ filter: async (sourcePath, _destinationPath, entry) => {
220700
220759
  const mustacheVariantPath = path42.join(path42.dirname(sourcePath), `${entry.name}.mustache`);
220701
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs29.existsSync(mustacheVariantPath));
220760
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
220702
220761
  }
220703
220762
  });
220704
220763
  const assetsPath = typeof variantConfig.assetsPath === "string" ? variantConfig.assetsPath : config2.assetsPath;
@@ -220736,7 +220795,6 @@ var init_template_source_external = __esm(() => {
220736
220795
  });
220737
220796
 
220738
220797
  // ../wp-typia-project-tools/src/runtime/template-source-remote.ts
220739
- import fs30 from "fs";
220740
220798
  import { promises as fsp14 } from "fs";
220741
220799
  import path43 from "path";
220742
220800
  async function cleanupSeedRootPair(cleanup, seedCleanup) {
@@ -220821,9 +220879,9 @@ async function normalizeWpTypiaTemplateSeed(seed) {
220821
220879
  const normalizedDir = path43.join(tempRoot, "template");
220822
220880
  try {
220823
220881
  await copyRawDirectory(seed.blockDir, normalizedDir, {
220824
- filter: (sourcePath, _targetPath, entry) => {
220882
+ filter: async (sourcePath, _targetPath, entry) => {
220825
220883
  const mustacheVariantPath = path43.join(path43.dirname(sourcePath), `${entry.name}.mustache`);
220826
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs30.existsSync(mustacheVariantPath));
220884
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
220827
220885
  }
220828
220886
  });
220829
220887
  if (seed.assetsDir && await pathExists(seed.assetsDir)) {
@@ -221541,7 +221599,7 @@ var kr, vr = (s, t2) => {
221541
221599
  }, Gn = (s3, t2) => {
221542
221600
  let e = new Et(s3);
221543
221601
  return hr(e, t2).catch((i) => e.emit("error", i)), e;
221544
- }, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs31 = (s3, t2, e) => {
221602
+ }, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs27 = (s3, t2, e) => {
221545
221603
  try {
221546
221604
  return mi.lchownSync(s3, t2, e);
221547
221605
  } catch (i) {
@@ -221586,7 +221644,7 @@ var kr, vr = (s, t2) => {
221586
221644
  Xn(s3, l, t2, e, a);
221587
221645
  });
221588
221646
  }, qn = (s3, t2, e, i) => {
221589
- t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i), fs31(Ee2.resolve(s3, t2.name), e, i);
221647
+ t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i), fs27(Ee2.resolve(s3, t2.name), e, i);
221590
221648
  }, us = (s3, t2, e) => {
221591
221649
  let i;
221592
221650
  try {
@@ -221596,12 +221654,12 @@ var kr, vr = (s, t2) => {
221596
221654
  if (n?.code === "ENOENT")
221597
221655
  return;
221598
221656
  if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP")
221599
- return fs31(s3, t2, e);
221657
+ return fs27(s3, t2, e);
221600
221658
  throw n;
221601
221659
  }
221602
221660
  for (let r of i)
221603
221661
  qn(s3, r, t2, e);
221604
- return fs31(s3, t2, e);
221662
+ return fs27(s3, t2, e);
221605
221663
  }, we2, wt, Qn = (s3, t2) => {
221606
221664
  k2.stat(s3, (e, i) => {
221607
221665
  (e || !i.isDirectory()) && (e = new we2(s3, e?.code || "ENOTDIR")), t2(e);
@@ -224770,7 +224828,7 @@ var init_template_source_cache = __esm(() => {
224770
224828
  });
224771
224829
 
224772
224830
  // ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
224773
- import fs32 from "fs";
224831
+ import fs28 from "fs";
224774
224832
  import { promises as fsp16 } from "fs";
224775
224833
  import { createRequire as createRequire3 } from "module";
224776
224834
  import path47 from "path";
@@ -224936,8 +224994,8 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224936
224994
  return null;
224937
224995
  }
224938
224996
  const workspacePackagesRoot = path47.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
224939
- if (fs32.existsSync(workspacePackagesRoot)) {
224940
- for (const entry of fs32.readdirSync(workspacePackagesRoot, {
224997
+ if (fs28.existsSync(workspacePackagesRoot)) {
224998
+ for (const entry of fs28.readdirSync(workspacePackagesRoot, {
224941
224999
  withFileTypes: true
224942
225000
  })) {
224943
225001
  if (!entry.isDirectory()) {
@@ -224945,10 +225003,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224945
225003
  }
224946
225004
  const packageDir = path47.join(workspacePackagesRoot, entry.name);
224947
225005
  const packageJsonPath = path47.join(packageDir, "package.json");
224948
- if (!fs32.existsSync(packageJsonPath)) {
225006
+ if (!fs28.existsSync(packageJsonPath)) {
224949
225007
  continue;
224950
225008
  }
224951
- const manifest = JSON.parse(fs32.readFileSync(packageJsonPath, "utf8"));
225009
+ const manifest = JSON.parse(fs28.readFileSync(packageJsonPath, "utf8"));
224952
225010
  if (manifest.name === locator.name) {
224953
225011
  return {
224954
225012
  blockDir: packageDir,
@@ -224959,7 +225017,7 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224959
225017
  }
224960
225018
  const workspaceRequire = createRequire3(path47.join(path47.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
224961
225019
  try {
224962
- const packageJsonPath = fs32.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
225020
+ const packageJsonPath = fs28.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
224963
225021
  const sourceDir = path47.dirname(packageJsonPath);
224964
225022
  return {
224965
225023
  blockDir: sourceDir,
@@ -224970,10 +225028,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224970
225028
  if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
224971
225029
  for (const basePath of workspaceRequire.resolve.paths(locator.name) ?? []) {
224972
225030
  const packageJsonPath = path47.join(basePath, locator.name, "package.json");
224973
- if (!fs32.existsSync(packageJsonPath)) {
225031
+ if (!fs28.existsSync(packageJsonPath)) {
224974
225032
  continue;
224975
225033
  }
224976
- const sourceDir = path47.dirname(fs32.realpathSync(packageJsonPath));
225034
+ const sourceDir = path47.dirname(fs28.realpathSync(packageJsonPath));
224977
225035
  return {
224978
225036
  blockDir: sourceDir,
224979
225037
  rootDir: sourceDir
@@ -224984,13 +225042,13 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224984
225042
  throw error48;
224985
225043
  }
224986
225044
  }
224987
- function isOfficialWorkspaceTemplateSeed(seed) {
225045
+ async function isOfficialWorkspaceTemplateSeedAsync(seed) {
224988
225046
  const packageJsonPath = path47.join(seed.rootDir, "package.json");
224989
- if (!fs32.existsSync(packageJsonPath)) {
225047
+ if (!await pathExists(packageJsonPath)) {
224990
225048
  return false;
224991
225049
  }
224992
225050
  try {
224993
- const packageJson = JSON.parse(fs32.readFileSync(packageJsonPath, "utf8"));
225051
+ const packageJson = JSON.parse(await fsp16.readFile(packageJsonPath, "utf8"));
224994
225052
  return packageJson.name === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE;
224995
225053
  } catch {
224996
225054
  return false;
@@ -225033,13 +225091,13 @@ function runGitTemplateCommand(args, label, options = {}) {
225033
225091
  function getGitHubTemplateRepositoryUrl(locator) {
225034
225092
  return `https://github.com/${locator.owner}/${locator.repo}.git`;
225035
225093
  }
225036
- function resolveGitHubTemplateDirectory(checkoutDir, locator) {
225094
+ async function resolveGitHubTemplateDirectory(checkoutDir, locator) {
225037
225095
  const sourceDir = path47.resolve(checkoutDir, locator.sourcePath);
225038
225096
  const relativeSourceDir = path47.relative(checkoutDir, sourceDir);
225039
225097
  if (relativeSourceDir.startsWith("..") || path47.isAbsolute(relativeSourceDir)) {
225040
225098
  throw new Error("GitHub template path must stay within the cloned repository.");
225041
225099
  }
225042
- if (!fs32.existsSync(sourceDir)) {
225100
+ if (!await pathExists(sourceDir)) {
225043
225101
  throw new Error(`GitHub template path does not exist: ${locator.sourcePath}`);
225044
225102
  }
225045
225103
  return sourceDir;
@@ -225163,7 +225221,7 @@ async function reuseGitHubTemplateCacheByMetadata(locator) {
225163
225221
  if (!cachedSource) {
225164
225222
  return null;
225165
225223
  }
225166
- const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
225224
+ const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
225167
225225
  await assertNoSymlinks2(sourceDir);
225168
225226
  return {
225169
225227
  blockDir: sourceDir,
@@ -225206,12 +225264,12 @@ async function resolveGitHubTemplateSource(locator) {
225206
225264
  namespace: "github"
225207
225265
  }, async (checkoutDir2) => {
225208
225266
  cloneGitHubTemplateSource(locator, checkoutDir2);
225209
- const sourceDir = resolveGitHubTemplateDirectory(checkoutDir2, locator);
225267
+ const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir2, locator);
225210
225268
  await assertNoSymlinks2(sourceDir);
225211
225269
  pinGitHubTemplateCacheRevision(locator, checkoutDir2, resolvedCacheRevision);
225212
225270
  });
225213
225271
  if (cachedSource) {
225214
- const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
225272
+ const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
225215
225273
  await assertNoSymlinks2(sourceDir);
225216
225274
  return {
225217
225275
  blockDir: sourceDir,
@@ -225228,7 +225286,7 @@ async function resolveGitHubTemplateSource(locator) {
225228
225286
  const checkoutDir = path47.join(remoteRoot, "source");
225229
225287
  try {
225230
225288
  cloneGitHubTemplateSource(locator, checkoutDir);
225231
- const sourceDir = resolveGitHubTemplateDirectory(checkoutDir, locator);
225289
+ const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir, locator);
225232
225290
  await assertNoSymlinks2(sourceDir);
225233
225291
  return {
225234
225292
  blockDir: sourceDir,
@@ -225243,7 +225301,7 @@ async function resolveGitHubTemplateSource(locator) {
225243
225301
  async function resolveTemplateSeed(locator, cwd) {
225244
225302
  if (locator.kind === "path") {
225245
225303
  const sourceDir = path47.resolve(cwd, locator.templatePath);
225246
- if (!fs32.existsSync(sourceDir)) {
225304
+ if (!await pathExists(sourceDir)) {
225247
225305
  throw new Error(`Template path does not exist: ${sourceDir}`);
225248
225306
  }
225249
225307
  await assertNoSymlinks2(sourceDir);
@@ -225268,6 +225326,7 @@ var init_template_source_seeds = __esm(() => {
225268
225326
  init_external_template_guards();
225269
225327
  init_template_source_cache();
225270
225328
  init_cli_diagnostics();
225329
+ init_fs_async();
225271
225330
  init_template_registry();
225272
225331
  init_object_utils();
225273
225332
  init_temp_roots();
@@ -225279,7 +225338,7 @@ var init_template_source_seeds = __esm(() => {
225279
225338
  });
225280
225339
 
225281
225340
  // ../wp-typia-project-tools/src/runtime/cli-validation.ts
225282
- import fs33 from "fs";
225341
+ import fs29 from "fs";
225283
225342
  import path48 from "path";
225284
225343
  function normalizeOptionalCliString(value2) {
225285
225344
  if (typeof value2 !== "string") {
@@ -225297,7 +225356,7 @@ function resolveLocalCliPathOption(options) {
225297
225356
  return normalizedValue;
225298
225357
  }
225299
225358
  const resolvedPath = path48.resolve(options.cwd, normalizedValue);
225300
- if (!fs33.existsSync(resolvedPath)) {
225359
+ if (!fs29.existsSync(resolvedPath)) {
225301
225360
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `\`${options.label}\` path does not exist: ${resolvedPath}. Check the path relative to ${options.cwd}.`);
225302
225361
  }
225303
225362
  return resolvedPath;
@@ -225339,7 +225398,7 @@ async function resolveTemplateSource(templateId, cwd, variables, variant) {
225339
225398
  const locator = parseTemplateLocator(templateId);
225340
225399
  const context = getTemplateVariableContext(variables);
225341
225400
  const seed = await resolveTemplateSeed(locator, cwd);
225342
- const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE || isOfficialWorkspaceTemplateSeed(seed);
225401
+ const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE || await isOfficialWorkspaceTemplateSeedAsync(seed);
225343
225402
  let normalizedSeed = null;
225344
225403
  try {
225345
225404
  const format3 = await detectTemplateSourceFormat(seed.blockDir);
@@ -230738,37 +230797,12 @@ function looksLikeExplicitNonNpmExternalTemplateLocator(templateId) {
230738
230797
  function looksLikeExplicitCreateExternalTemplateLocator(templateId) {
230739
230798
  return looksLikeExplicitNonNpmExternalTemplateLocator(templateId) || parseNpmTemplateLocator(templateId) !== null;
230740
230799
  }
230741
- function getEditDistance(left, right) {
230742
- const previous = Array.from({ length: right.length + 1 }, (_3, index) => index);
230743
- const current = new Array(right.length + 1);
230744
- for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
230745
- current[0] = leftIndex + 1;
230746
- for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
230747
- const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
230748
- current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
230749
- }
230750
- for (let index = 0;index < current.length; index += 1) {
230751
- previous[index] = current[index];
230752
- }
230753
- }
230754
- return previous[right.length];
230755
- }
230756
230800
  function findMistypedBuiltInTemplateSuggestion(templateId) {
230757
230801
  const normalizedTemplateId = templateId.trim().toLowerCase();
230758
230802
  if (normalizedTemplateId.length === 0 || looksLikeExplicitNonNpmExternalTemplateLocator(normalizedTemplateId)) {
230759
230803
  return null;
230760
230804
  }
230761
- let bestCandidate = null;
230762
- for (const candidateId of TEMPLATE_SUGGESTION_IDS) {
230763
- const distance = getEditDistance(normalizedTemplateId, candidateId);
230764
- if (bestCandidate === null || distance < bestCandidate.distance) {
230765
- bestCandidate = {
230766
- distance,
230767
- id: candidateId
230768
- };
230769
- }
230770
- }
230771
- return bestCandidate && bestCandidate.distance <= 2 ? bestCandidate.id : null;
230805
+ return suggestCloseId(normalizedTemplateId, TEMPLATE_SUGGESTION_IDS);
230772
230806
  }
230773
230807
  function getMistypedBuiltInTemplateMessage(templateId) {
230774
230808
  const suggestion = findMistypedBuiltInTemplateSuggestion(templateId);
@@ -230971,7 +231005,6 @@ var init_scaffold_answer_resolution = __esm(() => {
230971
231005
  });
230972
231006
 
230973
231007
  // ../wp-typia-project-tools/src/runtime/scaffold.ts
230974
- import fs34 from "fs";
230975
231008
  import { promises as fsp17 } from "fs";
230976
231009
  import path50 from "path";
230977
231010
  function isDataStorageMode(value2) {
@@ -231120,7 +231153,7 @@ async function scaffoldProject({
231120
231153
  title: "Finalizing scaffold output"
231121
231154
  });
231122
231155
  const readmePath = path50.join(projectDir, "README.md");
231123
- if (!fs34.existsSync(readmePath)) {
231156
+ if (!await pathExists(readmePath)) {
231124
231157
  await fsp17.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
231125
231158
  withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
231126
231159
  withTestPreset: isBuiltInTemplate ? withTestPreset : false,
@@ -231128,7 +231161,7 @@ async function scaffoldProject({
231128
231161
  }), "utf8");
231129
231162
  }
231130
231163
  const gitignorePath = path50.join(projectDir, ".gitignore");
231131
- const existingGitignore = fs34.existsSync(gitignorePath) ? await fsp17.readFile(gitignorePath, "utf8") : "";
231164
+ const existingGitignore = await pathExists(gitignorePath) ? await fsp17.readFile(gitignorePath, "utf8") : "";
231132
231165
  await fsp17.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
231133
231166
  await normalizePackageJson(projectDir, resolvedPackageManager);
231134
231167
  if (isBuiltInTemplate) {
@@ -231183,6 +231216,7 @@ var init_scaffold = __esm(() => {
231183
231216
  init_scaffold_template_variables();
231184
231217
  init_scaffold_template_variable_groups();
231185
231218
  init_cli_validation();
231219
+ init_fs_async();
231186
231220
  init_scaffold_identifiers();
231187
231221
  init_scaffold_answer_resolution();
231188
231222
  init_scaffold_template_variables();
@@ -231343,7 +231377,7 @@ var init_cli_add_block_config = __esm(() => {
231343
231377
  });
231344
231378
 
231345
231379
  // ../wp-typia-project-tools/src/runtime/cli-add-block-legacy-validator.ts
231346
- import fs35 from "fs";
231380
+ import fs30 from "fs";
231347
231381
  import { promises as fsp18 } from "fs";
231348
231382
  import path52 from "path";
231349
231383
  function ensureBlockConfigCanAddRestManifests(source) {
@@ -231450,14 +231484,14 @@ async function ensureLegacyCompoundValidatorManifestDefaultsWrapper(validatorPat
231450
231484
  const validatorDir = path52.dirname(validatorPath);
231451
231485
  const wrapperPath = path52.join(validatorDir, "manifest-defaults-document.ts");
231452
231486
  const manifestPath = path52.join(validatorDir, "typia.manifest.json");
231453
- if (fs35.existsSync(wrapperPath) || !fs35.existsSync(manifestPath)) {
231487
+ if (fs30.existsSync(wrapperPath) || !fs30.existsSync(manifestPath)) {
231454
231488
  return;
231455
231489
  }
231456
231490
  await fsp18.writeFile(wrapperPath, renderLegacyManifestDefaultsWrapperSource(), "utf8");
231457
231491
  }
231458
231492
  async function collectLegacyCompoundValidatorPaths(projectDir) {
231459
231493
  const blocksDir = path52.join(projectDir, "src", "blocks");
231460
- if (!fs35.existsSync(blocksDir)) {
231494
+ if (!fs30.existsSync(blocksDir)) {
231461
231495
  return [];
231462
231496
  }
231463
231497
  const blockEntries = await fsp18.readdir(blocksDir, { withFileTypes: true });
@@ -231471,7 +231505,7 @@ async function collectLegacyCompoundValidatorPaths(projectDir) {
231471
231505
  async function ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths) {
231472
231506
  for (const fileName of COMPOUND_SHARED_SUPPORT_FILES) {
231473
231507
  const sourcePath = path52.join(tempProjectDir, "src", fileName);
231474
- if (!fs35.existsSync(sourcePath)) {
231508
+ if (!fs30.existsSync(sourcePath)) {
231475
231509
  continue;
231476
231510
  }
231477
231511
  const targetPath = path52.join(projectDir, "src", fileName);
@@ -231620,6 +231654,13 @@ async function assertWorkspaceDependenciesInstalled(workspace) {
231620
231654
  }
231621
231655
  throw new Error(`Workspace dependencies have not been installed yet. Run \`${formatInstallCommand(workspace.packageManager)}\` from the workspace root before using \`wp-typia add block ...\`.`);
231622
231656
  }
231657
+ function getMistypedAddBlockTemplateMessage2(templateId) {
231658
+ const suggestion = suggestAddBlockTemplateId(templateId);
231659
+ if (!suggestion) {
231660
+ return null;
231661
+ }
231662
+ return `Unknown add-block template "${templateId}". Did you mean "${suggestion}"? Use \`--template ${suggestion}\`, or run \`wp-typia templates list\` to inspect available templates.`;
231663
+ }
231623
231664
  async function copyScaffoldedBlockSlice(projectDir, templateId, tempProjectDir, variables, legacyValidatorPaths = []) {
231624
231665
  if (templateId === "compound") {
231625
231666
  await ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths);
@@ -231797,6 +231838,10 @@ async function runAddBlockCommand({
231797
231838
  throw new Error("`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
231798
231839
  }
231799
231840
  if (!isAddBlockTemplateId(templateId)) {
231841
+ const mistypedAddBlockTemplateMessage = getMistypedAddBlockTemplateMessage2(templateId);
231842
+ if (mistypedAddBlockTemplateMessage) {
231843
+ throw new Error(mistypedAddBlockTemplateMessage);
231844
+ }
231800
231845
  throw new Error(`Unknown add-block template "${templateId}". Expected one of: ${ADD_BLOCK_TEMPLATE_IDS.join(", ")}. Run \`wp-typia templates list\` to inspect available templates.`);
231801
231846
  }
231802
231847
  const resolvedTemplateId = templateId;
@@ -238736,6 +238781,7 @@ var init_cli_add_workspace = __esm(() => {
238736
238781
  // ../wp-typia-project-tools/src/runtime/cli-add.ts
238737
238782
  var exports_cli_add = {};
238738
238783
  __export(exports_cli_add, {
238784
+ suggestAddBlockTemplateId: () => suggestAddBlockTemplateId,
238739
238785
  seedWorkspaceMigrationProject: () => seedWorkspaceMigrationProject,
238740
238786
  runAddVariationCommand: () => runAddVariationCommand,
238741
238787
  runAddRestResourceCommand: () => runAddRestResourceCommand,
@@ -238750,6 +238796,7 @@ __export(exports_cli_add, {
238750
238796
  runAddAdminViewCommand: () => runAddAdminViewCommand,
238751
238797
  runAddAbilityCommand: () => runAddAbilityCommand,
238752
238798
  isAddBlockTemplateId: () => isAddBlockTemplateId,
238799
+ getWorkspaceBlockSelectOptionsAsync: () => getWorkspaceBlockSelectOptionsAsync,
238753
238800
  getWorkspaceBlockSelectOptions: () => getWorkspaceBlockSelectOptions,
238754
238801
  formatAddHelpText: () => formatAddHelpText,
238755
238802
  EDITOR_PLUGIN_SLOT_IDS: () => EDITOR_PLUGIN_SLOT_IDS,
@@ -238766,7 +238813,7 @@ var init_cli_add = __esm(() => {
238766
238813
  // ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
238767
238814
  import { execFileSync as execFileSync3 } from "child_process";
238768
238815
  import { access, constants as fsConstants, rm as rm2, writeFile as writeFile6 } from "fs/promises";
238769
- import fs36 from "fs";
238816
+ import fs31 from "fs";
238770
238817
  import os5 from "os";
238771
238818
  import path65 from "path";
238772
238819
  function readCommandVersion(command, args = ["--version"]) {
@@ -238808,8 +238855,8 @@ function getTemplateDoctorChecks() {
238808
238855
  const checks3 = [];
238809
238856
  for (const template of listTemplates()) {
238810
238857
  if (!isBuiltInTemplateId(template.id)) {
238811
- const templateDirExists = fs36.existsSync(template.templateDir);
238812
- const hasAssets2 = templateDirExists && fs36.existsSync(path65.join(template.templateDir, "package.json.mustache"));
238858
+ const templateDirExists = fs31.existsSync(template.templateDir);
238859
+ const hasAssets2 = templateDirExists && fs31.existsSync(path65.join(template.templateDir, "package.json.mustache"));
238813
238860
  checks3.push({
238814
238861
  status: !templateDirExists || hasAssets2 ? "pass" : "fail",
238815
238862
  label: `Template ${template.id}`,
@@ -238832,9 +238879,9 @@ function getTemplateDoctorChecks() {
238832
238879
  persistencePolicy: "public"
238833
238880
  })
238834
238881
  ])) : getBuiltInTemplateLayerDirs(builtInTemplateId);
238835
- const missingRequiredLayer = layerDirs.some((layerDir) => !fs36.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
238836
- const existingLayerDirs = layerDirs.filter((layerDir) => fs36.existsSync(layerDir));
238837
- const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs36.existsSync(path65.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs36.existsSync(path65.join(layerDir, "src")));
238882
+ const missingRequiredLayer = layerDirs.some((layerDir) => !fs31.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
238883
+ const existingLayerDirs = layerDirs.filter((layerDir) => fs31.existsSync(layerDir));
238884
+ const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs31.existsSync(path65.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs31.existsSync(path65.join(layerDir, "src")));
238838
238885
  checks3.push({
238839
238886
  status: hasAssets ? "pass" : "fail",
238840
238887
  label: `Template ${template.id}`,
@@ -238864,7 +238911,7 @@ var init_cli_doctor_environment = __esm(() => {
238864
238911
  });
238865
238912
 
238866
238913
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-shared.ts
238867
- import fs37 from "fs";
238914
+ import fs32 from "fs";
238868
238915
  import path66 from "path";
238869
238916
  function createDoctorCheck2(label, status, detail, code) {
238870
238917
  return code ? { code, detail, label, status } : { detail, label, status };
@@ -238879,7 +238926,7 @@ function resolveWorkspaceBootstrapPath(projectDir, packageName) {
238879
238926
  return path66.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
238880
238927
  }
238881
238928
  function checkExistingFiles(projectDir, label, filePaths) {
238882
- const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs37.existsSync(path66.join(projectDir, filePath)));
238929
+ const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs32.existsSync(path66.join(projectDir, filePath)));
238883
238930
  return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
238884
238931
  }
238885
238932
  var WORKSPACE_BINDING_SERVER_GLOB = "/src/bindings/*/server.php", WORKSPACE_BINDING_EDITOR_SCRIPT = "build/bindings/index.js", WORKSPACE_BINDING_EDITOR_ASSET = "build/bindings/index.asset.php", WORKSPACE_REST_RESOURCE_GLOB = "/inc/rest/*.php", WORKSPACE_ABILITY_GLOB = "/inc/abilities/*.php", WORKSPACE_ABILITY_EDITOR_SCRIPT = "build/abilities/index.js", WORKSPACE_ABILITY_EDITOR_ASSET = "build/abilities/index.asset.php", WORKSPACE_AI_FEATURE_GLOB = "/inc/ai-features/*.php", WORKSPACE_ADMIN_VIEW_GLOB = "/inc/admin-views/*.php", WORKSPACE_ADMIN_VIEW_SCRIPT = "build/admin-views/index.js", WORKSPACE_ADMIN_VIEW_ASSET = "build/admin-views/index.asset.php", WORKSPACE_ADMIN_VIEW_STYLE = "build/admin-views/style-index.css", WORKSPACE_EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", WORKSPACE_EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", WORKSPACE_EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", WORKSPACE_GENERATED_BLOCK_ARTIFACTS, WORKSPACE_FULL_BLOCK_NAME_PATTERN;
@@ -238895,15 +238942,15 @@ var init_cli_doctor_workspace_shared = __esm(() => {
238895
238942
  });
238896
238943
 
238897
238944
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
238898
- import fs38 from "fs";
238945
+ import fs33 from "fs";
238899
238946
  import path67 from "path";
238900
238947
  import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata2 } from "@wp-typia/block-runtime/blocks";
238901
238948
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
238902
238949
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
238903
- if (!fs38.existsSync(bootstrapPath)) {
238950
+ if (!fs33.existsSync(bootstrapPath)) {
238904
238951
  return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path67.basename(bootstrapPath)}`);
238905
238952
  }
238906
- const source = fs38.readFileSync(bootstrapPath, "utf8");
238953
+ const source = fs33.readFileSync(bootstrapPath, "utf8");
238907
238954
  const hasServerGlob = source.includes(WORKSPACE_BINDING_SERVER_GLOB);
238908
238955
  const hasEditorEnqueueHook = source.includes("enqueue_block_editor_assets");
238909
238956
  const hasEditorScript = source.includes(WORKSPACE_BINDING_EDITOR_SCRIPT);
@@ -238911,12 +238958,12 @@ function checkWorkspaceBindingBootstrap(projectDir, packageName) {
238911
238958
  return createDoctorCheck2("Binding bootstrap", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "pass" : "fail", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "Binding source PHP and editor bootstrap hooks are present" : "Missing binding source PHP require glob or editor enqueue hook");
238912
238959
  }
238913
238960
  function checkWorkspaceBindingSourcesIndex(projectDir, bindingSources) {
238914
- const indexRelativePath = [path67.join("src", "bindings", "index.ts"), path67.join("src", "bindings", "index.js")].find((relativePath) => fs38.existsSync(path67.join(projectDir, relativePath)));
238961
+ const indexRelativePath = [path67.join("src", "bindings", "index.ts"), path67.join("src", "bindings", "index.js")].find((relativePath) => fs33.existsSync(path67.join(projectDir, relativePath)));
238915
238962
  if (!indexRelativePath) {
238916
238963
  return createDoctorCheck2("Binding sources index", "fail", "Missing src/bindings/index.ts or src/bindings/index.js");
238917
238964
  }
238918
238965
  const indexPath = path67.join(projectDir, indexRelativePath);
238919
- const source = fs38.readFileSync(indexPath, "utf8");
238966
+ const source = fs33.readFileSync(indexPath, "utf8");
238920
238967
  const missingImports = bindingSources.filter((bindingSource) => !source.includes(`./${bindingSource.slug}/editor`));
238921
238968
  return createDoctorCheck2("Binding sources index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Binding source editor registrations are aggregated" : `Missing editor imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
238922
238969
  }
@@ -238936,7 +238983,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238936
238983
  const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
238937
238984
  const issues = [];
238938
238985
  try {
238939
- const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs38.readFileSync(blockJsonPath, "utf8")));
238986
+ const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs33.readFileSync(blockJsonPath, "utf8")));
238940
238987
  const attributes = blockJson.attributes;
238941
238988
  if (!attributes || typeof attributes !== "object" || Array.isArray(attributes)) {
238942
238989
  issues.push(`${blockJsonRelativePath} must define an attributes object`);
@@ -238950,8 +238997,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238950
238997
  issues.push(error48 instanceof Error ? `Unable to read ${blockJsonRelativePath}: ${error48.message}` : `Unable to read ${blockJsonRelativePath}.`);
238951
238998
  }
238952
238999
  const serverPath = path67.join(projectDir, bindingSource.serverFile);
238953
- if (fs38.existsSync(serverPath)) {
238954
- const serverSource = fs38.readFileSync(serverPath, "utf8");
239000
+ if (fs33.existsSync(serverPath)) {
239001
+ const serverSource = fs33.readFileSync(serverPath, "utf8");
238955
239002
  const supportedAttributesFilter = `block_bindings_supported_attributes_${workspace.workspace.namespace}/${bindingSource.block}`;
238956
239003
  if (!serverSource.includes(supportedAttributesFilter)) {
238957
239004
  issues.push(`${bindingSource.serverFile} must register ${supportedAttributesFilter}`);
@@ -238963,8 +239010,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238963
239010
  issues.push(`Missing ${bindingSource.serverFile}`);
238964
239011
  }
238965
239012
  const editorPath = path67.join(projectDir, bindingSource.editorFile);
238966
- if (fs38.existsSync(editorPath)) {
238967
- const editorSource = fs38.readFileSync(editorPath, "utf8");
239013
+ if (fs33.existsSync(editorPath)) {
239014
+ const editorSource = fs33.readFileSync(editorPath, "utf8");
238968
239015
  const blockName = `${workspace.workspace.namespace}/${bindingSource.block}`;
238969
239016
  const bindingSourceTargetMatch = editorSource.match(/export\s+const\s+BINDING_SOURCE_TARGET\s*=\s*\{([\s\S]*?)\}\s+as\s+const\s*;/u);
238970
239017
  if (!bindingSourceTargetMatch) {
@@ -239009,7 +239056,7 @@ var init_cli_doctor_workspace_bindings = __esm(() => {
239009
239056
  });
239010
239057
 
239011
239058
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-blocks.ts
239012
- import fs39 from "fs";
239059
+ import fs34 from "fs";
239013
239060
  import path68 from "path";
239014
239061
  import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata3 } from "@wp-typia/block-runtime/blocks";
239015
239062
  function normalizePathSeparators(relativePath) {
@@ -239027,14 +239074,14 @@ function hasRegisteredBlockAsset(value2) {
239027
239074
  function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
239028
239075
  const blockJsonRelativePath = path68.join("src", "blocks", blockSlug, "block.json");
239029
239076
  const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239030
- if (!fs39.existsSync(blockJsonPath)) {
239077
+ if (!fs34.existsSync(blockJsonPath)) {
239031
239078
  return {
239032
239079
  blockJsonRelativePath,
239033
239080
  error: `Missing ${blockJsonRelativePath}`
239034
239081
  };
239035
239082
  }
239036
239083
  try {
239037
- const document2 = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
239084
+ const document2 = parseScaffoldBlockMetadata3(JSON.parse(fs34.readFileSync(blockJsonPath, "utf8")));
239038
239085
  return {
239039
239086
  blockJsonRelativePath,
239040
239087
  document: document2
@@ -239065,7 +239112,7 @@ function isWorkspaceBlockSaveSource(relativePath) {
239065
239112
  }
239066
239113
  function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
239067
239114
  const blockDir = path68.join(projectDir, "src", "blocks", blockSlug);
239068
- if (!fs39.existsSync(blockDir)) {
239115
+ if (!fs34.existsSync(blockDir)) {
239069
239116
  return [];
239070
239117
  }
239071
239118
  const collected = [];
@@ -239075,7 +239122,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
239075
239122
  if (!currentDir) {
239076
239123
  continue;
239077
239124
  }
239078
- for (const entry of fs39.readdirSync(currentDir, { withFileTypes: true })) {
239125
+ for (const entry of fs34.readdirSync(currentDir, { withFileTypes: true })) {
239079
239126
  const absolutePath = path68.join(currentDir, entry.name);
239080
239127
  if (entry.isDirectory()) {
239081
239128
  queue.push(absolutePath);
@@ -239090,7 +239137,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
239090
239137
  }
239091
239138
  collected.push({
239092
239139
  relativePath: normalizePathSeparators(relativePath),
239093
- source: fs39.readFileSync(absolutePath, "utf8")
239140
+ source: fs34.readFileSync(absolutePath, "utf8")
239094
239141
  });
239095
239142
  }
239096
239143
  }
@@ -239161,12 +239208,12 @@ function getWorkspaceBlockRequiredFiles(block) {
239161
239208
  function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
239162
239209
  const blockJsonRelativePath = path68.join("src", "blocks", block.slug, "block.json");
239163
239210
  const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239164
- if (!fs39.existsSync(blockJsonPath)) {
239211
+ if (!fs34.existsSync(blockJsonPath)) {
239165
239212
  return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
239166
239213
  }
239167
239214
  let blockJson;
239168
239215
  try {
239169
- blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
239216
+ blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs34.readFileSync(blockJsonPath, "utf8")));
239170
239217
  } catch (error48) {
239171
239218
  return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
239172
239219
  }
@@ -239183,12 +239230,12 @@ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
239183
239230
  function checkWorkspaceBlockHooks(projectDir, blockSlug) {
239184
239231
  const blockJsonRelativePath = path68.join("src", "blocks", blockSlug, "block.json");
239185
239232
  const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239186
- if (!fs39.existsSync(blockJsonPath)) {
239233
+ if (!fs34.existsSync(blockJsonPath)) {
239187
239234
  return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
239188
239235
  }
239189
239236
  let blockJson;
239190
239237
  try {
239191
- blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
239238
+ blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs34.readFileSync(blockJsonPath, "utf8")));
239192
239239
  } catch (error48) {
239193
239240
  return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
239194
239241
  }
@@ -239206,10 +239253,10 @@ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
239206
239253
  function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
239207
239254
  const entryRelativePath = path68.join("src", "blocks", blockSlug, "index.tsx");
239208
239255
  const entryPath = path68.join(projectDir, entryRelativePath);
239209
- if (!fs39.existsSync(entryPath)) {
239256
+ if (!fs34.existsSync(entryPath)) {
239210
239257
  return createDoctorCheck2(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
239211
239258
  }
239212
- const source = fs39.readFileSync(entryPath, "utf8");
239259
+ const source = fs34.readFileSync(entryPath, "utf8");
239213
239260
  const hasCollectionImport = WORKSPACE_COLLECTION_IMPORT_PATTERN.test(source);
239214
239261
  return createDoctorCheck2(`Block collection ${blockSlug}`, hasCollectionImport ? "pass" : "fail", hasCollectionImport ? "Shared block collection import is present" : `Missing a shared collection import like ${WORKSPACE_COLLECTION_IMPORT_LINE}`);
239215
239262
  }
@@ -239223,7 +239270,7 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
239223
239270
  const blockJson = metadataResult.document;
239224
239271
  const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion) ? blockJson.apiVersion : null;
239225
239272
  const blockDir = path68.join(projectDir, "src", "blocks", blockSlug);
239226
- const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs39.existsSync(path68.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path68.join("src", "blocks", blockSlug, fileName)));
239273
+ const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs34.existsSync(path68.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path68.join("src", "blocks", blockSlug, fileName)));
239227
239274
  const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) || hasRegisteredBlockAsset(blockJson.editorStyle);
239228
239275
  const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
239229
239276
  const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
@@ -239241,40 +239288,40 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
239241
239288
  }
239242
239289
  function checkWorkspacePatternBootstrap(projectDir, packageName) {
239243
239290
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239244
- if (!fs39.existsSync(bootstrapPath)) {
239291
+ if (!fs34.existsSync(bootstrapPath)) {
239245
239292
  return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239246
239293
  }
239247
- const source = fs39.readFileSync(bootstrapPath, "utf8");
239294
+ const source = fs34.readFileSync(bootstrapPath, "utf8");
239248
239295
  const hasCategoryAnchor = source.includes("register_block_pattern_category");
239249
239296
  const hasPatternGlob = source.includes("/src/patterns/*.php");
239250
239297
  return createDoctorCheck2("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob ? "Pattern category and loader hooks are present" : "Missing pattern category registration or src/patterns loader hook");
239251
239298
  }
239252
239299
  function checkVariationEntrypoint(projectDir, blockSlug) {
239253
239300
  const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239254
- if (!fs39.existsSync(entryPath)) {
239301
+ if (!fs34.existsSync(entryPath)) {
239255
239302
  return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239256
239303
  }
239257
- const source = fs39.readFileSync(entryPath, "utf8");
239304
+ const source = fs34.readFileSync(entryPath, "utf8");
239258
239305
  const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
239259
239306
  const hasCall = hasExecutablePattern(source, WORKSPACE_VARIATIONS_CALL_PATTERN);
239260
239307
  return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Variations registration hook is present" : "Missing ./variations import or registerWorkspaceVariations() call");
239261
239308
  }
239262
239309
  function checkBlockStyleEntrypoint(projectDir, blockSlug) {
239263
239310
  const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239264
- if (!fs39.existsSync(entryPath)) {
239311
+ if (!fs34.existsSync(entryPath)) {
239265
239312
  return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239266
239313
  }
239267
- const source = fs39.readFileSync(entryPath, "utf8");
239314
+ const source = fs34.readFileSync(entryPath, "utf8");
239268
239315
  const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
239269
239316
  const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_STYLES_CALL_PATTERN);
239270
239317
  return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block style registration hook is present" : "Missing ./styles import or registerWorkspaceBlockStyles() call");
239271
239318
  }
239272
239319
  function checkBlockTransformEntrypoint(projectDir, blockSlug) {
239273
239320
  const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239274
- if (!fs39.existsSync(entryPath)) {
239321
+ if (!fs34.existsSync(entryPath)) {
239275
239322
  return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239276
239323
  }
239277
- const source = fs39.readFileSync(entryPath, "utf8");
239324
+ const source = fs34.readFileSync(entryPath, "utf8");
239278
239325
  const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
239279
239326
  const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN);
239280
239327
  return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block transform registration hook is present" : "Missing ./transforms import or applyWorkspaceBlockTransforms(registration.settings) call");
@@ -239343,7 +239390,7 @@ function getWorkspaceBlockDoctorChecks(workspace, inventory) {
239343
239390
  ]));
239344
239391
  checks3.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
239345
239392
  }
239346
- const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs39.existsSync(path68.join(workspace.projectDir, "src", "patterns"));
239393
+ const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs34.existsSync(path68.join(workspace.projectDir, "src", "patterns"));
239347
239394
  if (shouldCheckPatternBootstrap) {
239348
239395
  checks3.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
239349
239396
  }
@@ -239394,7 +239441,7 @@ var init_cli_doctor_workspace_blocks = __esm(() => {
239394
239441
  });
239395
239442
 
239396
239443
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features.ts
239397
- import fs40 from "fs";
239444
+ import fs35 from "fs";
239398
239445
  import path69 from "path";
239399
239446
  function getWorkspaceRestResourceRequiredFiles(restResource) {
239400
239447
  const schemaNames = new Set;
@@ -239437,10 +239484,10 @@ function checkWorkspaceRestResourceConfig(restResource) {
239437
239484
  }
239438
239485
  function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
239439
239486
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239440
- if (!fs40.existsSync(bootstrapPath)) {
239487
+ if (!fs35.existsSync(bootstrapPath)) {
239441
239488
  return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239442
239489
  }
239443
- const source = fs40.readFileSync(bootstrapPath, "utf8");
239490
+ const source = fs35.readFileSync(bootstrapPath, "utf8");
239444
239491
  const registerFunctionName = `${phpPrefix}_register_rest_resources`;
239445
239492
  const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
239446
239493
  const hasServerGlob = source.includes(WORKSPACE_REST_RESOURCE_GLOB);
@@ -239460,11 +239507,11 @@ function getWorkspaceAbilityRequiredFiles(ability) {
239460
239507
  }
239461
239508
  function checkWorkspaceAbilityConfig(projectDir, ability) {
239462
239509
  const configPath = path69.join(projectDir, ability.configFile);
239463
- if (!fs40.existsSync(configPath)) {
239510
+ if (!fs35.existsSync(configPath)) {
239464
239511
  return createDoctorCheck2(`Ability config ${ability.slug}`, "fail", `Missing ${ability.configFile}`);
239465
239512
  }
239466
239513
  try {
239467
- const config2 = JSON.parse(fs40.readFileSync(configPath, "utf8"));
239514
+ const config2 = JSON.parse(fs35.readFileSync(configPath, "utf8"));
239468
239515
  const abilityId = typeof config2.abilityId === "string" ? config2.abilityId.trim() : "";
239469
239516
  const categorySlug = typeof config2.category?.slug === "string" ? config2.category.slug.trim() : "";
239470
239517
  const hasValidAbilityId = /^[a-z0-9-]+\/[a-z0-9-]+$/u.test(abilityId);
@@ -239476,10 +239523,10 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
239476
239523
  }
239477
239524
  function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
239478
239525
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239479
- if (!fs40.existsSync(bootstrapPath)) {
239526
+ if (!fs35.existsSync(bootstrapPath)) {
239480
239527
  return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239481
239528
  }
239482
- const source = fs40.readFileSync(bootstrapPath, "utf8");
239529
+ const source = fs35.readFileSync(bootstrapPath, "utf8");
239483
239530
  const loadFunctionName = `${phpPrefix}_load_workflow_abilities`;
239484
239531
  const enqueueFunctionName = `${phpPrefix}_enqueue_workflow_abilities`;
239485
239532
  const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
@@ -239498,12 +239545,12 @@ function checkWorkspaceAbilityIndex(projectDir, abilities) {
239498
239545
  const indexRelativePath = [
239499
239546
  path69.join("src", "abilities", "index.ts"),
239500
239547
  path69.join("src", "abilities", "index.js")
239501
- ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239548
+ ].find((relativePath) => fs35.existsSync(path69.join(projectDir, relativePath)));
239502
239549
  if (!indexRelativePath) {
239503
239550
  return createDoctorCheck2("Abilities index", "fail", "Missing src/abilities/index.ts or src/abilities/index.js");
239504
239551
  }
239505
239552
  const indexPath = path69.join(projectDir, indexRelativePath);
239506
- const source = fs40.readFileSync(indexPath, "utf8");
239553
+ const source = fs35.readFileSync(indexPath, "utf8");
239507
239554
  const missingExports = abilities.filter((ability) => {
239508
239555
  const exportPattern = new RegExp(`^\\s*export\\s+(?:\\*\\s+from|\\{[^}]+\\}\\s+from)\\s+['"\`]\\./${escapeRegex2(ability.slug)}\\/client['"\`]`, "mu");
239509
239556
  return !exportPattern.test(source);
@@ -239531,10 +239578,10 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
239531
239578
  }
239532
239579
  function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
239533
239580
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239534
- if (!fs40.existsSync(bootstrapPath)) {
239581
+ if (!fs35.existsSync(bootstrapPath)) {
239535
239582
  return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239536
239583
  }
239537
- const source = fs40.readFileSync(bootstrapPath, "utf8");
239584
+ const source = fs35.readFileSync(bootstrapPath, "utf8");
239538
239585
  const registerFunctionName = `${phpPrefix}_register_ai_features`;
239539
239586
  const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
239540
239587
  const hasServerGlob = source.includes(WORKSPACE_AI_FEATURE_GLOB);
@@ -239559,10 +239606,10 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
239559
239606
  }
239560
239607
  function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
239561
239608
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239562
- if (!fs40.existsSync(bootstrapPath)) {
239609
+ if (!fs35.existsSync(bootstrapPath)) {
239563
239610
  return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239564
239611
  }
239565
- const source = fs40.readFileSync(bootstrapPath, "utf8");
239612
+ const source = fs35.readFileSync(bootstrapPath, "utf8");
239566
239613
  const enqueueFunctionName = `${phpPrefix}_enqueue_editor_plugins_editor`;
239567
239614
  const enqueueHook = `add_action( 'enqueue_block_editor_assets', '${enqueueFunctionName}' );`;
239568
239615
  const hasEditorEnqueueHook = source.includes(enqueueHook);
@@ -239575,12 +239622,12 @@ function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
239575
239622
  const indexRelativePath = [
239576
239623
  path69.join("src", "editor-plugins", "index.ts"),
239577
239624
  path69.join("src", "editor-plugins", "index.js")
239578
- ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239625
+ ].find((relativePath) => fs35.existsSync(path69.join(projectDir, relativePath)));
239579
239626
  if (!indexRelativePath) {
239580
239627
  return createDoctorCheck2("Editor plugins index", "fail", "Missing src/editor-plugins/index.ts or src/editor-plugins/index.js");
239581
239628
  }
239582
239629
  const indexPath = path69.join(projectDir, indexRelativePath);
239583
- const source = fs40.readFileSync(indexPath, "utf8");
239630
+ const source = fs35.readFileSync(indexPath, "utf8");
239584
239631
  const missingImports = editorPlugins.filter((editorPlugin) => {
239585
239632
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(editorPlugin.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
239586
239633
  return !importPattern.test(source);
@@ -239613,10 +239660,10 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
239613
239660
  }
239614
239661
  function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
239615
239662
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239616
- if (!fs40.existsSync(bootstrapPath)) {
239663
+ if (!fs35.existsSync(bootstrapPath)) {
239617
239664
  return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239618
239665
  }
239619
- const source = fs40.readFileSync(bootstrapPath, "utf8");
239666
+ const source = fs35.readFileSync(bootstrapPath, "utf8");
239620
239667
  const loadFunctionName = `${phpPrefix}_load_admin_views`;
239621
239668
  const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
239622
239669
  const hasLoaderHook = source.includes(loadHook);
@@ -239627,12 +239674,12 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
239627
239674
  const indexRelativePath = [
239628
239675
  path69.join("src", "admin-views", "index.ts"),
239629
239676
  path69.join("src", "admin-views", "index.js")
239630
- ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239677
+ ].find((relativePath) => fs35.existsSync(path69.join(projectDir, relativePath)));
239631
239678
  if (!indexRelativePath) {
239632
239679
  return createDoctorCheck2("Admin views index", "fail", "Missing src/admin-views/index.ts or src/admin-views/index.js");
239633
239680
  }
239634
239681
  const indexPath = path69.join(projectDir, indexRelativePath);
239635
- const source = fs40.readFileSync(indexPath, "utf8");
239682
+ const source = fs35.readFileSync(indexPath, "utf8");
239636
239683
  const missingImports = adminViews.filter((adminView) => {
239637
239684
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(adminView.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
239638
239685
  return !importPattern.test(source);
@@ -239641,10 +239688,10 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
239641
239688
  }
239642
239689
  function checkWorkspaceAdminViewPhp(projectDir, adminView) {
239643
239690
  const phpPath = path69.join(projectDir, adminView.phpFile);
239644
- if (!fs40.existsSync(phpPath)) {
239691
+ if (!fs35.existsSync(phpPath)) {
239645
239692
  return createDoctorCheck2(`Admin view PHP ${adminView.slug}`, "fail", `Missing ${adminView.phpFile}`);
239646
239693
  }
239647
- const source = fs40.readFileSync(phpPath, "utf8");
239694
+ const source = fs35.readFileSync(phpPath, "utf8");
239648
239695
  const hasAdminMenu = source.includes("add_submenu_page");
239649
239696
  const hasAdminEnqueue = source.includes("admin_enqueue_scripts");
239650
239697
  const hasScript = source.includes(WORKSPACE_ADMIN_VIEW_SCRIPT);
@@ -239702,7 +239749,7 @@ var init_cli_doctor_workspace_features = __esm(() => {
239702
239749
  });
239703
239750
 
239704
239751
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-package.ts
239705
- import fs41 from "fs";
239752
+ import fs36 from "fs";
239706
239753
  import path70 from "path";
239707
239754
  function getWorkspacePackageMetadataCheck(workspace, packageJson) {
239708
239755
  const issues = [];
@@ -239727,7 +239774,7 @@ function getWorkspacePackageMetadataCheck(workspace, packageJson) {
239727
239774
  if (wpTypia?.phpPrefix !== workspace.workspace.phpPrefix) {
239728
239775
  issues.push(`wpTypia.phpPrefix must equal "${workspace.workspace.phpPrefix}"`);
239729
239776
  }
239730
- if (!fs41.existsSync(path70.join(workspace.projectDir, bootstrapRelativePath))) {
239777
+ if (!fs36.existsSync(path70.join(workspace.projectDir, bootstrapRelativePath))) {
239731
239778
  issues.push(`Missing bootstrap file ${bootstrapRelativePath}`);
239732
239779
  }
239733
239780
  return createDoctorCheck2("Workspace package metadata", issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `package.json metadata aligns with ${workspace.packageName} and ${bootstrapRelativePath}` : issues.join("; "));
@@ -239735,7 +239782,7 @@ function getWorkspacePackageMetadataCheck(workspace, packageJson) {
239735
239782
  function getMigrationWorkspaceHintCheck(workspace, packageJson) {
239736
239783
  const hasMigrationScript = typeof packageJson.scripts?.["migration:doctor"] === "string";
239737
239784
  const migrationConfigRelativePath = path70.join("src", "migrations", "config.ts");
239738
- const hasMigrationConfig = fs41.existsSync(path70.join(workspace.projectDir, migrationConfigRelativePath));
239785
+ const hasMigrationConfig = fs36.existsSync(path70.join(workspace.projectDir, migrationConfigRelativePath));
239739
239786
  if (!hasMigrationScript && !hasMigrationConfig) {
239740
239787
  return null;
239741
239788
  }
@@ -239857,14 +239904,14 @@ var init_cli_doctor = __esm(() => {
239857
239904
  });
239858
239905
 
239859
239906
  // ../wp-typia-project-tools/src/runtime/cli-init-package-json.ts
239860
- import fs42 from "fs";
239907
+ import fs37 from "fs";
239861
239908
  import path71 from "path";
239862
239909
  function readProjectPackageJson(projectDir) {
239863
239910
  const packageJsonPath = path71.join(projectDir, "package.json");
239864
- if (!fs42.existsSync(packageJsonPath)) {
239911
+ if (!fs37.existsSync(packageJsonPath)) {
239865
239912
  return null;
239866
239913
  }
239867
- const source = fs42.readFileSync(packageJsonPath, "utf8");
239914
+ const source = fs37.readFileSync(packageJsonPath, "utf8");
239868
239915
  try {
239869
239916
  return JSON.parse(source);
239870
239917
  } catch (error48) {
@@ -239876,13 +239923,13 @@ function inferInitPackageManager(projectDir, packageJson) {
239876
239923
  if (packageJson?.packageManager) {
239877
239924
  return parseWorkspacePackageManagerId(packageJson.packageManager);
239878
239925
  }
239879
- if (fs42.existsSync(path71.join(projectDir, "bun.lock")) || fs42.existsSync(path71.join(projectDir, "bun.lockb"))) {
239926
+ if (fs37.existsSync(path71.join(projectDir, "bun.lock")) || fs37.existsSync(path71.join(projectDir, "bun.lockb"))) {
239880
239927
  return "bun";
239881
239928
  }
239882
- if (fs42.existsSync(path71.join(projectDir, "pnpm-lock.yaml"))) {
239929
+ if (fs37.existsSync(path71.join(projectDir, "pnpm-lock.yaml"))) {
239883
239930
  return "pnpm";
239884
239931
  }
239885
- if (fs42.existsSync(path71.join(projectDir, "yarn.lock")) || fs42.existsSync(path71.join(projectDir, ".yarnrc.yml"))) {
239932
+ if (fs37.existsSync(path71.join(projectDir, "yarn.lock")) || fs37.existsSync(path71.join(projectDir, ".yarnrc.yml"))) {
239886
239933
  return "yarn";
239887
239934
  }
239888
239935
  return "npm";
@@ -239972,7 +240019,7 @@ function hasExistingWpTypiaProjectSurface(projectDir, packageJson) {
239972
240019
  path71.join("scripts", "block-config.ts"),
239973
240020
  path71.join("scripts", "sync-project.ts"),
239974
240021
  path71.join("scripts", "sync-types-to-block-json.ts")
239975
- ].every((relativePath) => fs42.existsSync(path71.join(projectDir, relativePath)));
240022
+ ].every((relativePath) => fs37.existsSync(path71.join(projectDir, relativePath)));
239976
240023
  const hasRuntimeDeps = typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-runtime") === "string" && typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-types") === "string";
239977
240024
  return hasSyncSurface && hasHelperFiles && hasRuntimeDeps;
239978
240025
  }
@@ -240112,7 +240159,7 @@ var init_cli_init_plan_presentation = __esm(() => {
240112
240159
  var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirror the migration bootstrap detector: `src/block.json` + `src/types.ts` + `src/save.tsx`, legacy root `block.json` + `src/types.ts` + `src/save.tsx`, or multi-block `src/blocks/*/block.json` workspaces.", RETROFIT_APPLY_PREVIEW_NOTE = "If you rerun with `wp-typia init --apply`, package.json and generated helper files are snapshotted and rolled back automatically if a write fails.", RETROFIT_ROLLBACK_NOTE = "Apply mode writes package.json and generated helper files with rollback-on-failure protection.";
240113
240160
 
240114
240161
  // ../wp-typia-project-tools/src/runtime/cli-init-plan.ts
240115
- import fs43 from "fs";
240162
+ import fs38 from "fs";
240116
240163
  import path72 from "path";
240117
240164
  import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
240118
240165
  function normalizeRelativePath2(value2) {
@@ -240147,7 +240194,7 @@ function isObjectLikeSourceType(projectDir, typesFile, sourceTypeName) {
240147
240194
  }
240148
240195
  function inferRetrofitAttributeTypeName(projectDir, block) {
240149
240196
  const typesPath = path72.join(projectDir, block.typesFile);
240150
- const typesSource = fs43.readFileSync(typesPath, "utf8");
240197
+ const typesSource = fs38.readFileSync(typesPath, "utf8");
240151
240198
  const blockNameSegments = block.blockName.split("/");
240152
240199
  const slug = blockNameSegments[blockNameSegments.length - 1] ?? block.key;
240153
240200
  const candidateNames = collectNamedSourceTypeCandidates(typesSource);
@@ -240239,17 +240286,17 @@ function buildPlannedFiles(projectDir, layoutKind) {
240239
240286
  }
240240
240287
  return [
240241
240288
  {
240242
- action: fs43.existsSync(path72.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
240289
+ action: fs38.existsSync(path72.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
240243
240290
  path: "scripts/block-config.ts",
240244
240291
  purpose: "Declare the current retrofit block targets so sync-types can regenerate metadata from the existing TypeScript source of truth."
240245
240292
  },
240246
240293
  {
240247
- action: fs43.existsSync(path72.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
240294
+ action: fs38.existsSync(path72.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
240248
240295
  path: "scripts/sync-types-to-block-json.ts",
240249
240296
  purpose: "Generate block.json and Typia metadata artifacts from the current TypeScript source of truth."
240250
240297
  },
240251
240298
  {
240252
- action: fs43.existsSync(path72.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
240299
+ action: fs38.existsSync(path72.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
240253
240300
  path: "scripts/sync-project.ts",
240254
240301
  purpose: "Provide one shared sync entrypoint that can grow into sync-rest or workspace-aware refresh steps later."
240255
240302
  }
@@ -240609,12 +240656,12 @@ var init_cli_init_templates = __esm(() => {
240609
240656
  });
240610
240657
 
240611
240658
  // ../wp-typia-project-tools/src/runtime/cli-init-apply.ts
240612
- import fs44 from "fs";
240659
+ import fs39 from "fs";
240613
240660
  import { promises as fsp27 } from "fs";
240614
240661
  import path74 from "path";
240615
240662
  async function createRetrofitMutationSnapshot(projectDir, filePaths) {
240616
240663
  const scriptsDir = path74.join(projectDir, "scripts");
240617
- const scriptsDirExisted = fs44.existsSync(scriptsDir);
240664
+ const scriptsDirExisted = fs39.existsSync(scriptsDir);
240618
240665
  const fileSources = await snapshotWorkspaceFiles(filePaths);
240619
240666
  const targetPaths = fileSources.filter((entry) => entry.source === null).map((entry) => entry.filePath);
240620
240667
  if (!scriptsDirExisted) {
@@ -240723,7 +240770,6 @@ __export(exports_cli_scaffold, {
240723
240770
  getOptionalOnboarding: () => getOptionalOnboarding,
240724
240771
  getNextSteps: () => getNextSteps
240725
240772
  });
240726
- import fs45 from "fs";
240727
240773
  import { promises as fsp28 } from "fs";
240728
240774
  import path75 from "path";
240729
240775
  async function listRelativeProjectFiles(rootDir) {
@@ -240743,7 +240789,7 @@ async function listRelativeProjectFiles(rootDir) {
240743
240789
  return relativeFiles.sort((left, right) => left.localeCompare(right));
240744
240790
  }
240745
240791
  async function assertDryRunTargetDirectoryReady(projectDir, allowExistingDir) {
240746
- if (!fs45.existsSync(projectDir) || allowExistingDir) {
240792
+ if (!await pathExists(projectDir) || allowExistingDir) {
240747
240793
  return;
240748
240794
  }
240749
240795
  const entries = await fsp28.readdir(projectDir);
@@ -241188,7 +241234,7 @@ async function runScaffoldFlow({
241188
241234
  let availableScripts;
241189
241235
  if (!dryRun) {
241190
241236
  try {
241191
- const parsedPackageJson = JSON.parse(fs45.readFileSync(path75.join(projectDir, "package.json"), "utf8"));
241237
+ const parsedPackageJson = JSON.parse(await fsp28.readFile(path75.join(projectDir, "package.json"), "utf8"));
241192
241238
  const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
241193
241239
  availableScripts = Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
241194
241240
  } catch {
@@ -241241,6 +241287,7 @@ var init_cli_scaffold = __esm(() => {
241241
241287
  init_temp_roots();
241242
241288
  init_scaffold_onboarding();
241243
241289
  init_scaffold_bootstrap();
241290
+ init_fs_async();
241244
241291
  init_template_registry();
241245
241292
  init_external_layer_selection();
241246
241293
  init_cli_validation();
@@ -294334,6 +294381,7 @@ function getMcpSchemaSources(config2) {
294334
294381
  }
294335
294382
 
294336
294383
  // src/render-loader.ts
294384
+ init_cli_diagnostics();
294337
294385
  import fs2 from "fs";
294338
294386
  import { fileURLToPath as fileURLToPath2 } from "url";
294339
294387
  function resolveBundledModuleHref(baseUrl, candidates, options = {}) {
@@ -294345,7 +294393,7 @@ function resolveBundledModuleHref(baseUrl, candidates, options = {}) {
294345
294393
  }
294346
294394
  const missingCandidates = candidates.map((candidate) => fileURLToPath2(new URL(candidate, baseUrl)));
294347
294395
  const label = options.moduleLabel ?? "bundled wp-typia runtime module";
294348
- throw new Error([
294396
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_BUILD_ARTIFACT, [
294349
294397
  `Missing bundled build artifacts for ${label}.`,
294350
294398
  "None of the expected files were found:",
294351
294399
  ...missingCandidates.map((candidatePath) => `- ${candidatePath}`),
@@ -294357,70 +294405,11 @@ function resolveBundledModuleHref(baseUrl, candidates, options = {}) {
294357
294405
  // src/runtime-bridge.ts
294358
294406
  init_cli_diagnostics();
294359
294407
 
294360
- // src/add-kind-registry.ts
294361
- init_cli_diagnostics();
294362
-
294363
294408
  // src/add-kind-ids.ts
294364
294409
  init_cli_add_kind_ids();
294365
294410
 
294366
- // src/cli-string-flags.ts
294411
+ // src/add-kind-registry-shared.ts
294367
294412
  init_cli_diagnostics();
294368
- function readOptionalCliStringFlagValue(flags2, name2, mode) {
294369
- const value2 = flags2[name2];
294370
- if (value2 === undefined || value2 === null) {
294371
- return;
294372
- }
294373
- if (typeof value2 !== "string") {
294374
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name2}\` requires a value.`);
294375
- }
294376
- const trimmed = value2.trim();
294377
- if (trimmed.length === 0) {
294378
- if (mode === "strict") {
294379
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name2}\` requires a value.`);
294380
- }
294381
- return;
294382
- }
294383
- return mode === "strict" ? value2 : trimmed;
294384
- }
294385
- function readOptionalLooseStringFlag(flags2, name2) {
294386
- return readOptionalCliStringFlagValue(flags2, name2, "loose");
294387
- }
294388
- function readOptionalStrictStringFlag(flags2, name2) {
294389
- return readOptionalCliStringFlagValue(flags2, name2, "strict");
294390
- }
294391
- function requireStrictStringFlag(flags2, name2, message) {
294392
- const value2 = readOptionalStrictStringFlag(flags2, name2);
294393
- if (!value2) {
294394
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
294395
- }
294396
- return value2;
294397
- }
294398
- function readOptionalPairedStrictStringFlags(flags2, leftName, rightName, message) {
294399
- const leftValue = readOptionalStrictStringFlag(flags2, leftName);
294400
- const rightValue = readOptionalStrictStringFlag(flags2, rightName);
294401
- if (Boolean(leftValue) !== Boolean(rightValue)) {
294402
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
294403
- }
294404
- return [leftValue, rightValue];
294405
- }
294406
-
294407
- // src/external-layer-prompt-options.ts
294408
- function formatExternalLayerSelectHint(option3) {
294409
- const details = [
294410
- option3.description,
294411
- option3.extends.length > 0 ? `extends ${option3.extends.join(", ")}` : undefined
294412
- ].filter((value2) => typeof value2 === "string" && value2.length > 0);
294413
- return details.length > 0 ? details.join(" \xB7 ") : undefined;
294414
- }
294415
- function toExternalLayerPromptOptions(options) {
294416
- return options.map((option3) => ({
294417
- hint: formatExternalLayerSelectHint(option3),
294418
- label: option3.id,
294419
- value: option3.id
294420
- }));
294421
- }
294422
-
294423
- // src/add-kind-registry.ts
294424
294413
  var BLOCK_VISIBLE_FIELD_ORDER = [
294425
294414
  "kind",
294426
294415
  "name",
@@ -294502,509 +294491,615 @@ function isAddPersistenceTemplate(template) {
294502
294491
  function formatAddBlockTemplateIds(addRuntime) {
294503
294492
  return addRuntime.ADD_BLOCK_TEMPLATE_IDS.join(", ");
294504
294493
  }
294494
+ function getMistypedAddBlockTemplateMessage(addRuntime, templateId) {
294495
+ const suggestion = addRuntime.suggestAddBlockTemplateId(templateId);
294496
+ if (!suggestion) {
294497
+ return null;
294498
+ }
294499
+ return `Unknown add-block template "${templateId}". Did you mean "${suggestion}"? Use \`--template ${suggestion}\`, or run \`wp-typia templates list\` to inspect available templates.`;
294500
+ }
294505
294501
  function assertAddBlockTemplateId(context, templateId) {
294502
+ if (templateId === "query-loop") {
294503
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
294504
+ }
294506
294505
  if (context.addRuntime.isAddBlockTemplateId(templateId)) {
294507
294506
  return templateId;
294508
294507
  }
294509
- if (templateId === "query-loop") {
294510
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
294508
+ const mistypedAddBlockTemplateMessage = getMistypedAddBlockTemplateMessage(context.addRuntime, templateId);
294509
+ if (mistypedAddBlockTemplateMessage) {
294510
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, mistypedAddBlockTemplateMessage);
294511
294511
  }
294512
294512
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
294513
294513
  }
294514
- var ADD_KIND_REGISTRY = {
294515
- "admin-view": defineAddKindRegistryEntry({
294516
- completion: {
294517
- nextSteps: (values) => [
294518
- `Review src/admin-views/${values.adminViewSlug}/ and inc/admin-views/${values.adminViewSlug}.php.`,
294519
- "Run your workspace build or dev command to verify the generated DataViews admin screen."
294520
- ],
294521
- summaryLines: (values, projectDir) => [
294522
- `Admin view: ${values.adminViewSlug}`,
294523
- ...values.source ? [`Source: ${values.source}`] : [],
294524
- `Project directory: ${projectDir}`
294525
- ],
294526
- title: "Added DataViews admin screen"
294527
- },
294528
- description: "Add an opt-in DataViews-powered admin screen",
294529
- nameLabel: "Admin view name",
294530
- async prepareExecution(context) {
294531
- const name2 = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
294532
- const source = readOptionalStrictStringFlag(context.flags, "source");
294533
- return createNamedExecutionPlan(context, {
294534
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAdminViewCommand({
294535
- adminViewName: name3,
294536
- cwd,
294537
- source
294538
- }),
294539
- getValues: (result) => ({
294540
- adminViewSlug: result.adminViewSlug,
294541
- ...result.source ? { source: result.source } : {}
294542
- }),
294543
- missingNameMessage: "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].",
294544
- name: name2
294545
- });
294546
- },
294547
- sortOrder: 10,
294548
- supportsDryRun: true,
294549
- usage: "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]",
294550
- visibleFieldNames: () => NAME_SOURCE_VISIBLE_FIELDS
294551
- }),
294552
- "binding-source": defineAddKindRegistryEntry({
294553
- completion: {
294554
- nextSteps: (values) => [
294555
- `Review src/bindings/${values.bindingSourceSlug}/server.php and src/bindings/${values.bindingSourceSlug}/editor.ts.`,
294556
- ...values.blockSlug && values.attributeName ? [
294557
- `Review src/blocks/${values.blockSlug}/block.json for the ${values.attributeName} bindable attribute.`
294558
- ] : [],
294559
- "Run your workspace build or dev command to verify the binding source hooks and editor registration."
294560
- ],
294561
- summaryLines: (values, projectDir) => [
294562
- `Binding source: ${values.bindingSourceSlug}`,
294563
- ...values.blockSlug && values.attributeName ? [`Target: ${values.blockSlug}.${values.attributeName}`] : [],
294564
- `Project directory: ${projectDir}`
294565
- ],
294566
- title: "Added binding source"
294567
- },
294568
- description: "Add a shared block bindings source",
294569
- nameLabel: "Binding source name",
294570
- async prepareExecution(context) {
294571
- const name2 = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
294572
- const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
294573
- return createNamedExecutionPlan(context, {
294574
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBindingSourceCommand({
294575
- attributeName,
294576
- bindingSourceName: name3,
294577
- blockName,
294578
- cwd
294579
- }),
294580
- getValues: (result) => ({
294581
- ...result.attributeName ? { attributeName: result.attributeName } : {},
294582
- ...result.blockSlug ? { blockSlug: result.blockSlug } : {},
294583
- bindingSourceSlug: result.bindingSourceSlug
294584
- }),
294585
- missingNameMessage: "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].",
294586
- name: name2
294587
- });
294588
- },
294589
- sortOrder: 70,
294590
- supportsDryRun: true,
294591
- usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]",
294592
- visibleFieldNames: () => NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS
294593
- }),
294594
- block: defineAddKindRegistryEntry({
294595
- completion: {
294596
- nextSteps: () => [
294597
- "Review the generated sources under src/blocks/ and the updated scripts/block-config.ts entry.",
294598
- "Run your workspace build or dev command to verify the new scaffolded block family."
294599
- ],
294600
- summaryLines: (values, projectDir) => [
294601
- `Blocks: ${values.blockSlugs}`,
294602
- `Template family: ${values.templateId}`,
294603
- `Project directory: ${projectDir}`
294604
- ],
294605
- title: "Added workspace block"
294606
- },
294607
- description: "Add a real block slice",
294608
- hiddenStringSubmitFields: ["external-layer-id", "external-layer-source"],
294609
- nameLabel: "Block name",
294610
- async prepareExecution(context) {
294611
- const name2 = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
294612
- const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
294613
- const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
294614
- const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
294615
- const selectPrompt = shouldPromptForLayerSelection ? await context.getOrCreatePrompt() : undefined;
294616
- const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
294617
- const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
294618
- const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
294619
- const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
294620
- const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
294621
- let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
294622
- if (!resolvedTemplateId && context.isInteractiveSession) {
294623
- const templatePrompt = await context.getOrCreatePrompt();
294624
- resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
294625
- hint: `Scaffold the ${templateId} block family`,
294626
- label: templateId,
294627
- value: templateId
294628
- })), 1);
294629
- }
294630
- resolvedTemplateId ??= "basic";
294631
- return createNamedExecutionPlan(context, {
294632
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockCommand({
294633
- alternateRenderTargets,
294634
- blockName: name3,
294635
- cwd,
294636
- dataStorageMode,
294637
- externalLayerId,
294638
- externalLayerSource,
294639
- innerBlocksPreset,
294640
- persistencePolicy,
294641
- selectExternalLayerId: selectPrompt ? (options) => selectPrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
294642
- templateId: resolvedTemplateId
294643
- }),
294644
- getValues: (result) => ({
294645
- blockSlugs: result.blockSlugs.join(", "),
294646
- templateId: result.templateId
294647
- }),
294648
- getWarnings: (result) => result.warnings,
294649
- missingNameMessage: "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]",
294650
- name: name2,
294651
- warnLine: context.warnLine
294652
- });
294653
- },
294654
- sortOrder: 20,
294655
- supportsDryRun: true,
294656
- usage: "wp-typia add block <name> [--template <basic|interactivity|persistence|compound>] [--external-layer-source <./path|github:owner/repo/path[#ref]|npm-package>] [--external-layer-id <layer-id>] [--inner-blocks-preset <freeform|ordered|horizontal|locked-structure>] [--alternate-render-targets <email,mjml,plain-text>] [--data-storage <post-meta|custom-table>] [--persistence-policy <authenticated|public>] [--dry-run]",
294657
- visibleFieldNames: ({ template }) => BLOCK_VISIBLE_FIELD_ORDER.filter((fieldName) => {
294658
- if (fieldName === "alternate-render-targets") {
294659
- return isAddPersistenceTemplate(template);
294660
- }
294661
- if (fieldName === "inner-blocks-preset") {
294662
- return template === "compound";
294663
- }
294664
- if (fieldName === "data-storage" || fieldName === "persistence-policy") {
294665
- return isAddPersistenceTemplate(template);
294666
- }
294667
- return true;
294668
- })
294669
- }),
294670
- ability: defineAddKindRegistryEntry({
294671
- completion: {
294672
- nextSteps: (values) => [
294673
- `Review src/abilities/${values.abilitySlug}/ and inc/abilities/${values.abilitySlug}.php.`,
294674
- "Run `wp-typia sync` or `npm run sync-abilities -- --check` and then your workspace build/dev command to verify the generated workflow ability."
294675
- ],
294676
- summaryLines: (values, projectDir) => [
294677
- `Ability: ${values.abilitySlug}`,
294678
- `Project directory: ${projectDir}`
294679
- ],
294680
- title: "Added workflow ability"
294681
- },
294682
- description: "Add a typed server/client workflow ability scaffold",
294683
- nameLabel: "Ability name",
294684
- async prepareExecution(context) {
294685
- return createNamedExecutionPlan(context, {
294686
- execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAbilityCommand({
294687
- abilityName: name2,
294688
- cwd
294689
- }),
294690
- getValues: (result) => ({
294691
- abilitySlug: result.abilitySlug
294692
- }),
294693
- getWarnings: (result) => result.warnings,
294694
- missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.",
294695
- warnLine: context.warnLine
294696
- });
294697
- },
294698
- sortOrder: 90,
294699
- supportsDryRun: true,
294700
- usage: "wp-typia add ability <name> [--dry-run]",
294701
- visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
294702
- }),
294703
- "editor-plugin": defineAddKindRegistryEntry({
294704
- completion: {
294705
- nextSteps: (values) => [
294706
- `Review src/editor-plugins/${values.editorPluginSlug}/.`,
294707
- "Run your workspace build or dev command to verify the new editor plugin registration."
294708
- ],
294709
- summaryLines: (values, projectDir) => [
294710
- `Editor plugin: ${values.editorPluginSlug}`,
294711
- `Slot: ${values.slot}`,
294712
- `Project directory: ${projectDir}`
294713
- ],
294714
- title: "Added editor plugin"
294715
- },
294716
- description: "Add a slot-aware document editor extension shell",
294717
- nameLabel: "Editor plugin name",
294718
- async prepareExecution(context) {
294719
- const name2 = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
294720
- const slot = readOptionalStrictStringFlag(context.flags, "slot");
294721
- return createNamedExecutionPlan(context, {
294722
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddEditorPluginCommand({
294723
- cwd,
294724
- editorPluginName: name3,
294725
- slot
294726
- }),
294727
- getValues: (result) => ({
294728
- editorPluginSlug: result.editorPluginSlug,
294729
- slot: result.slot
294730
- }),
294731
- missingNameMessage: "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].",
294732
- name: name2
294733
- });
294734
- },
294735
- sortOrder: 120,
294736
- supportsDryRun: true,
294737
- usage: "wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>] [--dry-run]",
294738
- visibleFieldNames: () => NAME_SLOT_VISIBLE_FIELDS
294739
- }),
294740
- "hooked-block": defineAddKindRegistryEntry({
294741
- completion: {
294742
- nextSteps: (values) => [
294743
- `Review src/blocks/${values.blockSlug}/block.json for the new blockHooks entry.`,
294744
- "Run your workspace build or dev command to verify the updated hooked-block metadata."
294745
- ],
294746
- summaryLines: (values, projectDir) => [
294747
- `Block: ${values.blockSlug}`,
294748
- `Anchor: ${values.anchorBlockName}`,
294749
- `Position: ${values.position}`,
294750
- `Project directory: ${projectDir}`
294751
- ],
294752
- title: "Added blockHooks metadata"
294753
- },
294754
- description: "Add block.json hook metadata to an existing block",
294755
- nameLabel: "Target block",
294756
- async prepareExecution(context) {
294757
- const name2 = 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>.");
294758
- const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
294759
- const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
294760
- return createNamedExecutionPlan(context, {
294761
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddHookedBlockCommand({
294762
- anchorBlockName,
294763
- blockName: name3,
294764
- cwd,
294765
- position
294766
- }),
294767
- getValues: (result) => ({
294768
- anchorBlockName: result.anchorBlockName,
294769
- blockSlug: result.blockSlug,
294770
- position: result.position
294771
- }),
294772
- 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>.",
294773
- name: name2
294774
- });
294775
- },
294776
- sortOrder: 110,
294777
- supportsDryRun: true,
294778
- usage: "wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild> [--dry-run]",
294779
- visibleFieldNames: () => NAME_ANCHOR_POSITION_VISIBLE_FIELDS
294780
- }),
294781
- pattern: defineAddKindRegistryEntry({
294782
- completion: {
294783
- nextSteps: (values) => [
294784
- `Review src/patterns/${values.patternSlug}.php.`,
294785
- "Run your workspace build or dev command to verify the new pattern registration."
294786
- ],
294787
- summaryLines: (values, projectDir) => [
294788
- `Pattern: ${values.patternSlug}`,
294789
- `Project directory: ${projectDir}`
294790
- ],
294791
- title: "Added workspace pattern"
294792
- },
294793
- description: "Add a PHP block pattern shell",
294794
- nameLabel: "Pattern name",
294795
- async prepareExecution(context) {
294796
- return createNamedExecutionPlan(context, {
294797
- execute: ({ cwd, name: name2 }) => context.addRuntime.runAddPatternCommand({
294798
- cwd,
294799
- patternName: name2
294800
- }),
294801
- getValues: (result) => ({
294802
- patternSlug: result.patternSlug
294803
- }),
294804
- missingNameMessage: "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>."
294805
- });
294806
- },
294807
- sortOrder: 60,
294808
- supportsDryRun: true,
294809
- usage: "wp-typia add pattern <name> [--dry-run]",
294810
- visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
294811
- }),
294812
- style: defineAddKindRegistryEntry({
294813
- completion: {
294814
- nextSteps: (values) => [
294815
- `Review src/blocks/${values.blockSlug}/styles/${values.styleSlug}.ts.`,
294816
- "Run your workspace build or dev command to verify the new block style registration."
294817
- ],
294818
- summaryLines: (values, projectDir) => [
294819
- `Block style: ${values.styleSlug}`,
294820
- `Target block: ${values.blockSlug}`,
294821
- `Project directory: ${projectDir}`
294822
- ],
294823
- title: "Added block style"
294824
- },
294825
- description: "Add a Block Styles registration to an existing block",
294826
- nameLabel: "Style name",
294827
- async prepareExecution(context) {
294828
- const name2 = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
294829
- const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
294830
- return createNamedExecutionPlan(context, {
294831
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockStyleCommand({
294832
- blockName: blockSlug,
294833
- cwd,
294834
- styleName: name3
294835
- }),
294836
- getValues: (result) => ({
294837
- blockSlug: result.blockSlug,
294838
- styleSlug: result.styleSlug
294839
- }),
294840
- missingNameMessage: "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.",
294841
- name: name2
294842
- });
294843
- },
294844
- sortOrder: 40,
294845
- supportsDryRun: true,
294846
- usage: "wp-typia add style <name> --block <block-slug> [--dry-run]",
294847
- visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
294848
- }),
294849
- transform: defineAddKindRegistryEntry({
294850
- completion: {
294851
- nextSteps: (values) => [
294852
- `Review src/blocks/${values.blockSlug}/transforms/${values.transformSlug}.ts.`,
294853
- "Run your workspace build or dev command to verify the new block transform registration."
294854
- ],
294855
- summaryLines: (values, projectDir) => [
294856
- `Block transform: ${values.transformSlug}`,
294857
- `From: ${values.fromBlockName}`,
294858
- `To: ${values.toBlockName}`,
294859
- `Project directory: ${projectDir}`
294860
- ],
294861
- title: "Added block transform"
294862
- },
294863
- description: "Add a block-to-block transform into a workspace block",
294864
- nameLabel: "Transform name",
294865
- async prepareExecution(context) {
294866
- const name2 = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
294867
- const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
294868
- const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
294869
- return createNamedExecutionPlan(context, {
294870
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockTransformCommand({
294871
- cwd,
294872
- fromBlockName,
294873
- toBlockName,
294874
- transformName: name3
294875
- }),
294876
- getValues: (result) => ({
294877
- blockSlug: result.blockSlug,
294878
- fromBlockName: result.fromBlockName,
294879
- toBlockName: result.toBlockName,
294880
- transformSlug: result.transformSlug
294881
- }),
294882
- missingNameMessage: "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.",
294883
- name: name2
294884
- });
294885
- },
294886
- sortOrder: 50,
294887
- supportsDryRun: true,
294888
- usage: "wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]",
294889
- visibleFieldNames: () => NAME_FROM_TO_VISIBLE_FIELDS
294890
- }),
294891
- "rest-resource": defineAddKindRegistryEntry({
294892
- completion: {
294893
- nextSteps: (values) => [
294894
- `Review src/rest/${values.restResourceSlug}/ and inc/rest/${values.restResourceSlug}.php.`,
294895
- "Run your workspace build or dev command to verify the generated REST resource contract."
294896
- ],
294897
- summaryLines: (values, projectDir) => [
294898
- `REST resource: ${values.restResourceSlug}`,
294899
- `Namespace: ${values.namespace}`,
294900
- `Methods: ${values.methods}`,
294901
- `Project directory: ${projectDir}`
294902
- ],
294903
- title: "Added plugin-level REST resource"
294904
- },
294905
- description: "Add a plugin-level typed REST resource",
294906
- nameLabel: "REST resource name",
294907
- async prepareExecution(context) {
294908
- const name2 = requireAddKindName(context, "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].");
294909
- const methods = readOptionalStrictStringFlag(context.flags, "methods");
294910
- const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
294911
- return createNamedExecutionPlan(context, {
294912
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddRestResourceCommand({
294913
- cwd,
294914
- methods,
294915
- namespace,
294916
- restResourceName: name3
294917
- }),
294918
- getValues: (result) => ({
294919
- methods: result.methods.join(", "),
294920
- namespace: result.namespace,
294921
- restResourceSlug: result.restResourceSlug
294922
- }),
294923
- missingNameMessage: "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].",
294924
- name: name2
294925
- });
294926
- },
294927
- sortOrder: 80,
294928
- supportsDryRun: true,
294929
- usage: "wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]",
294930
- visibleFieldNames: () => NAME_NAMESPACE_METHODS_VISIBLE_FIELDS
294931
- }),
294932
- "ai-feature": defineAddKindRegistryEntry({
294933
- completion: {
294934
- nextSteps: (values) => [
294935
- `Review src/ai-features/${values.aiFeatureSlug}/ and inc/ai-features/${values.aiFeatureSlug}.php.`,
294936
- "Run `wp-typia sync-rest` and `wp-typia sync ai` or your workspace build/dev command to verify the generated REST artifacts and AI schema."
294937
- ],
294938
- summaryLines: (values, projectDir) => [
294939
- `AI feature: ${values.aiFeatureSlug}`,
294940
- `Namespace: ${values.namespace}`,
294941
- `Project directory: ${projectDir}`
294942
- ],
294943
- title: "Added server-only AI feature"
294944
- },
294945
- description: "Add a server-owned WordPress AI feature endpoint",
294946
- nameLabel: "AI feature name",
294947
- async prepareExecution(context) {
294948
- const name2 = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
294949
- const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
294950
- return createNamedExecutionPlan(context, {
294951
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAiFeatureCommand({
294952
- aiFeatureName: name3,
294953
- cwd,
294954
- namespace
294955
- }),
294956
- getValues: (result) => ({
294957
- aiFeatureSlug: result.aiFeatureSlug,
294958
- namespace: result.namespace
294959
- }),
294960
- getWarnings: (result) => result.warnings,
294961
- missingNameMessage: "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].",
294962
- name: name2,
294963
- warnLine: context.warnLine
294964
- });
294965
- },
294966
- sortOrder: 100,
294967
- supportsDryRun: true,
294968
- usage: "wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]",
294969
- visibleFieldNames: () => NAME_NAMESPACE_VISIBLE_FIELDS
294970
- }),
294971
- variation: defineAddKindRegistryEntry({
294972
- completion: {
294973
- nextSteps: (values) => [
294974
- `Review src/blocks/${values.blockSlug}/variations/${values.variationSlug}.ts.`,
294975
- "Run your workspace build or dev command to pick up the new variation."
294976
- ],
294977
- summaryLines: (values, projectDir) => [
294978
- `Variation: ${values.variationSlug}`,
294979
- `Target block: ${values.blockSlug}`,
294980
- `Project directory: ${projectDir}`
294981
- ],
294982
- title: "Added workspace variation"
294983
- },
294984
- description: "Add a variation to an existing block",
294985
- nameLabel: "Variation name",
294986
- async prepareExecution(context) {
294987
- const name2 = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
294988
- const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
294989
- return createNamedExecutionPlan(context, {
294990
- execute: ({ cwd, name: name3 }) => context.addRuntime.runAddVariationCommand({
294991
- blockName: blockSlug,
294992
- cwd,
294993
- variationName: name3
294994
- }),
294995
- getValues: (result) => ({
294996
- blockSlug: result.blockSlug,
294997
- variationSlug: result.variationSlug
294998
- }),
294999
- missingNameMessage: "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>",
295000
- name: name2
295001
- });
295002
- },
295003
- sortOrder: 30,
295004
- supportsDryRun: true,
295005
- usage: "wp-typia add variation <name> --block <block-slug> [--dry-run]",
295006
- visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
294514
+
294515
+ // src/add-kinds/ability.ts
294516
+ var abilityAddKindEntry = defineAddKindRegistryEntry({
294517
+ completion: {
294518
+ nextSteps: (values) => [
294519
+ `Review src/abilities/${values.abilitySlug}/ and inc/abilities/${values.abilitySlug}.php.`,
294520
+ "Run `wp-typia sync` or `npm run sync-abilities -- --check` and then your workspace build/dev command to verify the generated workflow ability."
294521
+ ],
294522
+ summaryLines: (values, projectDir) => [
294523
+ `Ability: ${values.abilitySlug}`,
294524
+ `Project directory: ${projectDir}`
294525
+ ],
294526
+ title: "Added workflow ability"
294527
+ },
294528
+ description: "Add a typed server/client workflow ability scaffold",
294529
+ nameLabel: "Ability name",
294530
+ async prepareExecution(context) {
294531
+ return createNamedExecutionPlan(context, {
294532
+ execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAbilityCommand({
294533
+ abilityName: name2,
294534
+ cwd
294535
+ }),
294536
+ getValues: (result) => ({
294537
+ abilitySlug: result.abilitySlug
294538
+ }),
294539
+ getWarnings: (result) => result.warnings,
294540
+ missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.",
294541
+ warnLine: context.warnLine
294542
+ });
294543
+ },
294544
+ sortOrder: 90,
294545
+ supportsDryRun: true,
294546
+ usage: "wp-typia add ability <name> [--dry-run]",
294547
+ visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
294548
+ });
294549
+
294550
+ // src/cli-string-flags.ts
294551
+ init_cli_diagnostics();
294552
+ function readOptionalCliStringFlagValue(flags2, name2, mode) {
294553
+ const value2 = flags2[name2];
294554
+ if (value2 === undefined || value2 === null) {
294555
+ return;
294556
+ }
294557
+ if (typeof value2 !== "string") {
294558
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name2}\` requires a value.`);
294559
+ }
294560
+ const trimmed = value2.trim();
294561
+ if (trimmed.length === 0) {
294562
+ if (mode === "strict") {
294563
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name2}\` requires a value.`);
294564
+ }
294565
+ return;
294566
+ }
294567
+ return mode === "strict" ? value2 : trimmed;
294568
+ }
294569
+ function readOptionalLooseStringFlag(flags2, name2) {
294570
+ return readOptionalCliStringFlagValue(flags2, name2, "loose");
294571
+ }
294572
+ function readOptionalStrictStringFlag(flags2, name2) {
294573
+ return readOptionalCliStringFlagValue(flags2, name2, "strict");
294574
+ }
294575
+ function requireStrictStringFlag(flags2, name2, message) {
294576
+ const value2 = readOptionalStrictStringFlag(flags2, name2);
294577
+ if (!value2) {
294578
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
294579
+ }
294580
+ return value2;
294581
+ }
294582
+ function readOptionalPairedStrictStringFlags(flags2, leftName, rightName, message) {
294583
+ const leftValue = readOptionalStrictStringFlag(flags2, leftName);
294584
+ const rightValue = readOptionalStrictStringFlag(flags2, rightName);
294585
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
294586
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
294587
+ }
294588
+ return [leftValue, rightValue];
294589
+ }
294590
+
294591
+ // src/add-kinds/admin-view.ts
294592
+ var adminViewAddKindEntry = defineAddKindRegistryEntry({
294593
+ completion: {
294594
+ nextSteps: (values) => [
294595
+ `Review src/admin-views/${values.adminViewSlug}/ and inc/admin-views/${values.adminViewSlug}.php.`,
294596
+ "Run your workspace build or dev command to verify the generated DataViews admin screen."
294597
+ ],
294598
+ summaryLines: (values, projectDir) => [
294599
+ `Admin view: ${values.adminViewSlug}`,
294600
+ ...values.source ? [`Source: ${values.source}`] : [],
294601
+ `Project directory: ${projectDir}`
294602
+ ],
294603
+ title: "Added DataViews admin screen"
294604
+ },
294605
+ description: "Add an opt-in DataViews-powered admin screen",
294606
+ nameLabel: "Admin view name",
294607
+ async prepareExecution(context) {
294608
+ const name2 = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
294609
+ const source = readOptionalStrictStringFlag(context.flags, "source");
294610
+ return createNamedExecutionPlan(context, {
294611
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAdminViewCommand({
294612
+ adminViewName: name3,
294613
+ cwd,
294614
+ source
294615
+ }),
294616
+ getValues: (result) => ({
294617
+ adminViewSlug: result.adminViewSlug,
294618
+ ...result.source ? { source: result.source } : {}
294619
+ }),
294620
+ missingNameMessage: "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].",
294621
+ name: name2
294622
+ });
294623
+ },
294624
+ sortOrder: 10,
294625
+ supportsDryRun: true,
294626
+ usage: "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]",
294627
+ visibleFieldNames: () => NAME_SOURCE_VISIBLE_FIELDS
294628
+ });
294629
+
294630
+ // src/add-kinds/ai-feature.ts
294631
+ var aiFeatureAddKindEntry = defineAddKindRegistryEntry({
294632
+ completion: {
294633
+ nextSteps: (values) => [
294634
+ `Review src/ai-features/${values.aiFeatureSlug}/ and inc/ai-features/${values.aiFeatureSlug}.php.`,
294635
+ "Run `wp-typia sync-rest` and `wp-typia sync ai` or your workspace build/dev command to verify the generated REST artifacts and AI schema."
294636
+ ],
294637
+ summaryLines: (values, projectDir) => [
294638
+ `AI feature: ${values.aiFeatureSlug}`,
294639
+ `Namespace: ${values.namespace}`,
294640
+ `Project directory: ${projectDir}`
294641
+ ],
294642
+ title: "Added server-only AI feature"
294643
+ },
294644
+ description: "Add a server-owned WordPress AI feature endpoint",
294645
+ nameLabel: "AI feature name",
294646
+ async prepareExecution(context) {
294647
+ const name2 = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
294648
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
294649
+ return createNamedExecutionPlan(context, {
294650
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAiFeatureCommand({
294651
+ aiFeatureName: name3,
294652
+ cwd,
294653
+ namespace
294654
+ }),
294655
+ getValues: (result) => ({
294656
+ aiFeatureSlug: result.aiFeatureSlug,
294657
+ namespace: result.namespace
294658
+ }),
294659
+ getWarnings: (result) => result.warnings,
294660
+ missingNameMessage: "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].",
294661
+ name: name2,
294662
+ warnLine: context.warnLine
294663
+ });
294664
+ },
294665
+ sortOrder: 100,
294666
+ supportsDryRun: true,
294667
+ usage: "wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]",
294668
+ visibleFieldNames: () => NAME_NAMESPACE_VISIBLE_FIELDS
294669
+ });
294670
+
294671
+ // src/add-kinds/binding-source.ts
294672
+ var bindingSourceAddKindEntry = defineAddKindRegistryEntry({
294673
+ completion: {
294674
+ nextSteps: (values) => [
294675
+ `Review src/bindings/${values.bindingSourceSlug}/server.php and src/bindings/${values.bindingSourceSlug}/editor.ts.`,
294676
+ ...values.blockSlug && values.attributeName ? [
294677
+ `Review src/blocks/${values.blockSlug}/block.json for the ${values.attributeName} bindable attribute.`
294678
+ ] : [],
294679
+ "Run your workspace build or dev command to verify the binding source hooks and editor registration."
294680
+ ],
294681
+ summaryLines: (values, projectDir) => [
294682
+ `Binding source: ${values.bindingSourceSlug}`,
294683
+ ...values.blockSlug && values.attributeName ? [`Target: ${values.blockSlug}.${values.attributeName}`] : [],
294684
+ `Project directory: ${projectDir}`
294685
+ ],
294686
+ title: "Added binding source"
294687
+ },
294688
+ description: "Add a shared block bindings source",
294689
+ nameLabel: "Binding source name",
294690
+ async prepareExecution(context) {
294691
+ const name2 = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
294692
+ const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
294693
+ return createNamedExecutionPlan(context, {
294694
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBindingSourceCommand({
294695
+ attributeName,
294696
+ bindingSourceName: name3,
294697
+ blockName,
294698
+ cwd
294699
+ }),
294700
+ getValues: (result) => ({
294701
+ ...result.attributeName ? { attributeName: result.attributeName } : {},
294702
+ ...result.blockSlug ? { blockSlug: result.blockSlug } : {},
294703
+ bindingSourceSlug: result.bindingSourceSlug
294704
+ }),
294705
+ missingNameMessage: "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].",
294706
+ name: name2
294707
+ });
294708
+ },
294709
+ sortOrder: 70,
294710
+ supportsDryRun: true,
294711
+ usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]",
294712
+ visibleFieldNames: () => NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS
294713
+ });
294714
+
294715
+ // src/external-layer-prompt-options.ts
294716
+ function formatExternalLayerSelectHint(option3) {
294717
+ const details = [
294718
+ option3.description,
294719
+ option3.extends.length > 0 ? `extends ${option3.extends.join(", ")}` : undefined
294720
+ ].filter((value2) => typeof value2 === "string" && value2.length > 0);
294721
+ return details.length > 0 ? details.join(" \xB7 ") : undefined;
294722
+ }
294723
+ function toExternalLayerPromptOptions(options) {
294724
+ return options.map((option3) => ({
294725
+ hint: formatExternalLayerSelectHint(option3),
294726
+ label: option3.id,
294727
+ value: option3.id
294728
+ }));
294729
+ }
294730
+
294731
+ // src/add-kinds/block.ts
294732
+ var blockAddKindEntry = defineAddKindRegistryEntry({
294733
+ completion: {
294734
+ nextSteps: () => [
294735
+ "Review the generated sources under src/blocks/ and the updated scripts/block-config.ts entry.",
294736
+ "Run your workspace build or dev command to verify the new scaffolded block family."
294737
+ ],
294738
+ summaryLines: (values, projectDir) => [
294739
+ `Blocks: ${values.blockSlugs}`,
294740
+ `Template family: ${values.templateId}`,
294741
+ `Project directory: ${projectDir}`
294742
+ ],
294743
+ title: "Added workspace block"
294744
+ },
294745
+ description: "Add a real block slice",
294746
+ hiddenStringSubmitFields: ["external-layer-id", "external-layer-source"],
294747
+ nameLabel: "Block name",
294748
+ async prepareExecution(context) {
294749
+ const name2 = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
294750
+ const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
294751
+ const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
294752
+ const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
294753
+ const selectPrompt = shouldPromptForLayerSelection ? await context.getOrCreatePrompt() : undefined;
294754
+ const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
294755
+ const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
294756
+ const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
294757
+ const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
294758
+ const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
294759
+ let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
294760
+ if (!resolvedTemplateId && context.isInteractiveSession) {
294761
+ const templatePrompt = await context.getOrCreatePrompt();
294762
+ resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
294763
+ hint: `Scaffold the ${templateId} block family`,
294764
+ label: templateId,
294765
+ value: templateId
294766
+ })), 1);
294767
+ }
294768
+ resolvedTemplateId ??= "basic";
294769
+ return createNamedExecutionPlan(context, {
294770
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockCommand({
294771
+ alternateRenderTargets,
294772
+ blockName: name3,
294773
+ cwd,
294774
+ dataStorageMode,
294775
+ externalLayerId,
294776
+ externalLayerSource,
294777
+ innerBlocksPreset,
294778
+ persistencePolicy,
294779
+ selectExternalLayerId: selectPrompt ? (options) => selectPrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
294780
+ templateId: resolvedTemplateId
294781
+ }),
294782
+ getValues: (result) => ({
294783
+ blockSlugs: result.blockSlugs.join(", "),
294784
+ templateId: result.templateId
294785
+ }),
294786
+ getWarnings: (result) => result.warnings,
294787
+ missingNameMessage: "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]",
294788
+ name: name2,
294789
+ warnLine: context.warnLine
294790
+ });
294791
+ },
294792
+ sortOrder: 20,
294793
+ supportsDryRun: true,
294794
+ usage: "wp-typia add block <name> [--template <basic|interactivity|persistence|compound>] [--external-layer-source <./path|github:owner/repo/path[#ref]|npm-package>] [--external-layer-id <layer-id>] [--inner-blocks-preset <freeform|ordered|horizontal|locked-structure>] [--alternate-render-targets <email,mjml,plain-text>] [--data-storage <post-meta|custom-table>] [--persistence-policy <authenticated|public>] [--dry-run]",
294795
+ visibleFieldNames: ({ template }) => BLOCK_VISIBLE_FIELD_ORDER.filter((fieldName) => {
294796
+ if (fieldName === "alternate-render-targets") {
294797
+ return isAddPersistenceTemplate(template);
294798
+ }
294799
+ if (fieldName === "inner-blocks-preset") {
294800
+ return template === "compound";
294801
+ }
294802
+ if (fieldName === "data-storage" || fieldName === "persistence-policy") {
294803
+ return isAddPersistenceTemplate(template);
294804
+ }
294805
+ return true;
295007
294806
  })
294807
+ });
294808
+
294809
+ // src/add-kinds/editor-plugin.ts
294810
+ var editorPluginAddKindEntry = defineAddKindRegistryEntry({
294811
+ completion: {
294812
+ nextSteps: (values) => [
294813
+ `Review src/editor-plugins/${values.editorPluginSlug}/.`,
294814
+ "Run your workspace build or dev command to verify the new editor plugin registration."
294815
+ ],
294816
+ summaryLines: (values, projectDir) => [
294817
+ `Editor plugin: ${values.editorPluginSlug}`,
294818
+ `Slot: ${values.slot}`,
294819
+ `Project directory: ${projectDir}`
294820
+ ],
294821
+ title: "Added editor plugin"
294822
+ },
294823
+ description: "Add a slot-aware document editor extension shell",
294824
+ nameLabel: "Editor plugin name",
294825
+ async prepareExecution(context) {
294826
+ const name2 = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
294827
+ const slot = readOptionalStrictStringFlag(context.flags, "slot");
294828
+ return createNamedExecutionPlan(context, {
294829
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddEditorPluginCommand({
294830
+ cwd,
294831
+ editorPluginName: name3,
294832
+ slot
294833
+ }),
294834
+ getValues: (result) => ({
294835
+ editorPluginSlug: result.editorPluginSlug,
294836
+ slot: result.slot
294837
+ }),
294838
+ missingNameMessage: "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].",
294839
+ name: name2
294840
+ });
294841
+ },
294842
+ sortOrder: 120,
294843
+ supportsDryRun: true,
294844
+ usage: "wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>] [--dry-run]",
294845
+ visibleFieldNames: () => NAME_SLOT_VISIBLE_FIELDS
294846
+ });
294847
+
294848
+ // src/add-kinds/hooked-block.ts
294849
+ var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
294850
+ completion: {
294851
+ nextSteps: (values) => [
294852
+ `Review src/blocks/${values.blockSlug}/block.json for the new blockHooks entry.`,
294853
+ "Run your workspace build or dev command to verify the updated hooked-block metadata."
294854
+ ],
294855
+ summaryLines: (values, projectDir) => [
294856
+ `Block: ${values.blockSlug}`,
294857
+ `Anchor: ${values.anchorBlockName}`,
294858
+ `Position: ${values.position}`,
294859
+ `Project directory: ${projectDir}`
294860
+ ],
294861
+ title: "Added blockHooks metadata"
294862
+ },
294863
+ description: "Add block.json hook metadata to an existing block",
294864
+ nameLabel: "Target block",
294865
+ async prepareExecution(context) {
294866
+ const name2 = 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>.");
294867
+ const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
294868
+ const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
294869
+ return createNamedExecutionPlan(context, {
294870
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddHookedBlockCommand({
294871
+ anchorBlockName,
294872
+ blockName: name3,
294873
+ cwd,
294874
+ position
294875
+ }),
294876
+ getValues: (result) => ({
294877
+ anchorBlockName: result.anchorBlockName,
294878
+ blockSlug: result.blockSlug,
294879
+ position: result.position
294880
+ }),
294881
+ 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>.",
294882
+ name: name2
294883
+ });
294884
+ },
294885
+ sortOrder: 110,
294886
+ supportsDryRun: true,
294887
+ usage: "wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild> [--dry-run]",
294888
+ visibleFieldNames: () => NAME_ANCHOR_POSITION_VISIBLE_FIELDS
294889
+ });
294890
+
294891
+ // src/add-kinds/pattern.ts
294892
+ var patternAddKindEntry = defineAddKindRegistryEntry({
294893
+ completion: {
294894
+ nextSteps: (values) => [
294895
+ `Review src/patterns/${values.patternSlug}.php.`,
294896
+ "Run your workspace build or dev command to verify the new pattern registration."
294897
+ ],
294898
+ summaryLines: (values, projectDir) => [
294899
+ `Pattern: ${values.patternSlug}`,
294900
+ `Project directory: ${projectDir}`
294901
+ ],
294902
+ title: "Added workspace pattern"
294903
+ },
294904
+ description: "Add a PHP block pattern shell",
294905
+ nameLabel: "Pattern name",
294906
+ async prepareExecution(context) {
294907
+ return createNamedExecutionPlan(context, {
294908
+ execute: ({ cwd, name: name2 }) => context.addRuntime.runAddPatternCommand({
294909
+ cwd,
294910
+ patternName: name2
294911
+ }),
294912
+ getValues: (result) => ({
294913
+ patternSlug: result.patternSlug
294914
+ }),
294915
+ missingNameMessage: "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>."
294916
+ });
294917
+ },
294918
+ sortOrder: 60,
294919
+ supportsDryRun: true,
294920
+ usage: "wp-typia add pattern <name> [--dry-run]",
294921
+ visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
294922
+ });
294923
+
294924
+ // src/add-kinds/rest-resource.ts
294925
+ var restResourceAddKindEntry = defineAddKindRegistryEntry({
294926
+ completion: {
294927
+ nextSteps: (values) => [
294928
+ `Review src/rest/${values.restResourceSlug}/ and inc/rest/${values.restResourceSlug}.php.`,
294929
+ "Run your workspace build or dev command to verify the generated REST resource contract."
294930
+ ],
294931
+ summaryLines: (values, projectDir) => [
294932
+ `REST resource: ${values.restResourceSlug}`,
294933
+ `Namespace: ${values.namespace}`,
294934
+ `Methods: ${values.methods}`,
294935
+ `Project directory: ${projectDir}`
294936
+ ],
294937
+ title: "Added plugin-level REST resource"
294938
+ },
294939
+ description: "Add a plugin-level typed REST resource",
294940
+ nameLabel: "REST resource name",
294941
+ async prepareExecution(context) {
294942
+ const name2 = 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>].");
294943
+ const methods = readOptionalStrictStringFlag(context.flags, "methods");
294944
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
294945
+ return createNamedExecutionPlan(context, {
294946
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddRestResourceCommand({
294947
+ cwd,
294948
+ methods,
294949
+ namespace,
294950
+ restResourceName: name3
294951
+ }),
294952
+ getValues: (result) => ({
294953
+ methods: result.methods.join(", "),
294954
+ namespace: result.namespace,
294955
+ restResourceSlug: result.restResourceSlug
294956
+ }),
294957
+ missingNameMessage: "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>].",
294958
+ name: name2
294959
+ });
294960
+ },
294961
+ sortOrder: 80,
294962
+ supportsDryRun: true,
294963
+ usage: "wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]",
294964
+ visibleFieldNames: () => NAME_NAMESPACE_METHODS_VISIBLE_FIELDS
294965
+ });
294966
+
294967
+ // src/add-kinds/style.ts
294968
+ var styleAddKindEntry = defineAddKindRegistryEntry({
294969
+ completion: {
294970
+ nextSteps: (values) => [
294971
+ `Review src/blocks/${values.blockSlug}/styles/${values.styleSlug}.ts.`,
294972
+ "Run your workspace build or dev command to verify the new block style registration."
294973
+ ],
294974
+ summaryLines: (values, projectDir) => [
294975
+ `Block style: ${values.styleSlug}`,
294976
+ `Target block: ${values.blockSlug}`,
294977
+ `Project directory: ${projectDir}`
294978
+ ],
294979
+ title: "Added block style"
294980
+ },
294981
+ description: "Add a Block Styles registration to an existing block",
294982
+ nameLabel: "Style name",
294983
+ async prepareExecution(context) {
294984
+ const name2 = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
294985
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
294986
+ return createNamedExecutionPlan(context, {
294987
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockStyleCommand({
294988
+ blockName: blockSlug,
294989
+ cwd,
294990
+ styleName: name3
294991
+ }),
294992
+ getValues: (result) => ({
294993
+ blockSlug: result.blockSlug,
294994
+ styleSlug: result.styleSlug
294995
+ }),
294996
+ missingNameMessage: "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.",
294997
+ name: name2
294998
+ });
294999
+ },
295000
+ sortOrder: 40,
295001
+ supportsDryRun: true,
295002
+ usage: "wp-typia add style <name> --block <block-slug> [--dry-run]",
295003
+ visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
295004
+ });
295005
+
295006
+ // src/add-kinds/transform.ts
295007
+ var transformAddKindEntry = defineAddKindRegistryEntry({
295008
+ completion: {
295009
+ nextSteps: (values) => [
295010
+ `Review src/blocks/${values.blockSlug}/transforms/${values.transformSlug}.ts.`,
295011
+ "Run your workspace build or dev command to verify the new block transform registration."
295012
+ ],
295013
+ summaryLines: (values, projectDir) => [
295014
+ `Block transform: ${values.transformSlug}`,
295015
+ `From: ${values.fromBlockName}`,
295016
+ `To: ${values.toBlockName}`,
295017
+ `Project directory: ${projectDir}`
295018
+ ],
295019
+ title: "Added block transform"
295020
+ },
295021
+ description: "Add a block-to-block transform into a workspace block",
295022
+ nameLabel: "Transform name",
295023
+ async prepareExecution(context) {
295024
+ const name2 = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
295025
+ const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
295026
+ const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
295027
+ return createNamedExecutionPlan(context, {
295028
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockTransformCommand({
295029
+ cwd,
295030
+ fromBlockName,
295031
+ toBlockName,
295032
+ transformName: name3
295033
+ }),
295034
+ getValues: (result) => ({
295035
+ blockSlug: result.blockSlug,
295036
+ fromBlockName: result.fromBlockName,
295037
+ toBlockName: result.toBlockName,
295038
+ transformSlug: result.transformSlug
295039
+ }),
295040
+ missingNameMessage: "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.",
295041
+ name: name2
295042
+ });
295043
+ },
295044
+ sortOrder: 50,
295045
+ supportsDryRun: true,
295046
+ usage: "wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]",
295047
+ visibleFieldNames: () => NAME_FROM_TO_VISIBLE_FIELDS
295048
+ });
295049
+
295050
+ // src/add-kinds/variation.ts
295051
+ var variationAddKindEntry = defineAddKindRegistryEntry({
295052
+ completion: {
295053
+ nextSteps: (values) => [
295054
+ `Review src/blocks/${values.blockSlug}/variations/${values.variationSlug}.ts.`,
295055
+ "Run your workspace build or dev command to pick up the new variation."
295056
+ ],
295057
+ summaryLines: (values, projectDir) => [
295058
+ `Variation: ${values.variationSlug}`,
295059
+ `Target block: ${values.blockSlug}`,
295060
+ `Project directory: ${projectDir}`
295061
+ ],
295062
+ title: "Added workspace variation"
295063
+ },
295064
+ description: "Add a variation to an existing block",
295065
+ nameLabel: "Variation name",
295066
+ async prepareExecution(context) {
295067
+ const name2 = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
295068
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
295069
+ return createNamedExecutionPlan(context, {
295070
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddVariationCommand({
295071
+ blockName: blockSlug,
295072
+ cwd,
295073
+ variationName: name3
295074
+ }),
295075
+ getValues: (result) => ({
295076
+ blockSlug: result.blockSlug,
295077
+ variationSlug: result.variationSlug
295078
+ }),
295079
+ missingNameMessage: "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>",
295080
+ name: name2
295081
+ });
295082
+ },
295083
+ sortOrder: 30,
295084
+ supportsDryRun: true,
295085
+ usage: "wp-typia add variation <name> --block <block-slug> [--dry-run]",
295086
+ visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
295087
+ });
295088
+
295089
+ // src/add-kind-registry.ts
295090
+ var ADD_KIND_REGISTRY = {
295091
+ "admin-view": adminViewAddKindEntry,
295092
+ block: blockAddKindEntry,
295093
+ variation: variationAddKindEntry,
295094
+ style: styleAddKindEntry,
295095
+ transform: transformAddKindEntry,
295096
+ pattern: patternAddKindEntry,
295097
+ "binding-source": bindingSourceAddKindEntry,
295098
+ "rest-resource": restResourceAddKindEntry,
295099
+ ability: abilityAddKindEntry,
295100
+ "ai-feature": aiFeatureAddKindEntry,
295101
+ "hooked-block": hookedBlockAddKindEntry,
295102
+ "editor-plugin": editorPluginAddKindEntry
295008
295103
  };
295009
295104
  function isAddKindId(value2) {
295010
295105
  return typeof value2 === "string" && ADD_KIND_IDS.includes(value2);
@@ -295030,6 +295125,24 @@ function supportsAddKindDryRun(kind) {
295030
295125
  return ADD_KIND_REGISTRY[kind].supportsDryRun;
295031
295126
  }
295032
295127
 
295128
+ // src/cli-error-messages.ts
295129
+ var MISSING_CREATE_PROJECT_DIR_DETAIL_LINES = [
295130
+ "`wp-typia create` requires <project-dir>.",
295131
+ "`--dry-run` still needs a logical project directory name because wp-typia derives slugs, package names, and planned file paths from it."
295132
+ ];
295133
+ function formatMissingAddKindDetailLine() {
295134
+ return `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`;
295135
+ }
295136
+ function shouldPrintMissingAddKindHelp(options) {
295137
+ if (typeof options.emitOutput === "boolean") {
295138
+ return options.emitOutput;
295139
+ }
295140
+ return options.format !== "json";
295141
+ }
295142
+ function buildMissingCreateProjectDirDetailLines() {
295143
+ return [...MISSING_CREATE_PROJECT_DIR_DETAIL_LINES];
295144
+ }
295145
+
295033
295146
  // src/runtime-bridge-add-dry-run.ts
295034
295147
  init_temp_roots();
295035
295148
  import fs6 from "fs";
@@ -295159,7 +295272,7 @@ async function simulateWorkspaceAddDryRun({
295159
295272
  // package.json
295160
295273
  var package_default2 = {
295161
295274
  name: "wp-typia",
295162
- version: "0.22.8",
295275
+ version: "0.22.9",
295163
295276
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
295164
295277
  packageManager: "bun@1.3.11",
295165
295278
  type: "module",
@@ -295229,7 +295342,7 @@ var package_default2 = {
295229
295342
  "@bunli/tui": "0.6.0",
295230
295343
  "@bunli/utils": "0.6.0",
295231
295344
  "@wp-typia/api-client": "^0.4.5",
295232
- "@wp-typia/project-tools": "0.22.8",
295345
+ "@wp-typia/project-tools": "0.22.9",
295233
295346
  "better-result": "^2.7.0",
295234
295347
  react: "^19.2.5",
295235
295348
  "react-dom": "^19.2.5",
@@ -295253,6 +295366,7 @@ var package_default2 = {
295253
295366
 
295254
295367
  // src/runtime-bridge-output.ts
295255
295368
  init_package_managers();
295369
+ init_cli_diagnostics();
295256
295370
 
295257
295371
  // src/output-markers.ts
295258
295372
  var UNICODE_OUTPUT_MARKERS = {
@@ -295332,6 +295446,13 @@ function stripLeadingOutputMarker(text, kind) {
295332
295446
  return text.replace(new RegExp(`^(?:${markerPattern})\\s*`, "u"), "");
295333
295447
  }
295334
295448
 
295449
+ // src/print-block.ts
295450
+ function printBlock(printLine, lines) {
295451
+ for (const line of lines) {
295452
+ printLine(line);
295453
+ }
295454
+ }
295455
+
295335
295456
  // src/runtime-bridge-output.ts
295336
295457
  function printCompletionPayload(payload, options = {}) {
295337
295458
  const printLine = options.printLine ?? console.log;
@@ -295374,6 +295495,13 @@ function extractPlannedFiles(payload) {
295374
295495
  return toNonEmptyArray(files);
295375
295496
  }
295376
295497
  var PROJECT_DIRECTORY_SUMMARY_PREFIX = "Project directory: ";
295498
+ function resolveCreateCompletionPackageManager(packageManager) {
295499
+ const parsedPackageManager = parsePackageManagerField(packageManager);
295500
+ if (parsedPackageManager) {
295501
+ return parsedPackageManager;
295502
+ }
295503
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unsupported package manager "${packageManager}" in create completion payload. Expected one of: ${PACKAGE_MANAGER_IDS.join(", ")}.`);
295504
+ }
295377
295505
  function extractCompletionProjectDir(completion) {
295378
295506
  const projectDir = completion?.summaryLines?.find((line) => line.startsWith(PROJECT_DIRECTORY_SUMMARY_PREFIX))?.slice(PROJECT_DIRECTORY_SUMMARY_PREFIX.length).trim();
295379
295507
  return projectDir && projectDir.length > 0 ? projectDir : undefined;
@@ -295430,8 +295558,9 @@ function formatCreateProgressLine(payload, markerOptions) {
295430
295558
  return formatOutputMarker("progress", `${payload.title}: ${payload.detail}`, markerOptions);
295431
295559
  }
295432
295560
  function buildCreateCompletionPayload(flow, markerOptions) {
295561
+ const packageManager = resolveCreateCompletionPackageManager(flow.packageManager);
295433
295562
  const verificationSteps = [
295434
- formatPackageExecCommand(flow.packageManager, `wp-typia@${package_default2.version}`, "doctor"),
295563
+ formatPackageExecCommand(packageManager, `wp-typia@${package_default2.version}`, "doctor"),
295435
295564
  ...flow.optionalOnboarding.steps
295436
295565
  ];
295437
295566
  return {
@@ -295553,11 +295682,6 @@ function buildSyncDryRunPayload(options, markerOptions) {
295553
295682
  title: formatOutputMarker("dryRun", `Dry run for wp-typia sync${targetSuffix}`, markerOptions)
295554
295683
  };
295555
295684
  }
295556
- function printBlock(lines, printLine) {
295557
- for (const line of lines) {
295558
- printLine(line);
295559
- }
295560
- }
295561
295685
 
295562
295686
  // src/runtime-capabilities.ts
295563
295687
  function isInteractiveTerminal({
@@ -295731,7 +295855,7 @@ function runProjectScript(project, plannedCommand, options) {
295731
295855
  const stderr = options.captureOutput && typeof result.stderr === "string" ? result.stderr : undefined;
295732
295856
  const stdout = options.captureOutput && typeof result.stdout === "string" ? result.stdout : undefined;
295733
295857
  if (result.error || result.status !== 0) {
295734
- throw new Error(`\`${plannedCommand.displayCommand}\` failed.`, {
295858
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.COMMAND_EXECUTION, `\`${plannedCommand.displayCommand}\` failed.`, {
295735
295859
  cause: result.error ?? (stderr ? new Error(stderr.trim()) : undefined)
295736
295860
  });
295737
295861
  }
@@ -295989,10 +296113,10 @@ async function executeAddCommand({
295989
296113
  const addRuntime = await loadCliAddRuntime();
295990
296114
  const isInteractiveSession = interactive ?? isInteractiveTerminal();
295991
296115
  if (!kind) {
295992
- if (emitOutput) {
296116
+ if (shouldPrintMissingAddKindHelp({ emitOutput })) {
295993
296117
  printLine(addRuntime.formatAddHelpText());
295994
296118
  }
295995
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
296119
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, formatMissingAddKindDetailLine());
295996
296120
  }
295997
296121
  if (!isAddKindId(kind)) {
295998
296122
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
@@ -296044,7 +296168,7 @@ async function executeTemplatesCommand({ flags: flags2 }, printLine = console.lo
296044
296168
  const subcommand = flags2.subcommand ?? "list";
296045
296169
  if (subcommand === "list") {
296046
296170
  for (const template of listTemplates2()) {
296047
- printBlock([formatTemplateSummary2(template), formatTemplateFeatures2(template)], printLine);
296171
+ printBlock(printLine, [formatTemplateSummary2(template), formatTemplateFeatures2(template)]);
296048
296172
  }
296049
296173
  return;
296050
296174
  }
@@ -296056,7 +296180,7 @@ async function executeTemplatesCommand({ flags: flags2 }, printLine = console.lo
296056
296180
  if (!template) {
296057
296181
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unknown template "${flags2.id}".`);
296058
296182
  }
296059
- printBlock([formatTemplateDetails2(template)], printLine);
296183
+ printBlock(printLine, [formatTemplateDetails2(template)]);
296060
296184
  return;
296061
296185
  }
296062
296186
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
@@ -296669,10 +296793,7 @@ var createCommand = defineCommand({
296669
296793
  emitCliDiagnosticFailure(args, {
296670
296794
  code: CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT,
296671
296795
  command: "create",
296672
- detailLines: [
296673
- "`wp-typia create` requires <project-dir>.",
296674
- "`--dry-run` still needs a logical project directory name because wp-typia derives slugs, package names, and planned file paths from it."
296675
- ]
296796
+ detailLines: buildMissingCreateProjectDirDetailLines()
296676
296797
  });
296677
296798
  return;
296678
296799
  }
@@ -296799,7 +296920,7 @@ var init_default = initCommand;
296799
296920
  init_cli_diagnostics();
296800
296921
 
296801
296922
  // src/mcp.ts
296802
- import fs46 from "fs/promises";
296923
+ import fs40 from "fs/promises";
296803
296924
  import path76 from "path";
296804
296925
 
296805
296926
  // ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
@@ -297336,7 +297457,7 @@ function getErrorCauseOptions(error48) {
297336
297457
  }
297337
297458
  async function readSchemaSource(cwd, source) {
297338
297459
  const schemaPath = path76.resolve(cwd, source.path);
297339
- const raw = await fs46.readFile(schemaPath, "utf8");
297460
+ const raw = await fs40.readFile(schemaPath, "utf8");
297340
297461
  let parsed;
297341
297462
  try {
297342
297463
  parsed = JSON.parse(raw);
@@ -297379,8 +297500,8 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path76.join(cwd, "
297379
297500
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, getErrorMessage2(convert.error), getErrorCauseOptions(convert.error));
297380
297501
  }
297381
297502
  }
297382
- await fs46.mkdir(outputDir, { recursive: true });
297383
- await fs46.writeFile(path76.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
297503
+ await fs40.mkdir(outputDir, { recursive: true });
297504
+ await fs40.writeFile(path76.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
297384
297505
  `, "utf8");
297385
297506
  return {
297386
297507
  commandCount: registry2.reduce((count, group) => count + group.tools.length, 0),
@@ -297699,4 +297820,4 @@ export {
297699
297820
  cli
297700
297821
  };
297701
297822
 
297702
- //# debugId=44BBE95891EFC60564756E2164756E21
297823
+ //# debugId=A033448FE6D38F1B64756E2164756E21