wp-typia 0.22.0 → 0.22.2

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.
@@ -36061,6 +36061,10 @@ function toSnakeCase(input) {
36061
36061
  function toPascalCase(input) {
36062
36062
  return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join("");
36063
36063
  }
36064
+ function toCamelCase(input) {
36065
+ const pascalCase = toPascalCase(input);
36066
+ return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
36067
+ }
36064
36068
  function toSegmentPascalCase(input) {
36065
36069
  return input.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map(capitalizeSegment).join("");
36066
36070
  }
@@ -211335,6 +211339,27 @@ function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
211335
211339
  return `${start}${body}${body.length > 0 && !body.endsWith(lineEnding) ? lineEnding : ""}${formattedFieldSource}${end}`;
211336
211340
  });
211337
211341
  }
211342
+ function normalizeInterfaceFieldBlock(source, interfaceName, fieldName, fieldSource, requiredFragments) {
211343
+ const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex2(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
211344
+ return source.replace(interfacePattern, (match3, start, body, end) => {
211345
+ const fieldPattern = new RegExp(`(^([ \\t]*)${escapeRegex2(fieldName)}\\??:\\s*\\{[ \\t]*\\r?\\n)([\\s\\S]*?)(^\\2\\};\\r?\\n?)`, "mu");
211346
+ const fieldMatch = fieldPattern.exec(body);
211347
+ if (!fieldMatch) {
211348
+ return match3;
211349
+ }
211350
+ const existingFieldSource = fieldMatch[0];
211351
+ if (requiredFragments.every((fragment) => existingFieldSource.includes(fragment))) {
211352
+ return match3;
211353
+ }
211354
+ const lineEnding = start.endsWith(`\r
211355
+ `) ? `\r
211356
+ ` : `
211357
+ `;
211358
+ const formattedFieldSource = `${fieldSource.replace(/\r?\n$/u, "").split(`
211359
+ `).join(lineEnding)}${lineEnding}`;
211360
+ return `${start}${body.slice(0, fieldMatch.index)}${formattedFieldSource}${body.slice(fieldMatch.index + existingFieldSource.length)}${end}`;
211361
+ });
211362
+ }
211338
211363
  function updateWorkspaceInventorySource(source, {
211339
211364
  blockEntries = [],
211340
211365
  blockStyleEntries = [],
@@ -211366,7 +211391,9 @@ function updateWorkspaceInventorySource(source, {
211366
211391
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "attribute", "\tattribute?: string;");
211367
211392
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "block", "\tblock?: string;");
211368
211393
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
211394
+ nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
211369
211395
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
211396
+ nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
211370
211397
  nextSource = appendEntriesAtMarker(nextSource, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, editorPluginEntries);
211371
211398
  return nextSource;
211372
211399
  }
@@ -211469,7 +211496,9 @@ export const REST_RESOURCES: WorkspaceRestResourceConfig[] = [
211469
211496
  wordpress?: string;
211470
211497
  };
211471
211498
  mode: 'baseline' | 'optional' | 'required';
211499
+ optionalFeatureIds: string[];
211472
211500
  optionalFeatures: string[];
211501
+ requiredFeatureIds: string[];
211473
211502
  requiredFeatures: string[];
211474
211503
  runtimeGates: string[];
211475
211504
  };
@@ -213271,6 +213300,16 @@ function readPackageManifest(location) {
213271
213300
  }
213272
213301
  return JSON.parse(location.source);
213273
213302
  }
213303
+ function tryReadPackageManifest(location) {
213304
+ if (!location) {
213305
+ return null;
213306
+ }
213307
+ try {
213308
+ return readPackageManifest(location);
213309
+ } catch {
213310
+ return null;
213311
+ }
213312
+ }
213274
213313
  function resolveInstalledPackageManifestLocation(packageName) {
213275
213314
  try {
213276
213315
  return resolvePackageManifestLocation(require2.resolve(`${packageName}/package.json`));
@@ -213288,6 +213327,13 @@ function resolveInstalledPackageManifestLocation(packageName) {
213288
213327
  function composePackageVersionsCacheKey(locations) {
213289
213328
  return locations.map((location) => location.cacheKey).join("|");
213290
213329
  }
213330
+ function resolveManagedPackageVersionRange(options) {
213331
+ const workspaceManifestLocation = options.workspacePackageDirName ? resolvePackageManifestLocation(path31.join(PROJECT_TOOLS_PACKAGE_ROOT, "..", options.workspacePackageDirName, "package.json")) : null;
213332
+ const installedManifestLocation = resolveInstalledPackageManifestLocation(options.packageName);
213333
+ const workspaceManifest = tryReadPackageManifest(workspaceManifestLocation);
213334
+ const installedManifest = tryReadPackageManifest(installedManifestLocation);
213335
+ return normalizeVersionRangeWithFallback(workspaceManifest?.version ?? installedManifest?.version, options.fallback);
213336
+ }
213291
213337
  function getPackageVersions() {
213292
213338
  const createManifestLocation = resolvePackageManifestLocation(path31.join(PROJECT_TOOLS_PACKAGE_ROOT, "package.json"));
213293
213339
  const monorepoManifestLocation = resolvePackageManifestLocation(path31.join(PROJECT_TOOLS_PACKAGE_ROOT, "..", "..", "package.json"));
@@ -224619,7 +224665,9 @@ function createScaffoldCompatibilityConfig(policy) {
224619
224665
  return {
224620
224666
  hardMinimums: capabilityPlan.hardMinimums,
224621
224667
  mode: getPolicyMode(capabilityPlan),
224668
+ optionalFeatureIds: capabilityPlan.optionalFeatures.map((feature) => feature.id),
224622
224669
  optionalFeatures: capabilityPlan.optionalFeatures.map((feature) => feature.label),
224670
+ requiredFeatureIds: capabilityPlan.requiredFeatures.map((feature) => feature.id),
224623
224671
  requiredFeatures: capabilityPlan.requiredFeatures.map((feature) => feature.label),
224624
224672
  runtimeGates: [
224625
224673
  ...capabilityPlan.requiredFeatures.flatMap(formatRuntimeGate),
@@ -226861,7 +226909,7 @@ type InteractivityActionShape = object;
226861
226909
  type InteractivityCallbackShape = object;
226862
226910
  type InteractivityContextShape = object;
226863
226911
  type InteractivityStateShape = object;
226864
- type InteractivityCallable = Function;
226912
+ type InteractivityCallable = CallableFunction;
226865
226913
  type InteractivityKey<T extends object> = Extract<keyof T, string>;
226866
226914
  type InteractivityMethodKey<T extends object> = {
226867
226915
  [Key in InteractivityKey<T>]: T[Key] extends InteractivityCallable ? Key : never;
@@ -226964,7 +227012,7 @@ export function defineInteractivityStore<
226964
227012
  };
226965
227013
  }
226966
227014
 
226967
- type InteractivityActionHandler = Function;
227015
+ type InteractivityActionHandler = CallableFunction;
226968
227016
 
226969
227017
  export interface {{pascalCase}}StoreActions {
226970
227018
  handleClick: InteractivityActionHandler;
@@ -230697,32 +230745,30 @@ var init_cli_add_block = __esm(() => {
230697
230745
  WORKSPACE_INSTALL_MARKERS = ["node_modules", ".pnp.cjs", ".pnp.loader.mjs"];
230698
230746
  });
230699
230747
 
230700
- // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view.ts
230701
- import fs42 from "fs";
230702
- import { promises as fsp18 } from "fs";
230703
- import { createRequire as createRequire4 } from "module";
230704
- import path51 from "path";
230705
- function toCamelCase(input) {
230706
- const pascalCase = toPascalCase(input);
230707
- return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
230748
+ // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-types.ts
230749
+ function isAdminViewCoreDataSource(source) {
230750
+ return source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
230708
230751
  }
230709
- function normalizeVersionRange2(value2, fallback) {
230710
- const trimmed = value2?.trim();
230711
- if (!trimmed || trimmed.startsWith("workspace:")) {
230712
- return fallback;
230713
- }
230714
- return /^[~^<>=]/u.test(trimmed) ? trimmed : `^${trimmed}`;
230752
+ function isAdminViewRestResourceSource(source) {
230753
+ return source?.kind === ADMIN_VIEW_REST_SOURCE_KIND;
230715
230754
  }
230716
- function readPackageManifest2(packageJsonPath) {
230717
- try {
230718
- return JSON.parse(fs42.readFileSync(packageJsonPath, "utf8"));
230719
- } catch {
230720
- return;
230755
+ function formatAdminViewSourceLocator(source) {
230756
+ if (isAdminViewCoreDataSource(source)) {
230757
+ return `${source.kind}:${source.entityKind}/${source.entityName}`;
230721
230758
  }
230759
+ return `${source.kind}:${source.slug}`;
230722
230760
  }
230723
- function readPackageManifestVersion(packageJsonPath) {
230724
- return readPackageManifest2(packageJsonPath)?.version;
230725
- }
230761
+ var ADMIN_VIEW_REST_SOURCE_KIND = "rest-resource", ADMIN_VIEW_CORE_DATA_SOURCE_KIND = "core-data", ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS, ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN, ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN, ADMIN_VIEW_SOURCE_USAGE = "wp-typia add admin-view <name> --source <rest-resource:slug|core-data:kind/name>", ADMIN_VIEWS_SCRIPT = "build/admin-views/index.js", ADMIN_VIEWS_ASSET = "build/admin-views/index.asset.php", ADMIN_VIEWS_STYLE = "build/admin-views/style-index.css", ADMIN_VIEWS_STYLE_RTL = "build/admin-views/style-index-rtl.css", ADMIN_VIEWS_PHP_GLOB = "/inc/admin-views/*.php", ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV = "WP_TYPIA_ALLOW_UNPUBLISHED_DATAVIEWS", ADMIN_VIEW_PUBLIC_INSTALLS_ENABLED = false;
230762
+ var init_cli_add_workspace_admin_view_types = __esm(() => {
230763
+ ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS = [
230764
+ "postType",
230765
+ "taxonomy"
230766
+ ];
230767
+ ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
230768
+ ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/u;
230769
+ });
230770
+
230771
+ // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-source.ts
230726
230772
  function isAdminViewUnpublishedDataViewsOverrideEnabled() {
230727
230773
  return process.env[ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV]?.trim() === "1";
230728
230774
  }
@@ -230732,36 +230778,6 @@ function assertAdminViewPackageAvailability() {
230732
230778
  }
230733
230779
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, "`wp-typia add admin-view` is temporarily unavailable because `@wp-typia/dataviews` is not published to npm for public installs yet.");
230734
230780
  }
230735
- function detectJsonIndent(source) {
230736
- const indentMatch = /\n([ \t]+)"/u.exec(source);
230737
- return indentMatch?.[1] ?? 2;
230738
- }
230739
- function resolvePackageVersionRange(packageName, fallback, workspacePackageDirName) {
230740
- if (workspacePackageDirName) {
230741
- const workspaceVersion = readPackageManifestVersion(path51.join(PROJECT_TOOLS_PACKAGE_ROOT, "..", workspacePackageDirName, "package.json"));
230742
- if (workspaceVersion) {
230743
- return normalizeVersionRange2(workspaceVersion, fallback);
230744
- }
230745
- }
230746
- try {
230747
- return normalizeVersionRange2(readPackageManifestVersion(require4.resolve(`${packageName}/package.json`)), fallback);
230748
- } catch {
230749
- return fallback;
230750
- }
230751
- }
230752
- function getAdminViewRelativeModuleSpecifier(adminViewSlug, workspaceFile) {
230753
- const adminViewDir = `src/admin-views/${adminViewSlug}`;
230754
- const normalizedFile = workspaceFile.replace(/\\/gu, "/");
230755
- const modulePath = normalizedFile.replace(/\.[cm]?[jt]sx?$/u, "");
230756
- const relativeModulePath = path51.posix.relative(adminViewDir, modulePath);
230757
- return relativeModulePath.startsWith(".") ? relativeModulePath : `./${relativeModulePath}`;
230758
- }
230759
- function isAdminViewCoreDataSource(source) {
230760
- return source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
230761
- }
230762
- function isAdminViewRestResourceSource(source) {
230763
- return source?.kind === ADMIN_VIEW_REST_SOURCE_KIND;
230764
- }
230765
230781
  function assertValidCoreDataEntitySegment(label, value2) {
230766
230782
  const trimmed = value2.trim();
230767
230783
  if (!trimmed) {
@@ -230789,12 +230805,6 @@ function assertValidCoreDataEntityKind(value2) {
230789
230805
  }
230790
230806
  return normalized;
230791
230807
  }
230792
- function formatAdminViewSourceLocator(source) {
230793
- if (isAdminViewCoreDataSource(source)) {
230794
- return `${source.kind}:${source.entityKind}/${source.entityName}`;
230795
- }
230796
- return `${source.kind}:${source.slug}`;
230797
- }
230798
230808
  function parseAdminViewSource(source) {
230799
230809
  const trimmed = source?.trim();
230800
230810
  if (!trimmed) {
@@ -230838,6 +230848,24 @@ function resolveRestResourceSource(restResources, source) {
230838
230848
  }
230839
230849
  return restResource;
230840
230850
  }
230851
+ function resolveAdminViewCoreDataSource(source) {
230852
+ return isAdminViewCoreDataSource(source) ? source : undefined;
230853
+ }
230854
+ var init_cli_add_workspace_admin_view_source = __esm(() => {
230855
+ init_cli_add_shared();
230856
+ init_cli_diagnostics();
230857
+ init_cli_add_workspace_admin_view_types();
230858
+ });
230859
+
230860
+ // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-templates.ts
230861
+ import path51 from "path";
230862
+ function getAdminViewRelativeModuleSpecifier(adminViewSlug, workspaceFile) {
230863
+ const adminViewDir = `src/admin-views/${adminViewSlug}`;
230864
+ const normalizedFile = workspaceFile.replace(/\\/gu, "/");
230865
+ const modulePath = normalizedFile.replace(/\.[cm]?[jt]sx?$/u, "");
230866
+ const relativeModulePath = path51.posix.relative(adminViewDir, modulePath);
230867
+ return relativeModulePath.startsWith(".") ? relativeModulePath : `./${relativeModulePath}`;
230868
+ }
230841
230869
  function buildAdminViewConfigEntry(adminViewSlug, source) {
230842
230870
  return [
230843
230871
  "\t{",
@@ -230970,8 +230998,8 @@ function buildAdminViewConfigSource(adminViewSlug, textDomain, source, restResou
230970
230998
  const camelName = toCamelCase(adminViewSlug);
230971
230999
  const itemTypeName = `${pascalName}AdminViewItem`;
230972
231000
  const dataViewsName = `${camelName}AdminDataViews`;
230973
- const isCoreDataSource = source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
230974
- const isTaxonomyCoreDataSource = source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND && source.entityKind === "taxonomy";
231001
+ const isCoreDataSource = isAdminViewCoreDataSource(source);
231002
+ const isTaxonomyCoreDataSource = isAdminViewCoreDataSource(source) && source.entityKind === "taxonomy";
230975
231003
  const defaultViewFields = restResource ? "['id']" : isTaxonomyCoreDataSource ? "['name', 'slug', 'count']" : isCoreDataSource ? "['title', 'slug', 'status', 'updatedAt']" : "['title', 'status', 'updatedAt']";
230976
231004
  const searchEnabled = restResource ? "false" : "true";
230977
231005
  const titleFieldSource = restResource ? "" : isTaxonomyCoreDataSource ? ` titleField: 'name',
@@ -231787,12 +231815,38 @@ add_action( 'admin_menu', '${registerFunctionName}' );
231787
231815
  add_action( 'admin_enqueue_scripts', '${enqueueFunctionName}' );
231788
231816
  `;
231789
231817
  }
231818
+ var init_cli_add_workspace_admin_view_templates = __esm(() => {
231819
+ init_cli_add_shared();
231820
+ init_cli_add_workspace_admin_view_types();
231821
+ });
231822
+
231823
+ // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-scaffold.ts
231824
+ import fs42 from "fs";
231825
+ import { promises as fsp18 } from "fs";
231826
+ import path52 from "path";
231827
+ function detectJsonIndent(source) {
231828
+ const indentMatch = /\n([ \t]+)"/u.exec(source);
231829
+ return indentMatch?.[1] ?? 2;
231830
+ }
231790
231831
  async function ensureAdminViewPackageDependencies(workspace, adminViewSource) {
231791
- const packageJsonPath = path51.join(workspace.projectDir, "package.json");
231792
- const wpTypiaDataViewsVersion = resolvePackageVersionRange("@wp-typia/dataviews", DEFAULT_WP_TYPIA_DATAVIEWS_VERSION, "wp-typia-dataviews");
231793
- const wordpressDataViewsVersion = resolvePackageVersionRange("@wordpress/dataviews", DEFAULT_WORDPRESS_DATAVIEWS_VERSION);
231794
- const wordpressCoreDataVersion = resolvePackageVersionRange("@wordpress/core-data", DEFAULT_WORDPRESS_CORE_DATA_VERSION);
231795
- const wordpressDataVersion = resolvePackageVersionRange("@wordpress/data", DEFAULT_WORDPRESS_DATA_VERSION);
231832
+ const packageJsonPath = path52.join(workspace.projectDir, "package.json");
231833
+ const wpTypiaDataViewsVersion = resolveManagedPackageVersionRange({
231834
+ fallback: DEFAULT_WP_TYPIA_DATAVIEWS_VERSION,
231835
+ packageName: "@wp-typia/dataviews",
231836
+ workspacePackageDirName: "wp-typia-dataviews"
231837
+ });
231838
+ const wordpressDataViewsVersion = resolveManagedPackageVersionRange({
231839
+ fallback: DEFAULT_WORDPRESS_DATAVIEWS_VERSION,
231840
+ packageName: "@wordpress/dataviews"
231841
+ });
231842
+ const wordpressCoreDataVersion = resolveManagedPackageVersionRange({
231843
+ fallback: DEFAULT_WORDPRESS_CORE_DATA_VERSION,
231844
+ packageName: "@wordpress/core-data"
231845
+ });
231846
+ const wordpressDataVersion = resolveManagedPackageVersionRange({
231847
+ fallback: DEFAULT_WORDPRESS_DATA_VERSION,
231848
+ packageName: "@wordpress/data"
231849
+ });
231796
231850
  await patchFile(packageJsonPath, (source) => {
231797
231851
  const packageJson = JSON.parse(source);
231798
231852
  const coreDataDependencies = isAdminViewCoreDataSource(adminViewSource) ? {
@@ -231823,6 +231877,7 @@ async function ensureAdminViewBootstrapAnchors(workspace) {
231823
231877
  let nextSource = source;
231824
231878
  const loadFunctionName = `${workspace.workspace.phpPrefix}_load_admin_views`;
231825
231879
  const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
231880
+ const loadHookPattern = new RegExp(`add_action\\(\\s*['"]plugins_loaded['"]\\s*,\\s*['"]${loadFunctionName}['"]\\s*\\)\\s*;`, "u");
231826
231881
  const loadFunction = `
231827
231882
 
231828
231883
  function ${loadFunctionName}() {
@@ -231867,19 +231922,19 @@ ${snippet}
231867
231922
  if (!functionSource.includes(ADMIN_VIEWS_PHP_GLOB)) {
231868
231923
  const replacedSource = replacePhpFunctionDefinition(nextSource, loadFunctionName, loadFunction);
231869
231924
  if (!replacedSource) {
231870
- throw new Error(`Unable to repair ${path51.basename(bootstrapPath)} for ${loadFunctionName}.`);
231925
+ throw new Error(`Unable to repair ${path52.basename(bootstrapPath)} for ${loadFunctionName}.`);
231871
231926
  }
231872
231927
  nextSource = replacedSource;
231873
231928
  }
231874
231929
  }
231875
- if (!nextSource.includes(loadHook)) {
231930
+ if (!loadHookPattern.test(nextSource)) {
231876
231931
  appendPhpSnippet(loadHook);
231877
231932
  }
231878
231933
  return nextSource;
231879
231934
  });
231880
231935
  }
231881
231936
  async function ensureAdminViewBuildScriptAnchors(workspace) {
231882
- const buildScriptPath = path51.join(workspace.projectDir, "scripts", "build-workspace.mjs");
231937
+ const buildScriptPath = path52.join(workspace.projectDir, "scripts", "build-workspace.mjs");
231883
231938
  await patchFile(buildScriptPath, (source) => {
231884
231939
  if (/['"]src\/admin-views\/index\.(?:ts|js)['"]/u.test(source)) {
231885
231940
  return source;
@@ -231903,11 +231958,11 @@ async function ensureAdminViewBuildScriptAnchors(workspace) {
231903
231958
  if (nextSource !== source) {
231904
231959
  return nextSource;
231905
231960
  }
231906
- throw new Error(`Unable to update ${path51.relative(workspace.projectDir, buildScriptPath)} for admin view shared entries.`);
231961
+ throw new Error(`Unable to update ${path52.relative(workspace.projectDir, buildScriptPath)} for admin view shared entries.`);
231907
231962
  });
231908
231963
  }
231909
231964
  async function ensureAdminViewWebpackAnchors(workspace) {
231910
- const webpackConfigPath = path51.join(workspace.projectDir, "webpack.config.js");
231965
+ const webpackConfigPath = path52.join(workspace.projectDir, "webpack.config.js");
231911
231966
  await patchFile(webpackConfigPath, (source) => {
231912
231967
  if (/['"]admin-views\/index['"]/u.test(source)) {
231913
231968
  return source;
@@ -231948,17 +232003,17 @@ async function ensureAdminViewWebpackAnchors(workspace) {
231948
232003
  }`;
231949
232004
  nextSource = source.replace(legacySharedEntriesBlockPattern, nextSharedEntriesBlock);
231950
232005
  if (nextSource === source) {
231951
- throw new Error(`Unable to update ${path51.relative(workspace.projectDir, webpackConfigPath)} for admin view shared entries.`);
232006
+ throw new Error(`Unable to update ${path52.relative(workspace.projectDir, webpackConfigPath)} for admin view shared entries.`);
231952
232007
  }
231953
232008
  return nextSource;
231954
232009
  });
231955
232010
  }
231956
232011
  function resolveAdminViewRegistryPath(projectDir) {
231957
- const adminViewsDir = path51.join(projectDir, "src", "admin-views");
232012
+ const adminViewsDir = path52.join(projectDir, "src", "admin-views");
231958
232013
  return [
231959
- path51.join(adminViewsDir, "index.ts"),
231960
- path51.join(adminViewsDir, "index.js")
231961
- ].find((candidatePath) => fs42.existsSync(candidatePath)) ?? path51.join(adminViewsDir, "index.ts");
232014
+ path52.join(adminViewsDir, "index.ts"),
232015
+ path52.join(adminViewsDir, "index.js")
232016
+ ].find((candidatePath) => fs42.existsSync(candidatePath)) ?? path52.join(adminViewsDir, "index.ts");
231962
232017
  }
231963
232018
  function readAdminViewRegistrySlugs(registryPath) {
231964
232019
  if (!fs42.existsSync(registryPath)) {
@@ -231968,35 +232023,34 @@ function readAdminViewRegistrySlugs(registryPath) {
231968
232023
  return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
231969
232024
  }
231970
232025
  async function writeAdminViewRegistry(projectDir, adminViewSlug) {
231971
- const adminViewsDir = path51.join(projectDir, "src", "admin-views");
232026
+ const adminViewsDir = path52.join(projectDir, "src", "admin-views");
231972
232027
  const registryPath = resolveAdminViewRegistryPath(projectDir);
231973
232028
  await fsp18.mkdir(adminViewsDir, { recursive: true });
231974
232029
  const existingAdminViewSlugs = readWorkspaceInventory(projectDir).adminViews.map((entry) => entry.slug);
231975
232030
  const existingRegistrySlugs = readAdminViewRegistrySlugs(registryPath);
231976
- const nextAdminViewSlugs = Array.from(new Set([...existingAdminViewSlugs, ...existingRegistrySlugs, adminViewSlug])).sort();
232031
+ const nextAdminViewSlugs = Array.from(new Set([
232032
+ ...existingAdminViewSlugs,
232033
+ ...existingRegistrySlugs,
232034
+ adminViewSlug
232035
+ ])).sort();
231977
232036
  await fsp18.writeFile(registryPath, buildAdminViewRegistrySource(nextAdminViewSlugs), "utf8");
231978
232037
  }
231979
- async function runAddAdminViewCommand({
231980
- adminViewName,
231981
- cwd = process.cwd(),
231982
- source
231983
- }) {
231984
- const workspace = resolveWorkspaceProject(cwd);
231985
- assertAdminViewPackageAvailability();
231986
- const adminViewSlug = assertValidGeneratedSlug("Admin view name", normalizeBlockSlug(adminViewName), "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>]");
231987
- const parsedSource = parseAdminViewSource(source);
231988
- const inventory = readWorkspaceInventory(workspace.projectDir);
231989
- const restResource = resolveRestResourceSource(inventory.restResources, parsedSource);
231990
- const coreDataSource = isAdminViewCoreDataSource(parsedSource) ? parsedSource : undefined;
231991
- assertAdminViewDoesNotExist(workspace.projectDir, adminViewSlug, inventory);
231992
- const blockConfigPath = path51.join(workspace.projectDir, "scripts", "block-config.ts");
232038
+ async function scaffoldAdminViewWorkspace(options) {
232039
+ const {
232040
+ adminViewSlug,
232041
+ coreDataSource,
232042
+ parsedSource,
232043
+ restResource,
232044
+ workspace
232045
+ } = options;
232046
+ const blockConfigPath = path52.join(workspace.projectDir, "scripts", "block-config.ts");
231993
232047
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
231994
- const buildScriptPath = path51.join(workspace.projectDir, "scripts", "build-workspace.mjs");
231995
- const packageJsonPath = path51.join(workspace.projectDir, "package.json");
231996
- const webpackConfigPath = path51.join(workspace.projectDir, "webpack.config.js");
232048
+ const buildScriptPath = path52.join(workspace.projectDir, "scripts", "build-workspace.mjs");
232049
+ const packageJsonPath = path52.join(workspace.projectDir, "package.json");
232050
+ const webpackConfigPath = path52.join(workspace.projectDir, "webpack.config.js");
231997
232051
  const adminViewsIndexPath = resolveAdminViewRegistryPath(workspace.projectDir);
231998
- const adminViewDir = path51.join(workspace.projectDir, "src", "admin-views", adminViewSlug);
231999
- const adminViewPhpPath = path51.join(workspace.projectDir, "inc", "admin-views", `${adminViewSlug}.php`);
232052
+ const adminViewDir = path52.join(workspace.projectDir, "src", "admin-views", adminViewSlug);
232053
+ const adminViewPhpPath = path52.join(workspace.projectDir, "inc", "admin-views", `${adminViewSlug}.php`);
232000
232054
  const mutationSnapshot = {
232001
232055
  fileSources: await snapshotWorkspaceFiles([
232002
232056
  adminViewsIndexPath,
@@ -232011,50 +232065,78 @@ async function runAddAdminViewCommand({
232011
232065
  };
232012
232066
  try {
232013
232067
  await fsp18.mkdir(adminViewDir, { recursive: true });
232014
- await fsp18.mkdir(path51.dirname(adminViewPhpPath), { recursive: true });
232068
+ await fsp18.mkdir(path52.dirname(adminViewPhpPath), { recursive: true });
232015
232069
  await ensureAdminViewPackageDependencies(workspace, parsedSource);
232016
232070
  await ensureAdminViewBootstrapAnchors(workspace);
232017
232071
  await ensureAdminViewBuildScriptAnchors(workspace);
232018
232072
  await ensureAdminViewWebpackAnchors(workspace);
232019
- await fsp18.writeFile(path51.join(adminViewDir, "types.ts"), buildAdminViewTypesSource(adminViewSlug, restResource, coreDataSource), "utf8");
232020
- await fsp18.writeFile(path51.join(adminViewDir, "config.ts"), buildAdminViewConfigSource(adminViewSlug, workspace.workspace.textDomain, parsedSource, restResource), "utf8");
232021
- await fsp18.writeFile(path51.join(adminViewDir, "data.ts"), coreDataSource ? buildCoreDataAdminViewDataSource(adminViewSlug, coreDataSource) : restResource ? buildRestAdminViewDataSource(adminViewSlug, restResource) : buildDefaultAdminViewDataSource(adminViewSlug), "utf8");
232022
- await fsp18.writeFile(path51.join(adminViewDir, "Screen.tsx"), coreDataSource ? buildCoreDataAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain) : buildAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain), "utf8");
232023
- await fsp18.writeFile(path51.join(adminViewDir, "index.tsx"), buildAdminViewEntrySource(adminViewSlug), "utf8");
232024
- await fsp18.writeFile(path51.join(adminViewDir, "style.scss"), buildAdminViewStyleSource(), "utf8");
232073
+ await fsp18.writeFile(path52.join(adminViewDir, "types.ts"), buildAdminViewTypesSource(adminViewSlug, restResource, coreDataSource), "utf8");
232074
+ await fsp18.writeFile(path52.join(adminViewDir, "config.ts"), buildAdminViewConfigSource(adminViewSlug, workspace.workspace.textDomain, parsedSource, restResource), "utf8");
232075
+ await fsp18.writeFile(path52.join(adminViewDir, "data.ts"), coreDataSource ? buildCoreDataAdminViewDataSource(adminViewSlug, coreDataSource) : restResource ? buildRestAdminViewDataSource(adminViewSlug, restResource) : buildDefaultAdminViewDataSource(adminViewSlug), "utf8");
232076
+ await fsp18.writeFile(path52.join(adminViewDir, "Screen.tsx"), coreDataSource ? buildCoreDataAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain) : buildAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain), "utf8");
232077
+ await fsp18.writeFile(path52.join(adminViewDir, "index.tsx"), buildAdminViewEntrySource(adminViewSlug), "utf8");
232078
+ await fsp18.writeFile(path52.join(adminViewDir, "style.scss"), buildAdminViewStyleSource(), "utf8");
232025
232079
  await fsp18.writeFile(adminViewPhpPath, buildAdminViewPhpSource(adminViewSlug, workspace), "utf8");
232026
232080
  await writeAdminViewRegistry(workspace.projectDir, adminViewSlug);
232027
232081
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
232028
- adminViewEntries: [buildAdminViewConfigEntry(adminViewSlug, parsedSource)]
232082
+ adminViewEntries: [
232083
+ buildAdminViewConfigEntry(adminViewSlug, parsedSource)
232084
+ ]
232029
232085
  });
232030
- return {
232031
- adminViewSlug,
232032
- projectDir: workspace.projectDir,
232033
- source: parsedSource ? formatAdminViewSourceLocator(parsedSource) : undefined
232034
- };
232035
232086
  } catch (error48) {
232036
232087
  await rollbackWorkspaceMutation(mutationSnapshot);
232037
232088
  throw error48;
232038
232089
  }
232039
232090
  }
232040
- var ADMIN_VIEW_REST_SOURCE_KIND = "rest-resource", ADMIN_VIEW_CORE_DATA_SOURCE_KIND = "core-data", ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS, ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN, ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN, ADMIN_VIEW_SOURCE_USAGE = "wp-typia add admin-view <name> --source <rest-resource:slug|core-data:kind/name>", ADMIN_VIEWS_SCRIPT = "build/admin-views/index.js", ADMIN_VIEWS_ASSET = "build/admin-views/index.asset.php", ADMIN_VIEWS_STYLE = "build/admin-views/style-index.css", ADMIN_VIEWS_STYLE_RTL = "build/admin-views/style-index-rtl.css", ADMIN_VIEWS_PHP_GLOB = "/inc/admin-views/*.php", ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV = "WP_TYPIA_ALLOW_UNPUBLISHED_DATAVIEWS", ADMIN_VIEW_PUBLIC_INSTALLS_ENABLED = false, require4;
232041
- var init_cli_add_workspace_admin_view = __esm(() => {
232042
- init_workspace_project();
232091
+ var init_cli_add_workspace_admin_view_scaffold = __esm(() => {
232043
232092
  init_workspace_inventory();
232044
- init_template_registry();
232093
+ init_cli_add_workspace_admin_view_templates();
232094
+ init_cli_add_workspace_admin_view_types();
232045
232095
  init_cli_add_shared();
232046
- init_cli_diagnostics();
232047
232096
  init_package_versions();
232048
- ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS = ["postType", "taxonomy"];
232049
- ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
232050
- ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/u;
232051
- require4 = createRequire4(import.meta.url);
232097
+ });
232098
+
232099
+ // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view.ts
232100
+ async function runAddAdminViewCommand({
232101
+ adminViewName,
232102
+ cwd = process.cwd(),
232103
+ source
232104
+ }) {
232105
+ const workspace = resolveWorkspaceProject(cwd);
232106
+ assertAdminViewPackageAvailability();
232107
+ const adminViewSlug = assertValidGeneratedSlug("Admin view name", normalizeBlockSlug(adminViewName), ADD_ADMIN_VIEW_USAGE);
232108
+ const parsedSource = parseAdminViewSource(source);
232109
+ const inventory = readWorkspaceInventory(workspace.projectDir);
232110
+ const restResource = resolveRestResourceSource(inventory.restResources, parsedSource);
232111
+ const coreDataSource = resolveAdminViewCoreDataSource(parsedSource);
232112
+ assertAdminViewDoesNotExist(workspace.projectDir, adminViewSlug, inventory);
232113
+ await scaffoldAdminViewWorkspace({
232114
+ adminViewSlug,
232115
+ coreDataSource,
232116
+ parsedSource,
232117
+ restResource,
232118
+ workspace
232119
+ });
232120
+ return {
232121
+ adminViewSlug,
232122
+ projectDir: workspace.projectDir,
232123
+ source: parsedSource ? formatAdminViewSourceLocator(parsedSource) : undefined
232124
+ };
232125
+ }
232126
+ var ADD_ADMIN_VIEW_USAGE = "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>]";
232127
+ var init_cli_add_workspace_admin_view = __esm(() => {
232128
+ init_cli_add_shared();
232129
+ init_cli_add_workspace_admin_view_source();
232130
+ init_cli_add_workspace_admin_view_scaffold();
232131
+ init_cli_add_workspace_admin_view_types();
232132
+ init_workspace_inventory();
232133
+ init_workspace_project();
232052
232134
  });
232053
232135
 
232054
232136
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-assets.ts
232055
232137
  import fs43 from "fs";
232056
232138
  import { promises as fsp19 } from "fs";
232057
- import path52 from "path";
232139
+ import path53 from "path";
232058
232140
  import {
232059
232141
  syncBlockMetadata as syncBlockMetadata2
232060
232142
  } from "@wp-typia/block-runtime/metadata-core";
@@ -232329,7 +232411,7 @@ async function ensureBindingTargetBlockAttributeType(projectDir, block, target)
232329
232411
  if (!block.attributeTypeName) {
232330
232412
  throw new Error(`Workspace block "${block.slug}" must include attributeTypeName in scripts/block-config.ts before it can receive binding-source targets.`);
232331
232413
  }
232332
- const typesPath = path52.join(projectDir, block.typesFile);
232414
+ const typesPath = path53.join(projectDir, block.typesFile);
232333
232415
  const source = await fsp19.readFile(typesPath, "utf8");
232334
232416
  const targetInterface = getInterfaceDeclaration(source, block.attributeTypeName);
232335
232417
  if (!targetInterface) {
@@ -232341,10 +232423,10 @@ async function ensureBindingTargetBlockAttributeType(projectDir, block, target)
232341
232423
  await fsp19.writeFile(typesPath, nextSource, "utf8");
232342
232424
  }
232343
232425
  await syncBlockMetadata2({
232344
- blockJsonFile: path52.join("src", "blocks", block.slug, "block.json"),
232345
- jsonSchemaFile: path52.join("src", "blocks", block.slug, "typia.schema.json"),
232346
- manifestFile: path52.join("src", "blocks", block.slug, "typia.manifest.json"),
232347
- openApiFile: path52.join("src", "blocks", block.slug, "typia.openapi.json"),
232426
+ blockJsonFile: path53.join("src", "blocks", block.slug, "block.json"),
232427
+ jsonSchemaFile: path53.join("src", "blocks", block.slug, "typia.schema.json"),
232428
+ manifestFile: path53.join("src", "blocks", block.slug, "typia.manifest.json"),
232429
+ openApiFile: path53.join("src", "blocks", block.slug, "typia.openapi.json"),
232348
232430
  projectRoot: projectDir,
232349
232431
  sourceTypeName: block.attributeTypeName,
232350
232432
  typesFile: block.typesFile
@@ -232583,7 +232665,7 @@ ${patternFunctions}
232583
232665
  }
232584
232666
  }
232585
232667
  if (!nextSource.includes(patternCategoryFunctionName) || !nextSource.includes(patternRegistrationFunctionName)) {
232586
- throw new Error(`Unable to inject pattern bootstrap functions into ${path52.basename(bootstrapPath)}.`);
232668
+ throw new Error(`Unable to inject pattern bootstrap functions into ${path53.basename(bootstrapPath)}.`);
232587
232669
  }
232588
232670
  if (!nextSource.includes(patternCategoryHook)) {
232589
232671
  nextSource = `${nextSource.trimEnd()}
@@ -232771,7 +232853,7 @@ ${snippet}
232771
232853
  if (missingReferences.length > 0) {
232772
232854
  const replacedSource = replacePhpFunctionDefinition(nextSource, enqueueFunctionName, enqueueFunction);
232773
232855
  if (!replacedSource) {
232774
- throw new Error(`Unable to repair ${path52.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
232856
+ throw new Error(`Unable to repair ${path53.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
232775
232857
  }
232776
232858
  nextSource = replacedSource;
232777
232859
  }
@@ -232783,7 +232865,7 @@ ${snippet}
232783
232865
  });
232784
232866
  }
232785
232867
  async function ensureEditorPluginBuildScriptAnchors(workspace) {
232786
- const buildScriptPath = path52.join(workspace.projectDir, "scripts", "build-workspace.mjs");
232868
+ const buildScriptPath = path53.join(workspace.projectDir, "scripts", "build-workspace.mjs");
232787
232869
  await patchFile(buildScriptPath, (source) => {
232788
232870
  if (/['"]src\/editor-plugins\/index\.(?:ts|js)['"]/u.test(source)) {
232789
232871
  return source;
@@ -232796,13 +232878,13 @@ async function ensureEditorPluginBuildScriptAnchors(workspace) {
232796
232878
  'src/editor-plugins/index.js',
232797
232879
  ]`);
232798
232880
  if (nextSource === source) {
232799
- throw new Error(`Unable to update ${path52.relative(workspace.projectDir, buildScriptPath)} for editor plugin shared entries.`);
232881
+ throw new Error(`Unable to update ${path53.relative(workspace.projectDir, buildScriptPath)} for editor plugin shared entries.`);
232800
232882
  }
232801
232883
  return nextSource;
232802
232884
  });
232803
232885
  }
232804
232886
  async function ensureEditorPluginWebpackAnchors(workspace) {
232805
- const webpackConfigPath = path52.join(workspace.projectDir, "webpack.config.js");
232887
+ const webpackConfigPath = path53.join(workspace.projectDir, "webpack.config.js");
232806
232888
  await patchFile(webpackConfigPath, (source) => {
232807
232889
  if (/['"]editor-plugins\/index['"]/u.test(source)) {
232808
232890
  return source;
@@ -232830,17 +232912,17 @@ async function ensureEditorPluginWebpackAnchors(workspace) {
232830
232912
  }`;
232831
232913
  const nextSource = source.replace(legacySharedEntriesBlockPattern, nextSharedEntriesBlock);
232832
232914
  if (nextSource === source) {
232833
- throw new Error(`Unable to update ${path52.relative(workspace.projectDir, webpackConfigPath)} for editor plugin shared entries.`);
232915
+ throw new Error(`Unable to update ${path53.relative(workspace.projectDir, webpackConfigPath)} for editor plugin shared entries.`);
232834
232916
  }
232835
232917
  return nextSource;
232836
232918
  });
232837
232919
  }
232838
232920
  function resolveBindingSourceRegistryPath(projectDir) {
232839
- const bindingsDir = path52.join(projectDir, "src", "bindings");
232840
- return [path52.join(bindingsDir, "index.ts"), path52.join(bindingsDir, "index.js")].find((candidatePath) => fs43.existsSync(candidatePath)) ?? path52.join(bindingsDir, "index.ts");
232921
+ const bindingsDir = path53.join(projectDir, "src", "bindings");
232922
+ return [path53.join(bindingsDir, "index.ts"), path53.join(bindingsDir, "index.js")].find((candidatePath) => fs43.existsSync(candidatePath)) ?? path53.join(bindingsDir, "index.ts");
232841
232923
  }
232842
232924
  async function writeBindingSourceRegistry(projectDir, bindingSourceSlug) {
232843
- const bindingsDir = path52.join(projectDir, "src", "bindings");
232925
+ const bindingsDir = path53.join(projectDir, "src", "bindings");
232844
232926
  const bindingsIndexPath = resolveBindingSourceRegistryPath(projectDir);
232845
232927
  await fsp19.mkdir(bindingsDir, { recursive: true });
232846
232928
  const existingBindingSourceSlugs = fs43.readdirSync(bindingsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
@@ -232848,11 +232930,11 @@ async function writeBindingSourceRegistry(projectDir, bindingSourceSlug) {
232848
232930
  await fsp19.writeFile(bindingsIndexPath, buildBindingSourceIndexSource(nextBindingSourceSlugs), "utf8");
232849
232931
  }
232850
232932
  function resolveEditorPluginRegistryPath(projectDir) {
232851
- const editorPluginsDir = path52.join(projectDir, "src", "editor-plugins");
232933
+ const editorPluginsDir = path53.join(projectDir, "src", "editor-plugins");
232852
232934
  return [
232853
- path52.join(editorPluginsDir, "index.ts"),
232854
- path52.join(editorPluginsDir, "index.js")
232855
- ].find((candidatePath) => fs43.existsSync(candidatePath)) ?? path52.join(editorPluginsDir, "index.ts");
232935
+ path53.join(editorPluginsDir, "index.ts"),
232936
+ path53.join(editorPluginsDir, "index.js")
232937
+ ].find((candidatePath) => fs43.existsSync(candidatePath)) ?? path53.join(editorPluginsDir, "index.ts");
232856
232938
  }
232857
232939
  function readEditorPluginRegistrySlugs(registryPath) {
232858
232940
  if (!fs43.existsSync(registryPath)) {
@@ -232862,7 +232944,7 @@ function readEditorPluginRegistrySlugs(registryPath) {
232862
232944
  return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
232863
232945
  }
232864
232946
  async function writeEditorPluginRegistry(projectDir, editorPluginSlug) {
232865
- const editorPluginsDir = path52.join(projectDir, "src", "editor-plugins");
232947
+ const editorPluginsDir = path53.join(projectDir, "src", "editor-plugins");
232866
232948
  const registryPath = resolveEditorPluginRegistryPath(projectDir);
232867
232949
  await fsp19.mkdir(editorPluginsDir, { recursive: true });
232868
232950
  const existingEditorPluginSlugs = readWorkspaceInventory(projectDir).editorPlugins.map((entry) => entry.slug);
@@ -232880,17 +232962,17 @@ async function runAddEditorPluginCommand({
232880
232962
  const resolvedSlot = assertValidEditorPluginSlot(slot);
232881
232963
  const inventory = readWorkspaceInventory(workspace.projectDir);
232882
232964
  assertEditorPluginDoesNotExist(workspace.projectDir, editorPluginSlug, inventory);
232883
- const blockConfigPath = path52.join(workspace.projectDir, "scripts", "block-config.ts");
232965
+ const blockConfigPath = path53.join(workspace.projectDir, "scripts", "block-config.ts");
232884
232966
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
232885
- const buildScriptPath = path52.join(workspace.projectDir, "scripts", "build-workspace.mjs");
232967
+ const buildScriptPath = path53.join(workspace.projectDir, "scripts", "build-workspace.mjs");
232886
232968
  const editorPluginsIndexPath = resolveEditorPluginRegistryPath(workspace.projectDir);
232887
- const webpackConfigPath = path52.join(workspace.projectDir, "webpack.config.js");
232888
- const editorPluginDir = path52.join(workspace.projectDir, "src", "editor-plugins", editorPluginSlug);
232889
- const entryFilePath = path52.join(editorPluginDir, "index.tsx");
232890
- const surfaceFilePath = path52.join(editorPluginDir, "Surface.tsx");
232891
- const dataFilePath = path52.join(editorPluginDir, "data.ts");
232892
- const typesFilePath = path52.join(editorPluginDir, "types.ts");
232893
- const styleFilePath = path52.join(editorPluginDir, "style.scss");
232969
+ const webpackConfigPath = path53.join(workspace.projectDir, "webpack.config.js");
232970
+ const editorPluginDir = path53.join(workspace.projectDir, "src", "editor-plugins", editorPluginSlug);
232971
+ const entryFilePath = path53.join(editorPluginDir, "index.tsx");
232972
+ const surfaceFilePath = path53.join(editorPluginDir, "Surface.tsx");
232973
+ const dataFilePath = path53.join(editorPluginDir, "data.ts");
232974
+ const typesFilePath = path53.join(editorPluginDir, "types.ts");
232975
+ const styleFilePath = path53.join(editorPluginDir, "style.scss");
232894
232976
  const mutationSnapshot = {
232895
232977
  fileSources: await snapshotWorkspaceFiles([
232896
232978
  blockConfigPath,
@@ -232936,16 +233018,16 @@ async function runAddPatternCommand({
232936
233018
  const patternSlug = assertValidGeneratedSlug("Pattern name", normalizeBlockSlug(patternName), "wp-typia add pattern <name>");
232937
233019
  const inventory = readWorkspaceInventory(workspace.projectDir);
232938
233020
  assertPatternDoesNotExist(workspace.projectDir, patternSlug, inventory);
232939
- const blockConfigPath = path52.join(workspace.projectDir, "scripts", "block-config.ts");
233021
+ const blockConfigPath = path53.join(workspace.projectDir, "scripts", "block-config.ts");
232940
233022
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
232941
- const patternFilePath = path52.join(workspace.projectDir, "src", "patterns", `${patternSlug}.php`);
233023
+ const patternFilePath = path53.join(workspace.projectDir, "src", "patterns", `${patternSlug}.php`);
232942
233024
  const mutationSnapshot = {
232943
233025
  fileSources: await snapshotWorkspaceFiles([blockConfigPath, bootstrapPath]),
232944
233026
  snapshotDirs: [],
232945
233027
  targetPaths: [patternFilePath]
232946
233028
  };
232947
233029
  try {
232948
- await fsp19.mkdir(path52.dirname(patternFilePath), { recursive: true });
233030
+ await fsp19.mkdir(path53.dirname(patternFilePath), { recursive: true });
232949
233031
  await ensurePatternBootstrapAnchors(workspace);
232950
233032
  await fsp19.writeFile(patternFilePath, buildPatternSource(patternSlug, workspace.workspace.namespace, workspace.workspace.textDomain), "utf8");
232951
233033
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
@@ -232975,18 +233057,18 @@ async function runAddBindingSourceCommand({
232975
233057
  blockName
232976
233058
  }, workspace.workspace.namespace);
232977
233059
  const targetBlock = target ? resolveWorkspaceBlock(inventory, target.blockSlug) : undefined;
232978
- const blockConfigPath = path52.join(workspace.projectDir, "scripts", "block-config.ts");
233060
+ const blockConfigPath = path53.join(workspace.projectDir, "scripts", "block-config.ts");
232979
233061
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
232980
233062
  const bindingsIndexPath = resolveBindingSourceRegistryPath(workspace.projectDir);
232981
- const bindingSourceDir = path52.join(workspace.projectDir, "src", "bindings", bindingSourceSlug);
232982
- const serverFilePath = path52.join(bindingSourceDir, "server.php");
232983
- const editorFilePath = path52.join(bindingSourceDir, "editor.ts");
232984
- const blockJsonPath = target ? path52.join(workspace.projectDir, "src", "blocks", target.blockSlug, "block.json") : undefined;
233063
+ const bindingSourceDir = path53.join(workspace.projectDir, "src", "bindings", bindingSourceSlug);
233064
+ const serverFilePath = path53.join(bindingSourceDir, "server.php");
233065
+ const editorFilePath = path53.join(bindingSourceDir, "editor.ts");
233066
+ const blockJsonPath = target ? path53.join(workspace.projectDir, "src", "blocks", target.blockSlug, "block.json") : undefined;
232985
233067
  const targetGeneratedMetadataPaths = target ? [
232986
- path52.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.manifest.json"),
232987
- path52.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.openapi.json"),
232988
- path52.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.schema.json"),
232989
- path52.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia-validator.php")
233068
+ path53.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.manifest.json"),
233069
+ path53.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.openapi.json"),
233070
+ path53.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.schema.json"),
233071
+ path53.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia-validator.php")
232990
233072
  ] : [];
232991
233073
  const mutationSnapshot = {
232992
233074
  fileSources: await snapshotWorkspaceFiles([
@@ -232994,7 +233076,7 @@ async function runAddBindingSourceCommand({
232994
233076
  bootstrapPath,
232995
233077
  bindingsIndexPath,
232996
233078
  ...blockJsonPath ? [blockJsonPath] : [],
232997
- ...targetBlock ? [path52.join(workspace.projectDir, targetBlock.typesFile)] : [],
233079
+ ...targetBlock ? [path53.join(workspace.projectDir, targetBlock.typesFile)] : [],
232998
233080
  ...targetGeneratedMetadataPaths
232999
233081
  ]),
233000
233082
  snapshotDirs: [],
@@ -233032,7 +233114,7 @@ var init_cli_add_workspace_assets = __esm(() => {
233032
233114
  });
233033
233115
 
233034
233116
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-rest-anchors.ts
233035
- import path53 from "path";
233117
+ import path54 from "path";
233036
233118
  async function ensureRestResourceBootstrapAnchors(workspace) {
233037
233119
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
233038
233120
  await patchFile(bootstrapPath, (source) => {
@@ -233079,7 +233161,7 @@ ${snippet}
233079
233161
  insertPhpSnippet(registerFunction);
233080
233162
  } else if (!nextSource.includes(REST_RESOURCE_SERVER_GLOB)) {
233081
233163
  throw new Error([
233082
- `Unable to patch ${path53.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
233164
+ `Unable to patch ${path54.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
233083
233165
  `The existing ${registerFunctionName}() definition does not include ${REST_RESOURCE_SERVER_GLOB}.`,
233084
233166
  "Restore the generated bootstrap shape or wire the REST resource loader manually before retrying."
233085
233167
  ].join(" "));
@@ -233093,7 +233175,7 @@ ${snippet}
233093
233175
  function assertSyncRestAnchor(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath) {
233094
233176
  if (!nextSource.includes(target) && !hasAnchor) {
233095
233177
  throw new Error([
233096
- `ensureRestResourceSyncScriptAnchors could not patch ${path53.basename(syncRestScriptPath)}.`,
233178
+ `ensureRestResourceSyncScriptAnchors could not patch ${path54.basename(syncRestScriptPath)}.`,
233097
233179
  `Missing expected ${anchorDescription} anchor in scripts/sync-rest-contracts.ts.`,
233098
233180
  "Restore the generated template or add the REST_RESOURCES wiring manually before retrying."
233099
233181
  ].join(" "));
@@ -233108,7 +233190,7 @@ function replaceRequiredSyncRestSource(nextSource, target, anchor, replacement,
233108
233190
  return nextSource.replace(anchor, replacement);
233109
233191
  }
233110
233192
  async function ensureRestResourceSyncScriptAnchors(workspace) {
233111
- const syncRestScriptPath = path53.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
233193
+ const syncRestScriptPath = path54.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
233112
233194
  await patchFile(syncRestScriptPath, (source) => {
233113
233195
  let nextSource = source;
233114
233196
  const importAnchor = "import { BLOCKS, type WorkspaceBlockConfig } from './block-config';";
@@ -233230,7 +233312,7 @@ var init_cli_add_workspace_rest_anchors = __esm(() => {
233230
233312
  });
233231
233313
 
233232
233314
  // ../wp-typia-project-tools/src/runtime/rest-resource-artifacts.ts
233233
- import path54 from "path";
233315
+ import path55 from "path";
233234
233316
  import {
233235
233317
  defineEndpointManifest as defineEndpointManifest2,
233236
233318
  syncEndpointClient as syncEndpointClient2,
@@ -233366,8 +233448,8 @@ async function syncRestResourceArtifacts({
233366
233448
  const manifest = buildRestResourceEndpointManifest(variables, methods);
233367
233449
  for (const [baseName, contract] of Object.entries(manifest.contracts)) {
233368
233450
  await syncTypeSchemas2({
233369
- jsonSchemaFile: path54.join(outputDir, "api-schemas", `${baseName}.schema.json`),
233370
- openApiFile: path54.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
233451
+ jsonSchemaFile: path55.join(outputDir, "api-schemas", `${baseName}.schema.json`),
233452
+ openApiFile: path55.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
233371
233453
  projectRoot: projectDir,
233372
233454
  sourceTypeName: contract.sourceTypeName,
233373
233455
  typesFile
@@ -233375,7 +233457,7 @@ async function syncRestResourceArtifacts({
233375
233457
  }
233376
233458
  await syncRestOpenApi2({
233377
233459
  manifest,
233378
- openApiFile: path54.join(outputDir, "api.openapi.json"),
233460
+ openApiFile: path55.join(outputDir, "api.openapi.json"),
233379
233461
  projectRoot: projectDir,
233380
233462
  typesFile
233381
233463
  });
@@ -233777,7 +233859,7 @@ var init_cli_add_workspace_rest_source_emitters = __esm(() => {
233777
233859
 
233778
233860
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-rest.ts
233779
233861
  import { promises as fsp20 } from "fs";
233780
- import path55 from "path";
233862
+ import path56 from "path";
233781
233863
  function buildRestResourceRouteRegistrations(restResourceSlug, methods, functions) {
233782
233864
  const collectionRoutes = [];
233783
233865
  const itemRoutes = [];
@@ -234207,15 +234289,15 @@ async function runAddRestResourceCommand({
234207
234289
  const resolvedNamespace = resolveRestResourceNamespace(workspace.workspace.namespace, namespace);
234208
234290
  const inventory = readWorkspaceInventory(workspace.projectDir);
234209
234291
  assertRestResourceDoesNotExist(workspace.projectDir, restResourceSlug, inventory);
234210
- const blockConfigPath = path55.join(workspace.projectDir, "scripts", "block-config.ts");
234292
+ const blockConfigPath = path56.join(workspace.projectDir, "scripts", "block-config.ts");
234211
234293
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
234212
- const syncRestScriptPath = path55.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
234213
- const restResourceDir = path55.join(workspace.projectDir, "src", "rest", restResourceSlug);
234214
- const typesFilePath = path55.join(restResourceDir, "api-types.ts");
234215
- const validatorsFilePath = path55.join(restResourceDir, "api-validators.ts");
234216
- const apiFilePath = path55.join(restResourceDir, "api.ts");
234217
- const dataFilePath = path55.join(restResourceDir, "data.ts");
234218
- const phpFilePath = path55.join(workspace.projectDir, "inc", "rest", `${restResourceSlug}.php`);
234294
+ const syncRestScriptPath = path56.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
234295
+ const restResourceDir = path56.join(workspace.projectDir, "src", "rest", restResourceSlug);
234296
+ const typesFilePath = path56.join(restResourceDir, "api-types.ts");
234297
+ const validatorsFilePath = path56.join(restResourceDir, "api-validators.ts");
234298
+ const apiFilePath = path56.join(restResourceDir, "api.ts");
234299
+ const dataFilePath = path56.join(restResourceDir, "data.ts");
234300
+ const phpFilePath = path56.join(workspace.projectDir, "inc", "rest", `${restResourceSlug}.php`);
234219
234301
  const mutationSnapshot = {
234220
234302
  fileSources: await snapshotWorkspaceFiles([
234221
234303
  blockConfigPath,
@@ -234227,7 +234309,7 @@ async function runAddRestResourceCommand({
234227
234309
  };
234228
234310
  try {
234229
234311
  await fsp20.mkdir(restResourceDir, { recursive: true });
234230
- await fsp20.mkdir(path55.dirname(phpFilePath), { recursive: true });
234312
+ await fsp20.mkdir(path56.dirname(phpFilePath), { recursive: true });
234231
234313
  await ensureRestResourceBootstrapAnchors(workspace);
234232
234314
  await ensureRestResourceSyncScriptAnchors(workspace);
234233
234315
  await fsp20.writeFile(typesFilePath, buildRestResourceTypesSource(restResourceSlug, resolvedMethods), "utf8");
@@ -234279,7 +234361,7 @@ var init_cli_add_workspace_rest = __esm(() => {
234279
234361
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ability.ts
234280
234362
  import fs44 from "fs";
234281
234363
  import { promises as fsp21 } from "fs";
234282
- import path56 from "path";
234364
+ import path57 from "path";
234283
234365
  import { syncTypeSchemas as syncTypeSchemas3 } from "@wp-typia/block-runtime/metadata-core";
234284
234366
  function resolveManagedDependencyVersion(existingVersion, requiredVersion) {
234285
234367
  if (!existingVersion) {
@@ -234757,8 +234839,8 @@ function buildAbilityRegistrySource(abilitySlugs) {
234757
234839
  `);
234758
234840
  }
234759
234841
  function resolveAbilityRegistryPath(projectDir) {
234760
- const abilitiesDir = path56.join(projectDir, "src", "abilities");
234761
- return [path56.join(abilitiesDir, "index.ts"), path56.join(abilitiesDir, "index.js")].find((candidatePath) => fs44.existsSync(candidatePath)) ?? path56.join(abilitiesDir, "index.ts");
234842
+ const abilitiesDir = path57.join(projectDir, "src", "abilities");
234843
+ return [path57.join(abilitiesDir, "index.ts"), path57.join(abilitiesDir, "index.js")].find((candidatePath) => fs44.existsSync(candidatePath)) ?? path57.join(abilitiesDir, "index.ts");
234762
234844
  }
234763
234845
  function readAbilityRegistrySlugs(registryPath) {
234764
234846
  if (!fs44.existsSync(registryPath)) {
@@ -234768,7 +234850,7 @@ function readAbilityRegistrySlugs(registryPath) {
234768
234850
  return Array.from(source.matchAll(/^\s*export\s+\*\s+from\s+['"]\.\/([^/'"]+)\/client['"];?\s*$/gmu)).map((match3) => match3[1]);
234769
234851
  }
234770
234852
  async function writeAbilityRegistry(projectDir, abilitySlug) {
234771
- const abilitiesDir = path56.join(projectDir, "src", "abilities");
234853
+ const abilitiesDir = path57.join(projectDir, "src", "abilities");
234772
234854
  const registryPath = resolveAbilityRegistryPath(projectDir);
234773
234855
  await fsp21.mkdir(abilitiesDir, { recursive: true });
234774
234856
  const existingAbilitySlugs = readWorkspaceInventory(projectDir).abilities.map((entry) => entry.slug);
@@ -234900,7 +234982,7 @@ ${snippet}
234900
234982
  });
234901
234983
  }
234902
234984
  async function ensureAbilityPackageScripts(workspace) {
234903
- const packageJsonPath = path56.join(workspace.projectDir, "package.json");
234985
+ const packageJsonPath = path57.join(workspace.projectDir, "package.json");
234904
234986
  const packageJson = JSON.parse(await fsp21.readFile(packageJsonPath, "utf8"));
234905
234987
  const nextScripts = {
234906
234988
  ...packageJson.scripts ?? {},
@@ -234920,7 +235002,7 @@ async function ensureAbilityPackageScripts(workspace) {
234920
235002
  `, "utf8");
234921
235003
  }
234922
235004
  async function ensureAbilitySyncProjectAnchors(workspace) {
234923
- const syncProjectScriptPath = path56.join(workspace.projectDir, "scripts", "sync-project.ts");
235005
+ const syncProjectScriptPath = path57.join(workspace.projectDir, "scripts", "sync-project.ts");
234924
235006
  await patchFile(syncProjectScriptPath, (source) => {
234925
235007
  let nextSource = source;
234926
235008
  const syncRestConst = "const syncRestScriptPath = path.join( 'scripts', 'sync-rest-contracts.ts' );";
@@ -234935,7 +235017,7 @@ async function ensureAbilitySyncProjectAnchors(workspace) {
234935
235017
  if (!nextSource.includes(syncAbilitiesConst)) {
234936
235018
  if (!nextSource.includes(syncRestConst)) {
234937
235019
  throw new Error([
234938
- `ensureAbilitySyncProjectAnchors could not patch ${path56.basename(syncProjectScriptPath)}.`,
235020
+ `ensureAbilitySyncProjectAnchors could not patch ${path57.basename(syncProjectScriptPath)}.`,
234939
235021
  "Missing the expected sync-rest script constant in scripts/sync-project.ts.",
234940
235022
  "Restore the generated template or wire sync-abilities manually before retrying."
234941
235023
  ].join(" "));
@@ -234946,7 +235028,7 @@ ${syncAbilitiesConst}`);
234946
235028
  if (!nextSource.includes("runSyncScript( syncAbilitiesScriptPath, options );")) {
234947
235029
  if (!syncRestBlockPattern.test(nextSource)) {
234948
235030
  throw new Error([
234949
- `ensureAbilitySyncProjectAnchors could not patch ${path56.basename(syncProjectScriptPath)}.`,
235031
+ `ensureAbilitySyncProjectAnchors could not patch ${path57.basename(syncProjectScriptPath)}.`,
234950
235032
  "Missing the expected sync-rest invocation block in scripts/sync-project.ts.",
234951
235033
  "Restore the generated template or wire sync-abilities manually before retrying."
234952
235034
  ].join(" "));
@@ -234959,7 +235041,7 @@ ${syncAbilitiesBlock}`);
234959
235041
  });
234960
235042
  }
234961
235043
  async function ensureAbilityBuildScriptAnchors(workspace) {
234962
- const buildScriptPath = path56.join(workspace.projectDir, "scripts", "build-workspace.mjs");
235044
+ const buildScriptPath = path57.join(workspace.projectDir, "scripts", "build-workspace.mjs");
234963
235045
  await patchFile(buildScriptPath, (source) => {
234964
235046
  let nextSource = source;
234965
235047
  if (/['"]src\/abilities\/index\.(?:ts|js)['"]/u.test(nextSource)) {
@@ -234969,7 +235051,7 @@ async function ensureAbilityBuildScriptAnchors(workspace) {
234969
235051
  const match3 = nextSource.match(sharedEntriesPattern);
234970
235052
  if (!match3 || !match3[2].includes("src/bindings/index.ts") || !match3[2].includes("src/editor-plugins/index.ts")) {
234971
235053
  throw new Error([
234972
- `ensureAbilityBuildScriptAnchors could not patch ${path56.basename(buildScriptPath)}.`,
235054
+ `ensureAbilityBuildScriptAnchors could not patch ${path57.basename(buildScriptPath)}.`,
234973
235055
  "Missing the expected shared editor entries array in scripts/build-workspace.mjs.",
234974
235056
  "Restore the generated template or wire abilities/index manually before retrying."
234975
235057
  ].join(" "));
@@ -234986,7 +235068,7 @@ async function ensureAbilityBuildScriptAnchors(workspace) {
234986
235068
  });
234987
235069
  }
234988
235070
  async function ensureAbilityWebpackAnchors(workspace) {
234989
- const webpackConfigPath = path56.join(workspace.projectDir, "webpack.config.js");
235071
+ const webpackConfigPath = path57.join(workspace.projectDir, "webpack.config.js");
234990
235072
  await patchFile(webpackConfigPath, (source) => {
234991
235073
  if (/['"]abilities\/index['"]/u.test(source)) {
234992
235074
  return source;
@@ -235017,7 +235099,7 @@ $2`);
235017
235099
  const match3 = source.match(sharedEntriesPattern);
235018
235100
  if (!match3 || !match3[1].includes("bindings/index") || !match3[1].includes("editor-plugins/index")) {
235019
235101
  throw new Error([
235020
- `ensureAbilityWebpackAnchors could not patch ${path56.basename(webpackConfigPath)}.`,
235102
+ `ensureAbilityWebpackAnchors could not patch ${path57.basename(webpackConfigPath)}.`,
235021
235103
  "Missing the expected shared editor entries block in webpack.config.js.",
235022
235104
  "Restore the generated template or wire abilities/index manually before retrying."
235023
235105
  ].join(" "));
@@ -235047,20 +235129,20 @@ async function runAddAbilityCommand({
235047
235129
  const inventory = readWorkspaceInventory(workspace.projectDir);
235048
235130
  assertAbilityDoesNotExist(workspace.projectDir, abilitySlug, inventory);
235049
235131
  const compatibilityPolicy = resolveScaffoldCompatibilityPolicy(REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY);
235050
- const blockConfigPath = path56.join(workspace.projectDir, "scripts", "block-config.ts");
235132
+ const blockConfigPath = path57.join(workspace.projectDir, "scripts", "block-config.ts");
235051
235133
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
235052
- const buildScriptPath = path56.join(workspace.projectDir, "scripts", "build-workspace.mjs");
235053
- const packageJsonPath = path56.join(workspace.projectDir, "package.json");
235054
- const syncAbilitiesScriptPath = path56.join(workspace.projectDir, "scripts", "sync-abilities.ts");
235055
- const syncProjectScriptPath = path56.join(workspace.projectDir, "scripts", "sync-project.ts");
235056
- const webpackConfigPath = path56.join(workspace.projectDir, "webpack.config.js");
235134
+ const buildScriptPath = path57.join(workspace.projectDir, "scripts", "build-workspace.mjs");
235135
+ const packageJsonPath = path57.join(workspace.projectDir, "package.json");
235136
+ const syncAbilitiesScriptPath = path57.join(workspace.projectDir, "scripts", "sync-abilities.ts");
235137
+ const syncProjectScriptPath = path57.join(workspace.projectDir, "scripts", "sync-project.ts");
235138
+ const webpackConfigPath = path57.join(workspace.projectDir, "webpack.config.js");
235057
235139
  const abilitiesIndexPath = resolveAbilityRegistryPath(workspace.projectDir);
235058
- const abilityDir = path56.join(workspace.projectDir, "src", "abilities", abilitySlug);
235059
- const configFilePath = path56.join(abilityDir, "ability.config.json");
235060
- const typesFilePath = path56.join(abilityDir, "types.ts");
235061
- const dataFilePath = path56.join(abilityDir, "data.ts");
235062
- const clientFilePath = path56.join(abilityDir, "client.ts");
235063
- const phpFilePath = path56.join(workspace.projectDir, "inc", "abilities", `${abilitySlug}.php`);
235140
+ const abilityDir = path57.join(workspace.projectDir, "src", "abilities", abilitySlug);
235141
+ const configFilePath = path57.join(abilityDir, "ability.config.json");
235142
+ const typesFilePath = path57.join(abilityDir, "types.ts");
235143
+ const dataFilePath = path57.join(abilityDir, "data.ts");
235144
+ const clientFilePath = path57.join(abilityDir, "client.ts");
235145
+ const phpFilePath = path57.join(workspace.projectDir, "inc", "abilities", `${abilitySlug}.php`);
235064
235146
  const mutationSnapshot = {
235065
235147
  fileSources: await snapshotWorkspaceFiles([
235066
235148
  blockConfigPath,
@@ -235077,7 +235159,7 @@ async function runAddAbilityCommand({
235077
235159
  };
235078
235160
  try {
235079
235161
  await fsp21.mkdir(abilityDir, { recursive: true });
235080
- await fsp21.mkdir(path56.dirname(phpFilePath), { recursive: true });
235162
+ await fsp21.mkdir(path57.dirname(phpFilePath), { recursive: true });
235081
235163
  await ensureAbilityBootstrapAnchors(workspace);
235082
235164
  await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy));
235083
235165
  await ensureAbilityPackageScripts(workspace);
@@ -235155,7 +235237,7 @@ var init_ai_artifacts = __esm(() => {
235155
235237
 
235156
235238
  // ../wp-typia-project-tools/src/runtime/ai-feature-artifacts.ts
235157
235239
  import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
235158
- import path57 from "path";
235240
+ import path58 from "path";
235159
235241
  import {
235160
235242
  defineEndpointManifest as defineEndpointManifest3,
235161
235243
  syncEndpointClient as syncEndpointClient3,
@@ -235168,7 +235250,7 @@ function normalizeGeneratedArtifactContent(content) {
235168
235250
  }
235169
235251
  async function reconcileGeneratedArtifact(options) {
235170
235252
  if (!options.check) {
235171
- await mkdir3(path57.dirname(options.filePath), {
235253
+ await mkdir3(path58.dirname(options.filePath), {
235172
235254
  recursive: true
235173
235255
  });
235174
235256
  await writeFile5(options.filePath, options.content, "utf8");
@@ -235240,8 +235322,8 @@ async function syncAiFeatureRestArtifacts({
235240
235322
  const manifest = buildAiFeatureEndpointManifest(variables);
235241
235323
  for (const [baseName, contract] of Object.entries(manifest.contracts)) {
235242
235324
  await syncTypeSchemas4({
235243
- jsonSchemaFile: path57.join(outputDir, "api-schemas", `${baseName}.schema.json`),
235244
- openApiFile: path57.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
235325
+ jsonSchemaFile: path58.join(outputDir, "api-schemas", `${baseName}.schema.json`),
235326
+ openApiFile: path58.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
235245
235327
  projectRoot: projectDir,
235246
235328
  sourceTypeName: contract.sourceTypeName,
235247
235329
  typesFile
@@ -235249,7 +235331,7 @@ async function syncAiFeatureRestArtifacts({
235249
235331
  }
235250
235332
  await syncRestOpenApi3({
235251
235333
  manifest,
235252
- openApiFile: path57.join(outputDir, "api.openapi.json"),
235334
+ openApiFile: path58.join(outputDir, "api.openapi.json"),
235253
235335
  projectRoot: projectDir,
235254
235336
  typesFile
235255
235337
  }, executionOptions);
@@ -235267,19 +235349,19 @@ async function syncAiFeatureSchemaArtifact({
235267
235349
  outputDir,
235268
235350
  projectDir
235269
235351
  }) {
235270
- const sourceSchemaPath = path57.join(projectDir, outputDir, "api-schemas", "feature-result.schema.json");
235352
+ const sourceSchemaPath = path58.join(projectDir, outputDir, "api-schemas", "feature-result.schema.json");
235271
235353
  const responseSchema = assertJsonObject(JSON.parse(await readFile5(sourceSchemaPath, "utf8")), sourceSchemaPath);
235272
235354
  const aiSchema = projectWordPressAiSchema(responseSchema);
235273
235355
  await reconcileGeneratedArtifact({
235274
235356
  check: check2,
235275
235357
  content: `${JSON.stringify(aiSchema, null, 2)}
235276
235358
  `,
235277
- filePath: path57.join(projectDir, aiSchemaFile),
235359
+ filePath: path58.join(projectDir, aiSchemaFile),
235278
235360
  label: "AI feature schema"
235279
235361
  });
235280
235362
  return {
235281
235363
  aiSchema,
235282
- aiSchemaPath: path57.join(projectDir, aiSchemaFile),
235364
+ aiSchemaPath: path58.join(projectDir, aiSchemaFile),
235283
235365
  check: check2,
235284
235366
  sourceSchemaPath
235285
235367
  };
@@ -235360,6 +235442,45 @@ export interface ${pascalCase}AiFeatureResponse {
235360
235442
  result: ${pascalCase}AiFeatureResult;
235361
235443
  telemetry: ${pascalCase}AiFeatureTelemetry;
235362
235444
  }
235445
+
235446
+ export type ${pascalCase}AiFeatureSupportProbeMode = 'request-time';
235447
+
235448
+ export type ${pascalCase}AiFeatureUnavailableErrorCode =
235449
+ 'ai_client_unavailable';
235450
+
235451
+ export type ${pascalCase}AiFeatureUnavailableReasonCode =
235452
+ | 'missing-wordpress-ai-client'
235453
+ | 'request-time-support-probe';
235454
+
235455
+ export interface ${pascalCase}AiFeatureSupportReason {
235456
+ code: ${pascalCase}AiFeatureUnavailableReasonCode;
235457
+ label: string & tags.MinLength< 1 > & tags.MaxLength< 160 >;
235458
+ message: string & tags.MinLength< 1 > & tags.MaxLength< 4000 >;
235459
+ }
235460
+
235461
+ export interface ${pascalCase}AiFeatureSupportMetadata {
235462
+ featureLabel: string & tags.MinLength< 1 > & tags.MaxLength< 160 >;
235463
+ featureSlug: string & tags.MinLength< 1 > & tags.MaxLength< 160 >;
235464
+ compatibility: {
235465
+ hardMinimums: {
235466
+ php?: string;
235467
+ wordpress?: string;
235468
+ };
235469
+ mode: 'baseline' | 'optional' | 'required';
235470
+ optionalFeatureIds: string[];
235471
+ optionalFeatures: string[];
235472
+ requiredFeatureIds: string[];
235473
+ requiredFeatures: string[];
235474
+ runtimeGates: string[];
235475
+ };
235476
+ supportProbe: {
235477
+ endpointMethod: 'POST';
235478
+ endpointPath: string & tags.MinLength< 1 > & tags.MaxLength< 200 >;
235479
+ mode: ${pascalCase}AiFeatureSupportProbeMode;
235480
+ unavailableErrorCode: ${pascalCase}AiFeatureUnavailableErrorCode;
235481
+ };
235482
+ unavailableReasons: ${pascalCase}AiFeatureSupportReason[];
235483
+ }
235363
235484
  `;
235364
235485
  }
235365
235486
  function buildAiFeatureValidatorsSource(aiFeatureSlug) {
@@ -235395,6 +235516,8 @@ export const apiValidators = {
235395
235516
  }
235396
235517
  function buildAiFeatureApiSource(aiFeatureSlug) {
235397
235518
  const pascalCase = toPascalCase(aiFeatureSlug);
235519
+ const compatibility = createScaffoldCompatibilityConfig(resolveScaffoldCompatibilityPolicy(OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY));
235520
+ const title = toTitleCase(aiFeatureSlug);
235398
235521
  return `import {
235399
235522
  callEndpoint,
235400
235523
  resolveRestRouteUrl,
@@ -235402,6 +235525,7 @@ function buildAiFeatureApiSource(aiFeatureSlug) {
235402
235525
 
235403
235526
  import type {
235404
235527
  ${pascalCase}AiFeatureRequest,
235528
+ ${pascalCase}AiFeatureSupportMetadata,
235405
235529
  } from './api-types';
235406
235530
  import {
235407
235531
  run${pascalCase}AiFeatureEndpoint,
@@ -235428,6 +235552,14 @@ function resolveRestNonce( fallback?: string ): string | undefined {
235428
235552
  : undefined;
235429
235553
  }
235430
235554
 
235555
+ function isPlainObject( value: unknown ): value is Record< string, unknown > {
235556
+ return (
235557
+ !! value &&
235558
+ typeof value === 'object' &&
235559
+ ! Array.isArray( value )
235560
+ );
235561
+ }
235562
+
235431
235563
  export const aiFeatureRunEndpoint = {
235432
235564
  ...run${pascalCase}AiFeatureEndpoint,
235433
235565
  buildRequestOptions: () => {
@@ -235443,6 +235575,63 @@ export const aiFeatureRunEndpoint = {
235443
235575
  },
235444
235576
  };
235445
235577
 
235578
+ export const aiFeatureSupportMetadata = {
235579
+ compatibility: ${JSON.stringify(compatibility, null, "\t")},
235580
+ featureLabel: ${quoteTsString(title)},
235581
+ featureSlug: ${quoteTsString(aiFeatureSlug)},
235582
+ supportProbe: {
235583
+ endpointMethod: 'POST',
235584
+ endpointPath: aiFeatureRunEndpoint.path,
235585
+ mode: 'request-time',
235586
+ unavailableErrorCode: 'ai_client_unavailable',
235587
+ },
235588
+ unavailableReasons: [
235589
+ {
235590
+ code: 'missing-wordpress-ai-client',
235591
+ label: 'WordPress AI Client unavailable',
235592
+ message:
235593
+ 'This AI feature stays disabled until the WordPress AI Client is available on the site.',
235594
+ },
235595
+ {
235596
+ code: 'request-time-support-probe',
235597
+ label: 'Support is checked at request time',
235598
+ message:
235599
+ 'Support is verified when the feature runs, so editor and admin UIs should degrade gracefully when the site rejects the request.',
235600
+ },
235601
+ ],
235602
+ } satisfies ${pascalCase}AiFeatureSupportMetadata;
235603
+
235604
+ export function getAiFeatureSupportHintLines() {
235605
+ return aiFeatureSupportMetadata.unavailableReasons.map(
235606
+ ( reason ) => reason.message
235607
+ );
235608
+ }
235609
+
235610
+ export function isAiFeatureSupportUnavailableError( error: unknown ) {
235611
+ if ( ! isPlainObject( error ) ) {
235612
+ return false;
235613
+ }
235614
+
235615
+ const data = isPlainObject( error.data ) ? error.data : undefined;
235616
+ return (
235617
+ error.code === aiFeatureSupportMetadata.supportProbe.unavailableErrorCode ||
235618
+ data?.status === 501
235619
+ );
235620
+ }
235621
+
235622
+ export function resolveAiFeatureUnavailableMessage( error: unknown ) {
235623
+ if (
235624
+ isPlainObject( error ) &&
235625
+ typeof error.message === 'string' &&
235626
+ error.message.length > 0
235627
+ ) {
235628
+ return error.message;
235629
+ }
235630
+
235631
+ return aiFeatureSupportMetadata.unavailableReasons[ 0 ]?.message ??
235632
+ 'This AI feature is currently unavailable.';
235633
+ }
235634
+
235446
235635
  export function runAiFeature( request: ${pascalCase}AiFeatureRequest ) {
235447
235636
  return callEndpoint( aiFeatureRunEndpoint, request );
235448
235637
  }
@@ -235461,6 +235650,10 @@ import type {
235461
235650
  } from './api-types';
235462
235651
  import {
235463
235652
  aiFeatureRunEndpoint,
235653
+ aiFeatureSupportMetadata,
235654
+ getAiFeatureSupportHintLines,
235655
+ isAiFeatureSupportUnavailableError,
235656
+ resolveAiFeatureUnavailableMessage,
235464
235657
  } from './api';
235465
235658
 
235466
235659
  export type UseRun${pascalCase}AiFeatureMutationOptions =
@@ -235475,6 +235668,13 @@ export function useRun${pascalCase}AiFeatureMutation(
235475
235668
  ) {
235476
235669
  return useEndpointMutation( aiFeatureRunEndpoint, options );
235477
235670
  }
235671
+
235672
+ export {
235673
+ aiFeatureSupportMetadata,
235674
+ getAiFeatureSupportHintLines,
235675
+ isAiFeatureSupportUnavailableError,
235676
+ resolveAiFeatureUnavailableMessage,
235677
+ };
235478
235678
  `;
235479
235679
  }
235480
235680
  function buildAiFeatureSyncScriptSource() {
@@ -235611,7 +235811,7 @@ var init_cli_add_workspace_ai_source_emitters = __esm(() => {
235611
235811
 
235612
235812
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai-anchors.ts
235613
235813
  import { promises as fsp22 } from "fs";
235614
- import path58 from "path";
235814
+ import path59 from "path";
235615
235815
  async function ensureAiFeatureBootstrapAnchors(workspace) {
235616
235816
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
235617
235817
  await patchFile(bootstrapPath, (source) => {
@@ -235658,7 +235858,7 @@ ${snippet}
235658
235858
  insertPhpSnippet(registerFunction);
235659
235859
  } else if (!nextSource.includes(AI_FEATURE_SERVER_GLOB)) {
235660
235860
  throw new Error([
235661
- `Unable to patch ${path58.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
235861
+ `Unable to patch ${path59.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
235662
235862
  `The existing ${registerFunctionName}() definition does not include ${AI_FEATURE_SERVER_GLOB}.`,
235663
235863
  "Restore the generated bootstrap shape or wire the AI feature loader manually before retrying."
235664
235864
  ].join(" "));
@@ -235670,7 +235870,7 @@ ${snippet}
235670
235870
  });
235671
235871
  }
235672
235872
  async function ensureAiFeaturePackageScripts(workspace) {
235673
- const packageJsonPath = path58.join(workspace.projectDir, "package.json");
235873
+ const packageJsonPath = path59.join(workspace.projectDir, "package.json");
235674
235874
  const packageJson = JSON.parse(await fsp22.readFile(packageJsonPath, "utf8"));
235675
235875
  const nextScripts = {
235676
235876
  ...packageJson.scripts ?? {},
@@ -235698,7 +235898,7 @@ async function ensureAiFeaturePackageScripts(workspace) {
235698
235898
  };
235699
235899
  }
235700
235900
  async function ensureAiFeatureSyncProjectAnchors(workspace) {
235701
- const syncProjectScriptPath = path58.join(workspace.projectDir, "scripts", "sync-project.ts");
235901
+ const syncProjectScriptPath = path59.join(workspace.projectDir, "scripts", "sync-project.ts");
235702
235902
  await patchFile(syncProjectScriptPath, (source) => {
235703
235903
  let nextSource = source;
235704
235904
  const syncRestConst = "const syncRestScriptPath = path.join( 'scripts', 'sync-rest-contracts.ts' );";
@@ -235713,7 +235913,7 @@ async function ensureAiFeatureSyncProjectAnchors(workspace) {
235713
235913
  if (!nextSource.includes(syncAiConst)) {
235714
235914
  if (!nextSource.includes(syncRestConst)) {
235715
235915
  throw new Error([
235716
- `ensureAiFeatureSyncProjectAnchors could not patch ${path58.basename(syncProjectScriptPath)}.`,
235916
+ `ensureAiFeatureSyncProjectAnchors could not patch ${path59.basename(syncProjectScriptPath)}.`,
235717
235917
  "Missing the expected sync-rest script constant in scripts/sync-project.ts.",
235718
235918
  "Restore the generated template or wire sync-ai manually before retrying."
235719
235919
  ].join(" "));
@@ -235724,7 +235924,7 @@ ${syncAiConst}`);
235724
235924
  if (!nextSource.includes("runSyncScript( syncAiScriptPath, options );")) {
235725
235925
  if (!syncRestBlockPattern.test(nextSource)) {
235726
235926
  throw new Error([
235727
- `ensureAiFeatureSyncProjectAnchors could not patch ${path58.basename(syncProjectScriptPath)}.`,
235927
+ `ensureAiFeatureSyncProjectAnchors could not patch ${path59.basename(syncProjectScriptPath)}.`,
235728
235928
  "Missing the expected sync-rest invocation block in scripts/sync-project.ts.",
235729
235929
  "Restore the generated template or wire sync-ai manually before retrying."
235730
235930
  ].join(" "));
@@ -235739,7 +235939,7 @@ ${syncAiBlock}`);
235739
235939
  function assertSyncRestAnchor2(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath) {
235740
235940
  if (!nextSource.includes(target) && !hasAnchor) {
235741
235941
  throw new Error([
235742
- `ensureAiFeatureSyncRestAnchors could not patch ${path58.basename(syncRestScriptPath)}.`,
235942
+ `ensureAiFeatureSyncRestAnchors could not patch ${path59.basename(syncRestScriptPath)}.`,
235743
235943
  `Missing expected ${anchorDescription} anchor in scripts/sync-rest-contracts.ts.`,
235744
235944
  "Restore the generated template or add the AI feature wiring manually before retrying."
235745
235945
  ].join(" "));
@@ -235754,7 +235954,7 @@ function replaceRequiredSyncRestSource2(nextSource, target, anchor, replacement,
235754
235954
  return nextSource.replace(anchor, replacement);
235755
235955
  }
235756
235956
  async function ensureAiFeatureSyncRestAnchors(workspace) {
235757
- const syncRestScriptPath = path58.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
235957
+ const syncRestScriptPath = path59.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
235758
235958
  await patchFile(syncRestScriptPath, (source) => {
235759
235959
  let nextSource = source;
235760
235960
  const importAnchor = [
@@ -235889,7 +236089,7 @@ var init_cli_add_workspace_ai_anchors = __esm(() => {
235889
236089
 
235890
236090
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai.ts
235891
236091
  import { promises as fsp23 } from "fs";
235892
- import path59 from "path";
236092
+ import path60 from "path";
235893
236093
  function buildAiFeaturePhpSource(aiFeatureSlug, namespace, phpPrefix, textDomain) {
235894
236094
  const aiFeatureTitle = toTitleCase(aiFeatureSlug);
235895
236095
  const aiFeaturePhpId = aiFeatureSlug.replace(/-/g, "_");
@@ -235898,18 +236098,40 @@ function buildAiFeaturePhpSource(aiFeatureSlug, namespace, phpPrefix, textDomain
235898
236098
  const normalizeSchemaFunctionName = `${phpPrefix}_${aiFeaturePhpId}_sanitize_ai_feature_schema`;
235899
236099
  const validatePayloadFunctionName = `${phpPrefix}_${aiFeaturePhpId}_validate_ai_feature_payload`;
235900
236100
  const canManageFunctionName = `${phpPrefix}_${aiFeaturePhpId}_can_manage_ai_feature`;
236101
+ const normalizePromptPayloadFunctionName = `${phpPrefix}_${aiFeaturePhpId}_normalize_ai_feature_prompt_payload`;
235901
236102
  const buildPromptFunctionName = `${phpPrefix}_${aiFeaturePhpId}_build_ai_feature_prompt`;
236103
+ const resolvePromptOptionsFunctionName = `${phpPrefix}_${aiFeaturePhpId}_resolve_ai_feature_prompt_options`;
235902
236104
  const normalizeProviderTypeFunctionName = `${phpPrefix}_${aiFeaturePhpId}_normalize_provider_type`;
235903
236105
  const buildTelemetryFunctionName = `${phpPrefix}_${aiFeaturePhpId}_build_ai_feature_telemetry`;
236106
+ const resolveUnavailableMessageFunctionName = `${phpPrefix}_${aiFeaturePhpId}_resolve_ai_feature_unavailable_message`;
235904
236107
  const isSupportedFunctionName = `${phpPrefix}_${aiFeaturePhpId}_is_ai_feature_supported`;
235905
236108
  const adminNoticeFunctionName = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_admin_notice`;
235906
236109
  const handlerFunctionName = `${phpPrefix}_${aiFeaturePhpId}_handle_run_ai_feature`;
235907
236110
  const registerRoutesFunctionName = `${phpPrefix}_${aiFeaturePhpId}_register_ai_feature_routes`;
236111
+ const permissionFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_permission`;
236112
+ const promptPayloadFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_prompt_payload`;
236113
+ const promptFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_prompt`;
236114
+ const promptOptionsFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_prompt_options`;
236115
+ const adminNoticeMessageFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_admin_notice_message`;
236116
+ const unavailableMessageFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_unavailable_message`;
236117
+ const telemetryFilterHook = `${phpPrefix}_${aiFeaturePhpId}_ai_feature_telemetry`;
235908
236118
  return `<?php
235909
236119
  if ( ! defined( 'ABSPATH' ) ) {
235910
236120
  return;
235911
236121
  }
235912
236122
 
236123
+ /*
236124
+ * Customization hooks for the ${aiFeatureTitle} AI feature:
236125
+ *
236126
+ * - ${quotePhpString(permissionFilterHook)} filters the default current_user_can( 'edit_posts' ) capability check.
236127
+ * - ${quotePhpString(promptPayloadFilterHook)} filters the validated request payload array before prompt serialization.
236128
+ * - ${quotePhpString(promptFilterHook)} filters the final prompt string after payload normalization.
236129
+ * - ${quotePhpString(promptOptionsFilterHook)} filters prompt options with \`temperature\` and \`modelPreference\` keys.
236130
+ * - ${quotePhpString(adminNoticeMessageFilterHook)} filters the wp-admin notice shown when AI support is unavailable.
236131
+ * - ${quotePhpString(unavailableMessageFilterHook)} filters REST-facing unavailable messages by reason code.
236132
+ * - ${quotePhpString(telemetryFilterHook)} filters the response telemetry array before schema validation. Return a schema-compatible array.
236133
+ */
236134
+
235913
236135
  if ( ! function_exists( '${loadSchemaFunctionName}' ) ) {
235914
236136
  function ${loadSchemaFunctionName}( $schema_name ) {
235915
236137
  $project_root = dirname( __DIR__, 2 );
@@ -235976,17 +236198,111 @@ if ( ! function_exists( '${validatePayloadFunctionName}' ) ) {
235976
236198
  }
235977
236199
 
235978
236200
  if ( ! function_exists( '${canManageFunctionName}' ) ) {
235979
- function ${canManageFunctionName}() {
235980
- return current_user_can( 'edit_posts' );
236201
+ function ${canManageFunctionName}( WP_REST_Request $request = null ) {
236202
+ $permission = apply_filters(
236203
+ ${quotePhpString(permissionFilterHook)},
236204
+ current_user_can( 'edit_posts' ),
236205
+ $request
236206
+ );
236207
+ if ( is_wp_error( $permission ) ) {
236208
+ return $permission;
236209
+ }
236210
+ return (bool) $permission;
236211
+ }
236212
+ }
236213
+
236214
+ if ( ! function_exists( '${normalizePromptPayloadFunctionName}' ) ) {
236215
+ function ${normalizePromptPayloadFunctionName}( array $payload ) {
236216
+ $normalized_payload = apply_filters(
236217
+ ${quotePhpString(promptPayloadFilterHook)},
236218
+ $payload
236219
+ );
236220
+ return is_array( $normalized_payload ) ? $normalized_payload : $payload;
235981
236221
  }
235982
236222
  }
235983
236223
 
235984
236224
  if ( ! function_exists( '${buildPromptFunctionName}' ) ) {
235985
236225
  function ${buildPromptFunctionName}( array $payload ) {
235986
- return sprintf(
236226
+ $normalized_payload = ${normalizePromptPayloadFunctionName}( $payload );
236227
+ $prompt = sprintf(
235987
236228
  'You are helping with the %1$s AI workflow. Read the JSON request payload and return JSON that matches the provided schema. Request payload: %2$s',
235988
236229
  ${quotePhpString(aiFeatureTitle)},
235989
- wp_json_encode( $payload )
236230
+ wp_json_encode( $normalized_payload )
236231
+ );
236232
+ $filtered_prompt = apply_filters(
236233
+ ${quotePhpString(promptFilterHook)},
236234
+ $prompt,
236235
+ $normalized_payload,
236236
+ $payload
236237
+ );
236238
+ return is_string( $filtered_prompt ) && '' !== $filtered_prompt ? $filtered_prompt : $prompt;
236239
+ }
236240
+ }
236241
+
236242
+ if ( ! function_exists( '${resolvePromptOptionsFunctionName}' ) ) {
236243
+ function ${resolvePromptOptionsFunctionName}( array $payload = array() ) {
236244
+ $options = apply_filters(
236245
+ ${quotePhpString(promptOptionsFilterHook)},
236246
+ array(
236247
+ 'modelPreference' => array(),
236248
+ 'temperature' => 0.2,
236249
+ ),
236250
+ $payload
236251
+ );
236252
+ if ( ! is_array( $options ) ) {
236253
+ $options = array();
236254
+ }
236255
+
236256
+ $temperature = 0.2;
236257
+ if ( array_key_exists( 'temperature', $options ) ) {
236258
+ if ( null === $options['temperature'] ) {
236259
+ $temperature = null;
236260
+ } elseif ( is_numeric( $options['temperature'] ) ) {
236261
+ $temperature = (float) $options['temperature'];
236262
+ }
236263
+ }
236264
+
236265
+ $model_preferences = array();
236266
+ if ( isset( $options['modelPreference'] ) ) {
236267
+ $raw_model_preferences = $options['modelPreference'];
236268
+ if ( is_string( $raw_model_preferences ) && '' !== $raw_model_preferences ) {
236269
+ $model_preferences = array( $raw_model_preferences );
236270
+ } elseif ( is_array( $raw_model_preferences ) ) {
236271
+ $model_preferences = array_values(
236272
+ array_filter(
236273
+ array_map(
236274
+ static function ( $candidate ) {
236275
+ if ( is_string( $candidate ) && '' !== $candidate ) {
236276
+ return $candidate;
236277
+ }
236278
+ if ( ! is_array( $candidate ) ) {
236279
+ return null;
236280
+ }
236281
+
236282
+ $normalized = array_values(
236283
+ array_filter(
236284
+ $candidate,
236285
+ static function ( $value ) {
236286
+ return is_string( $value ) && '' !== $value;
236287
+ }
236288
+ )
236289
+ );
236290
+
236291
+ return count( $normalized ) > 0 ? $normalized : null;
236292
+ },
236293
+ $raw_model_preferences
236294
+ ),
236295
+ static function ( $candidate ) {
236296
+ return null !== $candidate;
236297
+ }
236298
+ )
236299
+ );
236300
+ }
236301
+ }
236302
+
236303
+ return array(
236304
+ 'modelPreference' => $model_preferences,
236305
+ 'temperature' => $temperature,
235990
236306
  );
235991
236307
  }
235992
236308
  }
@@ -236002,7 +236318,7 @@ if ( ! function_exists( '${normalizeProviderTypeFunctionName}' ) ) {
236002
236318
  }
236003
236319
 
236004
236320
  if ( ! function_exists( '${buildTelemetryFunctionName}' ) ) {
236005
- function ${buildTelemetryFunctionName}( $result ) {
236321
+ function ${buildTelemetryFunctionName}( $result, array $payload = array(), array $normalized_result = array() ) {
236006
236322
  if (
236007
236323
  ! is_object( $result ) ||
236008
236324
  ! method_exists( $result, 'getId' ) ||
@@ -236062,47 +236378,95 @@ if ( ! function_exists( '${buildTelemetryFunctionName}' ) ) {
236062
236378
  }
236063
236379
  }
236064
236380
 
236065
- return $telemetry;
236381
+ $filtered_telemetry = apply_filters(
236382
+ ${quotePhpString(telemetryFilterHook)},
236383
+ $telemetry,
236384
+ $result,
236385
+ $payload,
236386
+ $normalized_result
236387
+ );
236388
+ return is_array( $filtered_telemetry ) ? $filtered_telemetry : $telemetry;
236389
+ }
236390
+ }
236391
+
236392
+ if ( ! function_exists( '${resolveUnavailableMessageFunctionName}' ) ) {
236393
+ function ${resolveUnavailableMessageFunctionName}( $message, $reason, array $context = array() ) {
236394
+ $filtered_message = apply_filters(
236395
+ ${quotePhpString(unavailableMessageFilterHook)},
236396
+ $message,
236397
+ $reason,
236398
+ $context
236399
+ );
236400
+ return is_string( $filtered_message ) && '' !== $filtered_message ? $filtered_message : $message;
236066
236401
  }
236067
236402
  }
236068
236403
 
236069
236404
  if ( ! function_exists( '${isSupportedFunctionName}' ) ) {
236070
- function ${isSupportedFunctionName}() {
236405
+ function ${isSupportedFunctionName}( array $payload = array(), $cache_result = true ) {
236071
236406
  static $is_supported = null;
236072
- if ( null !== $is_supported ) {
236407
+ $use_cache = $cache_result && count( $payload ) === 0;
236408
+ if ( $use_cache && null !== $is_supported ) {
236073
236409
  return $is_supported;
236074
236410
  }
236075
236411
 
236076
236412
  if ( ! function_exists( 'wp_ai_client_prompt' ) ) {
236077
- $is_supported = false;
236078
- return $is_supported;
236413
+ if ( $use_cache ) {
236414
+ $is_supported = false;
236415
+ }
236416
+ return false;
236079
236417
  }
236080
236418
 
236081
236419
  $schema = ${loadAiSchemaFunctionName}();
236082
236420
  if ( ! is_array( $schema ) ) {
236083
- $is_supported = false;
236084
- return $is_supported;
236421
+ if ( $use_cache ) {
236422
+ $is_supported = false;
236423
+ }
236424
+ return false;
236085
236425
  }
236086
236426
 
236087
236427
  $prompt = wp_ai_client_prompt( 'AI feature support probe.' );
236088
236428
  if ( ! is_object( $prompt ) || ! method_exists( $prompt, 'as_json_response' ) ) {
236089
- $is_supported = false;
236090
- return $is_supported;
236429
+ if ( $use_cache ) {
236430
+ $is_supported = false;
236431
+ }
236432
+ return false;
236433
+ }
236434
+ $prompt_options = ${resolvePromptOptionsFunctionName}( $payload );
236435
+ if (
236436
+ array_key_exists( 'temperature', $prompt_options ) &&
236437
+ null !== $prompt_options['temperature'] &&
236438
+ method_exists( $prompt, 'using_temperature' )
236439
+ ) {
236440
+ $prompt = $prompt->using_temperature( $prompt_options['temperature'] );
236441
+ }
236442
+ if (
236443
+ ! empty( $prompt_options['modelPreference'] ) &&
236444
+ method_exists( $prompt, 'using_model_preference' )
236445
+ ) {
236446
+ $prompt = $prompt->using_model_preference( ...$prompt_options['modelPreference'] );
236091
236447
  }
236092
236448
 
236093
236449
  $structured_prompt = $prompt->as_json_response( $schema );
236094
236450
  if ( ! is_object( $structured_prompt ) ) {
236095
- $is_supported = false;
236096
- return $is_supported;
236451
+ if ( $use_cache ) {
236452
+ $is_supported = false;
236453
+ }
236454
+ return false;
236097
236455
  }
236098
236456
 
236099
236457
  if ( method_exists( $structured_prompt, 'is_supported_for_text_generation' ) ) {
236100
- $is_supported = (bool) $structured_prompt->is_supported_for_text_generation();
236101
- return $is_supported;
236458
+ $supported = (bool) $structured_prompt->is_supported_for_text_generation();
236459
+ if ( $use_cache ) {
236460
+ $is_supported = $supported;
236461
+ }
236462
+ return $supported;
236102
236463
  }
236103
236464
 
236104
- $is_supported = method_exists( $structured_prompt, 'generate_text_result' );
236105
- return $is_supported;
236465
+ $supported = method_exists( $structured_prompt, 'generate_text_result' );
236466
+ if ( $use_cache ) {
236467
+ $is_supported = $supported;
236468
+ }
236469
+ return $supported;
236106
236470
  }
236107
236471
  }
236108
236472
 
@@ -236117,6 +236481,18 @@ if ( ! function_exists( '${adminNoticeFunctionName}' ) ) {
236117
236481
  __( 'The %s AI feature is optional and remains disabled until the WordPress AI Client is available with structured text generation support for the generated schema.', ${quotePhpString(textDomain)} ),
236118
236482
  ${quotePhpString(aiFeatureTitle)}
236119
236483
  );
236484
+ $filtered_message = apply_filters(
236485
+ ${quotePhpString(adminNoticeMessageFilterHook)},
236486
+ $message,
236487
+ array(
236488
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236489
+ 'featureTitle' => ${quotePhpString(aiFeatureTitle)},
236490
+ 'namespace' => ${quotePhpString(namespace)},
236491
+ )
236492
+ );
236493
+ if ( is_string( $filtered_message ) && '' !== $filtered_message ) {
236494
+ $message = $filtered_message;
236495
+ }
236120
236496
  printf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html( $message ) );
236121
236497
  }
236122
236498
  }
@@ -236128,10 +236504,16 @@ if ( ! function_exists( '${handlerFunctionName}' ) ) {
236128
236504
  return $payload;
236129
236505
  }
236130
236506
 
236131
- if ( ! ${isSupportedFunctionName}() ) {
236507
+ if ( ! ${isSupportedFunctionName}( $payload, false ) ) {
236132
236508
  return new WP_Error(
236133
236509
  'ai_client_unavailable',
236134
- 'The WordPress AI Client is unavailable or does not support this feature endpoint.',
236510
+ ${resolveUnavailableMessageFunctionName}(
236511
+ 'The WordPress AI Client is unavailable or does not support this feature endpoint.',
236512
+ 'support_probe_failed',
236513
+ array(
236514
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236515
+ )
236516
+ ),
236135
236517
  array( 'status' => 501 )
236136
236518
  );
236137
236519
  }
@@ -236145,22 +236527,45 @@ if ( ! function_exists( '${handlerFunctionName}' ) ) {
236145
236527
  );
236146
236528
  }
236147
236529
 
236530
+ $prompt_options = ${resolvePromptOptionsFunctionName}( $payload );
236148
236531
  $prompt = wp_ai_client_prompt( ${buildPromptFunctionName}( $payload ) );
236149
236532
  if ( ! is_object( $prompt ) ) {
236150
236533
  return new WP_Error(
236151
236534
  'ai_client_unavailable',
236152
- 'The WordPress AI Client prompt builder is unavailable on this site.',
236535
+ ${resolveUnavailableMessageFunctionName}(
236536
+ 'The WordPress AI Client prompt builder is unavailable on this site.',
236537
+ 'prompt_builder_missing',
236538
+ array(
236539
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236540
+ )
236541
+ ),
236153
236542
  array( 'status' => 501 )
236154
236543
  );
236155
236544
  }
236156
236545
 
236157
- if ( method_exists( $prompt, 'using_temperature' ) ) {
236158
- $prompt = $prompt->using_temperature( 0.2 );
236546
+ if (
236547
+ array_key_exists( 'temperature', $prompt_options ) &&
236548
+ null !== $prompt_options['temperature'] &&
236549
+ method_exists( $prompt, 'using_temperature' )
236550
+ ) {
236551
+ $prompt = $prompt->using_temperature( $prompt_options['temperature'] );
236552
+ }
236553
+ if (
236554
+ ! empty( $prompt_options['modelPreference'] ) &&
236555
+ method_exists( $prompt, 'using_model_preference' )
236556
+ ) {
236557
+ $prompt = $prompt->using_model_preference( ...$prompt_options['modelPreference'] );
236159
236558
  }
236160
236559
  if ( ! method_exists( $prompt, 'as_json_response' ) ) {
236161
236560
  return new WP_Error(
236162
236561
  'ai_client_unavailable',
236163
- 'The current WordPress AI Client does not expose as_json_response().',
236562
+ ${resolveUnavailableMessageFunctionName}(
236563
+ 'The current WordPress AI Client does not expose as_json_response().',
236564
+ 'as_json_response_missing',
236565
+ array(
236566
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236567
+ )
236568
+ ),
236164
236569
  array( 'status' => 501 )
236165
236570
  );
236166
236571
  }
@@ -236169,7 +236574,13 @@ if ( ! function_exists( '${handlerFunctionName}' ) ) {
236169
236574
  if ( ! is_object( $structured_prompt ) ) {
236170
236575
  return new WP_Error(
236171
236576
  'ai_client_unavailable',
236172
- 'The current WordPress AI Client could not prepare a structured-output prompt.',
236577
+ ${resolveUnavailableMessageFunctionName}(
236578
+ 'The current WordPress AI Client could not prepare a structured-output prompt.',
236579
+ 'structured_prompt_missing',
236580
+ array(
236581
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236582
+ )
236583
+ ),
236173
236584
  array( 'status' => 501 )
236174
236585
  );
236175
236586
  }
@@ -236180,14 +236591,26 @@ if ( ! function_exists( '${handlerFunctionName}' ) ) {
236180
236591
  ) {
236181
236592
  return new WP_Error(
236182
236593
  'ai_client_unavailable',
236183
- 'The current WordPress AI Client provider or model does not support this structured-output feature.',
236594
+ ${resolveUnavailableMessageFunctionName}(
236595
+ 'The current WordPress AI Client provider or model does not support this structured-output feature.',
236596
+ 'text_generation_unsupported',
236597
+ array(
236598
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236599
+ )
236600
+ ),
236184
236601
  array( 'status' => 501 )
236185
236602
  );
236186
236603
  }
236187
236604
  if ( ! method_exists( $structured_prompt, 'generate_text_result' ) ) {
236188
236605
  return new WP_Error(
236189
236606
  'ai_client_unavailable',
236190
- 'The current WordPress AI Client does not expose generate_text_result() after as_json_response().',
236607
+ ${resolveUnavailableMessageFunctionName}(
236608
+ 'The current WordPress AI Client does not expose generate_text_result() after as_json_response().',
236609
+ 'generate_text_result_missing',
236610
+ array(
236611
+ 'featureSlug' => ${quotePhpString(aiFeatureSlug)},
236612
+ )
236613
+ ),
236191
236614
  array( 'status' => 501 )
236192
236615
  );
236193
236616
  }
@@ -236222,7 +236645,7 @@ if ( ! function_exists( '${handlerFunctionName}' ) ) {
236222
236645
  );
236223
236646
  }
236224
236647
 
236225
- $telemetry = ${buildTelemetryFunctionName}( $result );
236648
+ $telemetry = ${buildTelemetryFunctionName}( $result, $payload, $normalized_result );
236226
236649
  if ( is_wp_error( $telemetry ) ) {
236227
236650
  return $telemetry;
236228
236651
  }
@@ -236278,18 +236701,18 @@ async function runAddAiFeatureCommand({
236278
236701
  const compatibilityPolicy = resolveScaffoldCompatibilityPolicy(OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY);
236279
236702
  const inventory = readWorkspaceInventory(workspace.projectDir);
236280
236703
  assertAiFeatureDoesNotExist(workspace.projectDir, aiFeatureSlug, inventory);
236281
- const blockConfigPath = path59.join(workspace.projectDir, "scripts", "block-config.ts");
236704
+ const blockConfigPath = path60.join(workspace.projectDir, "scripts", "block-config.ts");
236282
236705
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
236283
- const packageJsonPath = path59.join(workspace.projectDir, "package.json");
236284
- const syncAiScriptPath = path59.join(workspace.projectDir, "scripts", "sync-ai-features.ts");
236285
- const syncProjectScriptPath = path59.join(workspace.projectDir, "scripts", "sync-project.ts");
236286
- const syncRestScriptPath = path59.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
236287
- const aiFeatureDir = path59.join(workspace.projectDir, "src", "ai-features", aiFeatureSlug);
236288
- const typesFilePath = path59.join(aiFeatureDir, "api-types.ts");
236289
- const validatorsFilePath = path59.join(aiFeatureDir, "api-validators.ts");
236290
- const apiFilePath = path59.join(aiFeatureDir, "api.ts");
236291
- const dataFilePath = path59.join(aiFeatureDir, "data.ts");
236292
- const phpFilePath = path59.join(workspace.projectDir, "inc", "ai-features", `${aiFeatureSlug}.php`);
236706
+ const packageJsonPath = path60.join(workspace.projectDir, "package.json");
236707
+ const syncAiScriptPath = path60.join(workspace.projectDir, "scripts", "sync-ai-features.ts");
236708
+ const syncProjectScriptPath = path60.join(workspace.projectDir, "scripts", "sync-project.ts");
236709
+ const syncRestScriptPath = path60.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
236710
+ const aiFeatureDir = path60.join(workspace.projectDir, "src", "ai-features", aiFeatureSlug);
236711
+ const typesFilePath = path60.join(aiFeatureDir, "api-types.ts");
236712
+ const validatorsFilePath = path60.join(aiFeatureDir, "api-validators.ts");
236713
+ const apiFilePath = path60.join(aiFeatureDir, "api.ts");
236714
+ const dataFilePath = path60.join(aiFeatureDir, "data.ts");
236715
+ const phpFilePath = path60.join(workspace.projectDir, "inc", "ai-features", `${aiFeatureSlug}.php`);
236293
236716
  const mutationSnapshot = {
236294
236717
  fileSources: await snapshotWorkspaceFiles([
236295
236718
  blockConfigPath,
@@ -236304,7 +236727,7 @@ async function runAddAiFeatureCommand({
236304
236727
  };
236305
236728
  try {
236306
236729
  await fsp23.mkdir(aiFeatureDir, { recursive: true });
236307
- await fsp23.mkdir(path59.dirname(phpFilePath), { recursive: true });
236730
+ await fsp23.mkdir(path60.dirname(phpFilePath), { recursive: true });
236308
236731
  await ensureAiFeatureBootstrapAnchors(workspace);
236309
236732
  await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy));
236310
236733
  const packageScriptChanges = await ensureAiFeaturePackageScripts(workspace);
@@ -236319,7 +236742,7 @@ async function runAddAiFeatureCommand({
236319
236742
  const pascalCase = toPascalCase(aiFeatureSlug);
236320
236743
  await syncAiFeatureRestArtifacts({
236321
236744
  clientFile: `src/ai-features/${aiFeatureSlug}/api-client.ts`,
236322
- outputDir: path59.join("src", "ai-features", aiFeatureSlug),
236745
+ outputDir: path60.join("src", "ai-features", aiFeatureSlug),
236323
236746
  projectDir: workspace.projectDir,
236324
236747
  typesFile: `src/ai-features/${aiFeatureSlug}/api-types.ts`,
236325
236748
  validatorsFile: `src/ai-features/${aiFeatureSlug}/api-validators.ts`,
@@ -236332,7 +236755,7 @@ async function runAddAiFeatureCommand({
236332
236755
  });
236333
236756
  await syncAiFeatureSchemaArtifact({
236334
236757
  aiSchemaFile: `src/ai-features/${aiFeatureSlug}/ai-schemas/feature-result.ai.schema.json`,
236335
- outputDir: path59.join("src", "ai-features", aiFeatureSlug),
236758
+ outputDir: path60.join("src", "ai-features", aiFeatureSlug),
236336
236759
  projectDir: workspace.projectDir
236337
236760
  });
236338
236761
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
@@ -236368,7 +236791,7 @@ var init_cli_add_workspace_ai = __esm(() => {
236368
236791
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace.ts
236369
236792
  import fs45 from "fs";
236370
236793
  import { promises as fsp24 } from "fs";
236371
- import path60 from "path";
236794
+ import path61 from "path";
236372
236795
  function maskSourceSegment(segment) {
236373
236796
  return segment.replace(/[^\n\r]/gu, " ");
236374
236797
  }
@@ -236752,7 +237175,7 @@ ${VARIATIONS_CALL_LINE}
236752
237175
  }
236753
237176
  }
236754
237177
  if (!hasExecutablePattern(nextSource, VARIATIONS_CALL_PATTERN)) {
236755
- throw new Error(`Unable to inject ${VARIATIONS_CALL_LINE} into ${path60.basename(blockIndexPath)}.`);
237178
+ throw new Error(`Unable to inject ${VARIATIONS_CALL_LINE} into ${path61.basename(blockIndexPath)}.`);
236756
237179
  }
236757
237180
  return nextSource;
236758
237181
  });
@@ -236782,7 +237205,7 @@ ${BLOCK_STYLES_CALL_LINE}
236782
237205
  }
236783
237206
  }
236784
237207
  if (!hasExecutablePattern(nextSource, BLOCK_STYLES_CALL_PATTERN)) {
236785
- throw new Error(`Unable to inject ${BLOCK_STYLES_CALL_LINE} into ${path60.basename(blockIndexPath)}.`);
237208
+ throw new Error(`Unable to inject ${BLOCK_STYLES_CALL_LINE} into ${path61.basename(blockIndexPath)}.`);
236786
237209
  }
236787
237210
  return nextSource;
236788
237211
  });
@@ -236799,7 +237222,7 @@ ${nextSource}`;
236799
237222
  SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN
236800
237223
  ]);
236801
237224
  if (!callRange) {
236802
- throw new Error(`Unable to inject ${BLOCK_TRANSFORMS_CALL_LINE} into ${path60.basename(blockIndexPath)} because it does not expose a scaffold registration settings object.`);
237225
+ throw new Error(`Unable to inject ${BLOCK_TRANSFORMS_CALL_LINE} into ${path61.basename(blockIndexPath)} because it does not expose a scaffold registration settings object.`);
236803
237226
  }
236804
237227
  nextSource = [
236805
237228
  nextSource.slice(0, callRange.start),
@@ -236812,42 +237235,42 @@ ${nextSource}`;
236812
237235
  });
236813
237236
  }
236814
237237
  async function writeVariationRegistry(projectDir, blockSlug, variationSlug) {
236815
- const variationsDir = path60.join(projectDir, "src", "blocks", blockSlug, "variations");
236816
- const variationsIndexPath = path60.join(variationsDir, "index.ts");
237238
+ const variationsDir = path61.join(projectDir, "src", "blocks", blockSlug, "variations");
237239
+ const variationsIndexPath = path61.join(variationsDir, "index.ts");
236817
237240
  await fsp24.mkdir(variationsDir, { recursive: true });
236818
237241
  const existingVariationSlugs = fs45.readdirSync(variationsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
236819
237242
  const nextVariationSlugs = Array.from(new Set([...existingVariationSlugs, variationSlug])).sort();
236820
237243
  await fsp24.writeFile(variationsIndexPath, buildVariationIndexSource(nextVariationSlugs), "utf8");
236821
237244
  }
236822
237245
  async function writeBlockStyleRegistry(projectDir, blockSlug, styleSlug) {
236823
- const stylesDir = path60.join(projectDir, "src", "blocks", blockSlug, "styles");
236824
- const stylesIndexPath = path60.join(stylesDir, "index.ts");
237246
+ const stylesDir = path61.join(projectDir, "src", "blocks", blockSlug, "styles");
237247
+ const stylesIndexPath = path61.join(stylesDir, "index.ts");
236825
237248
  await fsp24.mkdir(stylesDir, { recursive: true });
236826
237249
  const existingStyleSlugs = fs45.readdirSync(stylesDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
236827
237250
  const nextStyleSlugs = Array.from(new Set([...existingStyleSlugs, styleSlug])).sort();
236828
237251
  await fsp24.writeFile(stylesIndexPath, buildBlockStyleIndexSource(nextStyleSlugs), "utf8");
236829
237252
  }
236830
237253
  async function writeBlockTransformRegistry(projectDir, blockSlug, transformSlug) {
236831
- const transformsDir = path60.join(projectDir, "src", "blocks", blockSlug, "transforms");
236832
- const transformsIndexPath = path60.join(transformsDir, "index.ts");
237254
+ const transformsDir = path61.join(projectDir, "src", "blocks", blockSlug, "transforms");
237255
+ const transformsIndexPath = path61.join(transformsDir, "index.ts");
236833
237256
  await fsp24.mkdir(transformsDir, { recursive: true });
236834
237257
  const existingTransformSlugs = fs45.readdirSync(transformsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
236835
237258
  const nextTransformSlugs = Array.from(new Set([...existingTransformSlugs, transformSlug])).sort();
236836
237259
  await fsp24.writeFile(transformsIndexPath, buildBlockTransformIndexSource(nextTransformSlugs), "utf8");
236837
237260
  }
236838
237261
  function assertBlockStyleDoesNotExist(projectDir, blockSlug, styleSlug, inventory) {
236839
- const stylePath = path60.join(projectDir, "src", "blocks", blockSlug, "styles", `${styleSlug}.ts`);
237262
+ const stylePath = path61.join(projectDir, "src", "blocks", blockSlug, "styles", `${styleSlug}.ts`);
236840
237263
  if (fs45.existsSync(stylePath)) {
236841
- throw new Error(`A block style already exists at ${path60.relative(projectDir, stylePath)}. Choose a different name.`);
237264
+ throw new Error(`A block style already exists at ${path61.relative(projectDir, stylePath)}. Choose a different name.`);
236842
237265
  }
236843
237266
  if (inventory.blockStyles.some((entry) => entry.block === blockSlug && entry.slug === styleSlug)) {
236844
237267
  throw new Error(`A block style inventory entry already exists for ${blockSlug}/${styleSlug}. Choose a different name.`);
236845
237268
  }
236846
237269
  }
236847
237270
  function assertBlockTransformDoesNotExist(projectDir, blockSlug, transformSlug, inventory) {
236848
- const transformPath = path60.join(projectDir, "src", "blocks", blockSlug, "transforms", `${transformSlug}.ts`);
237271
+ const transformPath = path61.join(projectDir, "src", "blocks", blockSlug, "transforms", `${transformSlug}.ts`);
236849
237272
  if (fs45.existsSync(transformPath)) {
236850
- throw new Error(`A block transform already exists at ${path60.relative(projectDir, transformPath)}. Choose a different name.`);
237273
+ throw new Error(`A block transform already exists at ${path61.relative(projectDir, transformPath)}. Choose a different name.`);
236851
237274
  }
236852
237275
  if (inventory.blockTransforms.some((entry) => entry.block === blockSlug && entry.slug === transformSlug)) {
236853
237276
  throw new Error(`A block transform inventory entry already exists for ${blockSlug}/${transformSlug}. Choose a different name.`);
@@ -236893,11 +237316,11 @@ async function runAddVariationCommand({
236893
237316
  const inventory = readWorkspaceInventory(workspace.projectDir);
236894
237317
  resolveWorkspaceBlock(inventory, blockSlug);
236895
237318
  assertVariationDoesNotExist(workspace.projectDir, blockSlug, variationSlug, inventory);
236896
- const blockConfigPath = path60.join(workspace.projectDir, "scripts", "block-config.ts");
236897
- const blockIndexPath = path60.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
236898
- const variationsDir = path60.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
236899
- const variationFilePath = path60.join(variationsDir, `${variationSlug}.ts`);
236900
- const variationsIndexPath = path60.join(variationsDir, "index.ts");
237319
+ const blockConfigPath = path61.join(workspace.projectDir, "scripts", "block-config.ts");
237320
+ const blockIndexPath = path61.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
237321
+ const variationsDir = path61.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
237322
+ const variationFilePath = path61.join(variationsDir, `${variationSlug}.ts`);
237323
+ const variationsIndexPath = path61.join(variationsDir, "index.ts");
236901
237324
  const shouldRemoveVariationsDirOnRollback = !fs45.existsSync(variationsDir);
236902
237325
  const mutationSnapshot = {
236903
237326
  fileSources: await snapshotWorkspaceFiles([
@@ -236940,11 +237363,11 @@ async function runAddBlockStyleCommand({
236940
237363
  const inventory = readWorkspaceInventory(workspace.projectDir);
236941
237364
  resolveWorkspaceBlock(inventory, blockSlug);
236942
237365
  assertBlockStyleDoesNotExist(workspace.projectDir, blockSlug, styleSlug, inventory);
236943
- const blockConfigPath = path60.join(workspace.projectDir, "scripts", "block-config.ts");
236944
- const blockIndexPath = path60.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
236945
- const stylesDir = path60.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
236946
- const styleFilePath = path60.join(stylesDir, `${styleSlug}.ts`);
236947
- const stylesIndexPath = path60.join(stylesDir, "index.ts");
237366
+ const blockConfigPath = path61.join(workspace.projectDir, "scripts", "block-config.ts");
237367
+ const blockIndexPath = path61.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
237368
+ const stylesDir = path61.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
237369
+ const styleFilePath = path61.join(stylesDir, `${styleSlug}.ts`);
237370
+ const stylesIndexPath = path61.join(stylesDir, "index.ts");
236948
237371
  const shouldRemoveStylesDirOnRollback = !fs45.existsSync(stylesDir);
236949
237372
  const mutationSnapshot = {
236950
237373
  fileSources: await snapshotWorkspaceFiles([
@@ -236989,11 +237412,11 @@ async function runAddBlockTransformCommand({
236989
237412
  const inventory = readWorkspaceInventory(workspace.projectDir);
236990
237413
  resolveWorkspaceBlock(inventory, target.blockSlug);
236991
237414
  assertBlockTransformDoesNotExist(workspace.projectDir, target.blockSlug, transformSlug, inventory);
236992
- const blockConfigPath = path60.join(workspace.projectDir, "scripts", "block-config.ts");
236993
- const blockIndexPath = path60.join(workspace.projectDir, "src", "blocks", target.blockSlug, "index.tsx");
236994
- const transformsDir = path60.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
236995
- const transformFilePath = path60.join(transformsDir, `${transformSlug}.ts`);
236996
- const transformsIndexPath = path60.join(transformsDir, "index.ts");
237415
+ const blockConfigPath = path61.join(workspace.projectDir, "scripts", "block-config.ts");
237416
+ const blockIndexPath = path61.join(workspace.projectDir, "src", "blocks", target.blockSlug, "index.tsx");
237417
+ const transformsDir = path61.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
237418
+ const transformFilePath = path61.join(transformsDir, `${transformSlug}.ts`);
237419
+ const transformsIndexPath = path61.join(transformsDir, "index.ts");
236997
237420
  const shouldRemoveTransformsDirOnRollback = !fs45.existsSync(transformsDir);
236998
237421
  const mutationSnapshot = {
236999
237422
  fileSources: await snapshotWorkspaceFiles([
@@ -237055,7 +237478,7 @@ async function runAddHookedBlockCommand({
237055
237478
  throw new Error("`wp-typia add hooked-block` cannot hook a block relative to its own block name.");
237056
237479
  }
237057
237480
  const { blockJson, blockJsonPath } = readWorkspaceBlockJson(workspace.projectDir, blockSlug);
237058
- const blockJsonRelativePath = path60.relative(workspace.projectDir, blockJsonPath);
237481
+ const blockJsonRelativePath = path61.relative(workspace.projectDir, blockJsonPath);
237059
237482
  const blockHooks = getMutableBlockHooks(blockJson, blockJsonRelativePath);
237060
237483
  if (Object.prototype.hasOwnProperty.call(blockHooks, resolvedAnchorBlockName)) {
237061
237484
  throw new Error(`${blockJsonRelativePath} already defines a blockHooks entry for "${resolvedAnchorBlockName}".`);
@@ -237133,7 +237556,7 @@ import { execFileSync as execFileSync3 } from "child_process";
237133
237556
  import { access, constants as fsConstants, rm as rm2, writeFile as writeFile6 } from "fs/promises";
237134
237557
  import fs46 from "fs";
237135
237558
  import os5 from "os";
237136
- import path61 from "path";
237559
+ import path62 from "path";
237137
237560
  function readCommandVersion(command, args = ["--version"]) {
237138
237561
  try {
237139
237562
  return execFileSync3(command, args, {
@@ -237157,7 +237580,7 @@ async function checkWritableDirectory(directory) {
237157
237580
  }
237158
237581
  }
237159
237582
  async function checkTempDirectory() {
237160
- const tempFile = path61.join(os5.tmpdir(), `wp-typia-${Date.now()}.tmp`);
237583
+ const tempFile = path62.join(os5.tmpdir(), `wp-typia-${Date.now()}.tmp`);
237161
237584
  try {
237162
237585
  await writeFile6(tempFile, "ok", "utf8");
237163
237586
  await rm2(tempFile, { force: true });
@@ -237174,7 +237597,7 @@ function getTemplateDoctorChecks() {
237174
237597
  for (const template of listTemplates()) {
237175
237598
  if (!isBuiltInTemplateId(template.id)) {
237176
237599
  const templateDirExists = fs46.existsSync(template.templateDir);
237177
- const hasAssets2 = templateDirExists && fs46.existsSync(path61.join(template.templateDir, "package.json.mustache"));
237600
+ const hasAssets2 = templateDirExists && fs46.existsSync(path62.join(template.templateDir, "package.json.mustache"));
237178
237601
  checks3.push({
237179
237602
  status: !templateDirExists || hasAssets2 ? "pass" : "fail",
237180
237603
  label: `Template ${template.id}`,
@@ -237199,7 +237622,7 @@ function getTemplateDoctorChecks() {
237199
237622
  ])) : getBuiltInTemplateLayerDirs(builtInTemplateId);
237200
237623
  const missingRequiredLayer = layerDirs.some((layerDir) => !fs46.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
237201
237624
  const existingLayerDirs = layerDirs.filter((layerDir) => fs46.existsSync(layerDir));
237202
- const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs46.existsSync(path61.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs46.existsSync(path61.join(layerDir, "src")));
237625
+ const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs46.existsSync(path62.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs46.existsSync(path62.join(layerDir, "src")));
237203
237626
  checks3.push({
237204
237627
  status: hasAssets ? "pass" : "fail",
237205
237628
  label: `Template ${template.id}`,
@@ -237230,7 +237653,7 @@ var init_cli_doctor_environment = __esm(() => {
237230
237653
 
237231
237654
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace.ts
237232
237655
  import fs47 from "fs";
237233
- import path62 from "path";
237656
+ import path63 from "path";
237234
237657
  import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata2 } from "@wp-typia/block-runtime/blocks";
237235
237658
  function createDoctorCheck2(label, status, detail, code) {
237236
237659
  return code ? { code, detail, label, status } : { detail, label, status };
@@ -237300,7 +237723,7 @@ function hasExecutablePattern2(source, pattern) {
237300
237723
  return pattern.test(maskTypeScriptCommentsAndLiterals2(source));
237301
237724
  }
237302
237725
  function normalizePathSeparators(relativePath) {
237303
- return relativePath.split(path62.sep).join("/");
237726
+ return relativePath.split(path63.sep).join("/");
237304
237727
  }
237305
237728
  function hasRegisteredBlockAsset(value2) {
237306
237729
  if (typeof value2 === "string") {
@@ -237312,8 +237735,8 @@ function hasRegisteredBlockAsset(value2) {
237312
237735
  return false;
237313
237736
  }
237314
237737
  function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
237315
- const blockJsonRelativePath = path62.join("src", "blocks", blockSlug, "block.json");
237316
- const blockJsonPath = path62.join(projectDir, blockJsonRelativePath);
237738
+ const blockJsonRelativePath = path63.join("src", "blocks", blockSlug, "block.json");
237739
+ const blockJsonPath = path63.join(projectDir, blockJsonRelativePath);
237317
237740
  if (!fs47.existsSync(blockJsonPath)) {
237318
237741
  return {
237319
237742
  blockJsonRelativePath,
@@ -237358,14 +237781,14 @@ function isWorkspaceBlockSaveSource(relativePath) {
237358
237781
  return fileName.replace(/\.[^.]+$/u, "").toLowerCase() === "save";
237359
237782
  }
237360
237783
  function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
237361
- const blockDir = path62.join(projectDir, "src", "blocks", blockSlug);
237784
+ const blockDir = path63.join(projectDir, "src", "blocks", blockSlug);
237362
237785
  if (!fs47.existsSync(blockDir)) {
237363
237786
  return [];
237364
237787
  }
237365
237788
  const sources = [];
237366
237789
  const visitDirectory = (directory) => {
237367
237790
  for (const entry of fs47.readdirSync(directory, { withFileTypes: true })) {
237368
- const entryPath = path62.join(directory, entry.name);
237791
+ const entryPath = path63.join(directory, entry.name);
237369
237792
  if (entry.isDirectory()) {
237370
237793
  visitDirectory(entryPath);
237371
237794
  continue;
@@ -237373,8 +237796,8 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
237373
237796
  if (!entry.isFile()) {
237374
237797
  continue;
237375
237798
  }
237376
- const relativePath = normalizePathSeparators(path62.relative(projectDir, entryPath));
237377
- const blockRelativePath = path62.relative(blockDir, entryPath);
237799
+ const relativePath = normalizePathSeparators(path63.relative(projectDir, entryPath));
237800
+ const blockRelativePath = path63.relative(blockDir, entryPath);
237378
237801
  if (!isWorkspaceBlockEditorSource(blockRelativePath)) {
237379
237802
  continue;
237380
237803
  }
@@ -237440,7 +237863,7 @@ function getWorkspaceBootstrapRelativePath(packageName) {
237440
237863
  return `${packageBaseName}.php`;
237441
237864
  }
237442
237865
  function checkExistingFiles(projectDir, label, filePaths) {
237443
- const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs47.existsSync(path62.join(projectDir, filePath)));
237866
+ const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs47.existsSync(path63.join(projectDir, filePath)));
237444
237867
  return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
237445
237868
  }
237446
237869
  function checkWorkspacePackageMetadata(workspace, packageJson) {
@@ -237466,24 +237889,24 @@ function checkWorkspacePackageMetadata(workspace, packageJson) {
237466
237889
  if (wpTypia?.phpPrefix !== workspace.workspace.phpPrefix) {
237467
237890
  issues.push(`wpTypia.phpPrefix must equal "${workspace.workspace.phpPrefix}"`);
237468
237891
  }
237469
- if (!fs47.existsSync(path62.join(workspace.projectDir, bootstrapRelativePath))) {
237892
+ if (!fs47.existsSync(path63.join(workspace.projectDir, bootstrapRelativePath))) {
237470
237893
  issues.push(`Missing bootstrap file ${bootstrapRelativePath}`);
237471
237894
  }
237472
237895
  return createDoctorCheck2("Workspace package metadata", issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `package.json metadata aligns with ${workspace.packageName} and ${bootstrapRelativePath}` : issues.join("; "));
237473
237896
  }
237474
237897
  function getWorkspaceBlockRequiredFiles(block) {
237475
- const blockDir = path62.join("src", "blocks", block.slug);
237898
+ const blockDir = path63.join("src", "blocks", block.slug);
237476
237899
  return Array.from(new Set([
237477
237900
  block.typesFile,
237478
237901
  block.apiTypesFile,
237479
237902
  block.openApiFile,
237480
- path62.join(blockDir, "index.tsx"),
237481
- ...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path62.join(blockDir, fileName))
237903
+ path63.join(blockDir, "index.tsx"),
237904
+ ...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path63.join(blockDir, fileName))
237482
237905
  ].filter((filePath) => typeof filePath === "string")));
237483
237906
  }
237484
237907
  function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
237485
- const blockJsonRelativePath = path62.join("src", "blocks", block.slug, "block.json");
237486
- const blockJsonPath = path62.join(projectDir, blockJsonRelativePath);
237908
+ const blockJsonRelativePath = path63.join("src", "blocks", block.slug, "block.json");
237909
+ const blockJsonPath = path63.join(projectDir, blockJsonRelativePath);
237487
237910
  if (!fs47.existsSync(blockJsonPath)) {
237488
237911
  return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
237489
237912
  }
@@ -237504,8 +237927,8 @@ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
237504
237927
  return createDoctorCheck2(`Block metadata ${block.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `block.json matches ${expectedName} and ${workspace.workspace.textDomain}` : issues.join("; "));
237505
237928
  }
237506
237929
  function checkWorkspaceBlockHooks(projectDir, blockSlug) {
237507
- const blockJsonRelativePath = path62.join("src", "blocks", blockSlug, "block.json");
237508
- const blockJsonPath = path62.join(projectDir, blockJsonRelativePath);
237930
+ const blockJsonRelativePath = path63.join("src", "blocks", blockSlug, "block.json");
237931
+ const blockJsonPath = path63.join(projectDir, blockJsonRelativePath);
237509
237932
  if (!fs47.existsSync(blockJsonPath)) {
237510
237933
  return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
237511
237934
  }
@@ -237527,8 +237950,8 @@ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
237527
237950
  return createDoctorCheck2(`Block hooks ${blockSlug}`, invalidEntries.length === 0 ? "pass" : "fail", invalidEntries.length === 0 ? `blockHooks metadata is valid${Object.keys(blockHooks).length > 0 ? ` (${Object.keys(blockHooks).join(", ")})` : ""}` : `Invalid blockHooks entries: ${invalidEntries.map(([anchor, position]) => `${anchor || "<empty>"} => ${String(position)}`).join(", ")}`);
237528
237951
  }
237529
237952
  function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
237530
- const entryRelativePath = path62.join("src", "blocks", blockSlug, "index.tsx");
237531
- const entryPath = path62.join(projectDir, entryRelativePath);
237953
+ const entryRelativePath = path63.join("src", "blocks", blockSlug, "index.tsx");
237954
+ const entryPath = path63.join(projectDir, entryRelativePath);
237532
237955
  if (!fs47.existsSync(entryPath)) {
237533
237956
  return createDoctorCheck2(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
237534
237957
  }
@@ -237545,8 +237968,8 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
237545
237968
  }
237546
237969
  const blockJson = metadataResult.document;
237547
237970
  const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion) ? blockJson.apiVersion : null;
237548
- const blockDir = path62.join(projectDir, "src", "blocks", blockSlug);
237549
- const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs47.existsSync(path62.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path62.join("src", "blocks", blockSlug, fileName)));
237971
+ const blockDir = path63.join(projectDir, "src", "blocks", blockSlug);
237972
+ const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs47.existsSync(path63.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path63.join("src", "blocks", blockSlug, fileName)));
237550
237973
  const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) || hasRegisteredBlockAsset(blockJson.editorStyle);
237551
237974
  const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
237552
237975
  const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
@@ -237564,9 +237987,9 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
237564
237987
  }
237565
237988
  function checkWorkspacePatternBootstrap(projectDir, packageName) {
237566
237989
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237567
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
237990
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237568
237991
  if (!fs47.existsSync(bootstrapPath)) {
237569
- return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
237992
+ return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237570
237993
  }
237571
237994
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237572
237995
  const hasCategoryAnchor = source.includes("register_block_pattern_category");
@@ -237575,9 +237998,9 @@ function checkWorkspacePatternBootstrap(projectDir, packageName) {
237575
237998
  }
237576
237999
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
237577
238000
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237578
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238001
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237579
238002
  if (!fs47.existsSync(bootstrapPath)) {
237580
- return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238003
+ return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237581
238004
  }
237582
238005
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237583
238006
  const hasServerGlob = source.includes(WORKSPACE_BINDING_SERVER_GLOB);
@@ -237587,11 +238010,11 @@ function checkWorkspaceBindingBootstrap(projectDir, packageName) {
237587
238010
  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");
237588
238011
  }
237589
238012
  function checkWorkspaceBindingSourcesIndex(projectDir, bindingSources) {
237590
- const indexRelativePath = [path62.join("src", "bindings", "index.ts"), path62.join("src", "bindings", "index.js")].find((relativePath) => fs47.existsSync(path62.join(projectDir, relativePath)));
238013
+ const indexRelativePath = [path63.join("src", "bindings", "index.ts"), path63.join("src", "bindings", "index.js")].find((relativePath) => fs47.existsSync(path63.join(projectDir, relativePath)));
237591
238014
  if (!indexRelativePath) {
237592
238015
  return createDoctorCheck2("Binding sources index", "fail", "Missing src/bindings/index.ts or src/bindings/index.js");
237593
238016
  }
237594
- const indexPath = path62.join(projectDir, indexRelativePath);
238017
+ const indexPath = path63.join(projectDir, indexRelativePath);
237595
238018
  const source = fs47.readFileSync(indexPath, "utf8");
237596
238019
  const missingImports = bindingSources.filter((bindingSource) => !source.includes(`./${bindingSource.slug}/editor`));
237597
238020
  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(", ")}`);
@@ -237608,8 +238031,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
237608
238031
  if (!registeredBlockSlugs.has(bindingSource.block)) {
237609
238032
  return createDoctorCheck2(`Binding target ${bindingSource.slug}`, "fail", `Binding target references unknown block "${bindingSource.block}".`);
237610
238033
  }
237611
- const blockJsonRelativePath = path62.join("src", "blocks", bindingSource.block, "block.json");
237612
- const blockJsonPath = path62.join(projectDir, blockJsonRelativePath);
238034
+ const blockJsonRelativePath = path63.join("src", "blocks", bindingSource.block, "block.json");
238035
+ const blockJsonPath = path63.join(projectDir, blockJsonRelativePath);
237613
238036
  const issues = [];
237614
238037
  try {
237615
238038
  const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs47.readFileSync(blockJsonPath, "utf8")));
@@ -237625,7 +238048,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
237625
238048
  } catch (error48) {
237626
238049
  issues.push(error48 instanceof Error ? `Unable to read ${blockJsonRelativePath}: ${error48.message}` : `Unable to read ${blockJsonRelativePath}.`);
237627
238050
  }
237628
- const serverPath = path62.join(projectDir, bindingSource.serverFile);
238051
+ const serverPath = path63.join(projectDir, bindingSource.serverFile);
237629
238052
  if (fs47.existsSync(serverPath)) {
237630
238053
  const serverSource = fs47.readFileSync(serverPath, "utf8");
237631
238054
  const supportedAttributesFilter = `block_bindings_supported_attributes_${workspace.workspace.namespace}/${bindingSource.block}`;
@@ -237638,7 +238061,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
237638
238061
  } else {
237639
238062
  issues.push(`Missing ${bindingSource.serverFile}`);
237640
238063
  }
237641
- const editorPath = path62.join(projectDir, bindingSource.editorFile);
238064
+ const editorPath = path63.join(projectDir, bindingSource.editorFile);
237642
238065
  if (fs47.existsSync(editorPath)) {
237643
238066
  const editorSource = fs47.readFileSync(editorPath, "utf8");
237644
238067
  const blockName = `${workspace.workspace.namespace}/${bindingSource.block}`;
@@ -237686,7 +238109,7 @@ function getWorkspaceRestResourceRequiredFiles(restResource) {
237686
238109
  }
237687
238110
  return Array.from(new Set([
237688
238111
  restResource.apiFile,
237689
- ...Array.from(schemaNames, (schemaName) => path62.join(path62.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
238112
+ ...Array.from(schemaNames, (schemaName) => path63.join(path63.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
237690
238113
  restResource.clientFile,
237691
238114
  restResource.dataFile,
237692
238115
  restResource.openApiFile,
@@ -237702,9 +238125,9 @@ function checkWorkspaceRestResourceConfig(restResource) {
237702
238125
  }
237703
238126
  function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
237704
238127
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237705
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238128
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237706
238129
  if (!fs47.existsSync(bootstrapPath)) {
237707
- return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238130
+ return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237708
238131
  }
237709
238132
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237710
238133
  const registerFunctionName = `${phpPrefix}_register_rest_resources`;
@@ -237725,7 +238148,7 @@ function getWorkspaceAbilityRequiredFiles(ability) {
237725
238148
  ]));
237726
238149
  }
237727
238150
  function checkWorkspaceAbilityConfig(projectDir, ability) {
237728
- const configPath = path62.join(projectDir, ability.configFile);
238151
+ const configPath = path63.join(projectDir, ability.configFile);
237729
238152
  if (!fs47.existsSync(configPath)) {
237730
238153
  return createDoctorCheck2(`Ability config ${ability.slug}`, "fail", `Missing ${ability.configFile}`);
237731
238154
  }
@@ -237742,9 +238165,9 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
237742
238165
  }
237743
238166
  function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
237744
238167
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237745
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238168
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237746
238169
  if (!fs47.existsSync(bootstrapPath)) {
237747
- return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238170
+ return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237748
238171
  }
237749
238172
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237750
238173
  const loadFunctionName = `${phpPrefix}_load_workflow_abilities`;
@@ -237763,13 +238186,13 @@ function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
237763
238186
  }
237764
238187
  function checkWorkspaceAbilityIndex(projectDir, abilities) {
237765
238188
  const indexRelativePath = [
237766
- path62.join("src", "abilities", "index.ts"),
237767
- path62.join("src", "abilities", "index.js")
237768
- ].find((relativePath) => fs47.existsSync(path62.join(projectDir, relativePath)));
238189
+ path63.join("src", "abilities", "index.ts"),
238190
+ path63.join("src", "abilities", "index.js")
238191
+ ].find((relativePath) => fs47.existsSync(path63.join(projectDir, relativePath)));
237769
238192
  if (!indexRelativePath) {
237770
238193
  return createDoctorCheck2("Abilities index", "fail", "Missing src/abilities/index.ts or src/abilities/index.js");
237771
238194
  }
237772
- const indexPath = path62.join(projectDir, indexRelativePath);
238195
+ const indexPath = path63.join(projectDir, indexRelativePath);
237773
238196
  const source = fs47.readFileSync(indexPath, "utf8");
237774
238197
  const missingExports = abilities.filter((ability) => {
237775
238198
  const exportPattern = new RegExp(`^\\s*export\\s+(?:\\*\\s+from|\\{[^}]+\\}\\s+from)\\s+['"\`]\\./${escapeRegex2(ability.slug)}\\/client['"\`]`, "mu");
@@ -237781,9 +238204,9 @@ function getWorkspaceAiFeatureRequiredFiles(aiFeature) {
237781
238204
  return Array.from(new Set([
237782
238205
  aiFeature.aiSchemaFile,
237783
238206
  aiFeature.apiFile,
237784
- path62.join(path62.dirname(aiFeature.typesFile), "api-schemas", "feature-request.schema.json"),
237785
- path62.join(path62.dirname(aiFeature.typesFile), "api-schemas", "feature-response.schema.json"),
237786
- path62.join(path62.dirname(aiFeature.typesFile), "api-schemas", "feature-result.schema.json"),
238207
+ path63.join(path63.dirname(aiFeature.typesFile), "api-schemas", "feature-request.schema.json"),
238208
+ path63.join(path63.dirname(aiFeature.typesFile), "api-schemas", "feature-response.schema.json"),
238209
+ path63.join(path63.dirname(aiFeature.typesFile), "api-schemas", "feature-result.schema.json"),
237787
238210
  aiFeature.clientFile,
237788
238211
  aiFeature.dataFile,
237789
238212
  aiFeature.openApiFile,
@@ -237798,9 +238221,9 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
237798
238221
  }
237799
238222
  function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
237800
238223
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237801
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238224
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237802
238225
  if (!fs47.existsSync(bootstrapPath)) {
237803
- return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238226
+ return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237804
238227
  }
237805
238228
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237806
238229
  const registerFunctionName = `${phpPrefix}_register_ai_features`;
@@ -237810,14 +238233,14 @@ function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
237810
238233
  return createDoctorCheck2("AI feature bootstrap", hasServerGlob && hasRegisterHook ? "pass" : "fail", hasServerGlob && hasRegisterHook ? "AI feature PHP loader hook is present" : "Missing AI feature PHP require glob or init hook");
237811
238234
  }
237812
238235
  function getWorkspaceEditorPluginRequiredFiles(editorPlugin) {
237813
- const editorPluginDir = path62.join("src", "editor-plugins", editorPlugin.slug);
237814
- const surfaceFile = editorPlugin.slot === "PluginSidebar" ? path62.join(editorPluginDir, "Sidebar.tsx") : path62.join(editorPluginDir, "Surface.tsx");
238236
+ const editorPluginDir = path63.join("src", "editor-plugins", editorPlugin.slug);
238237
+ const surfaceFile = editorPlugin.slot === "PluginSidebar" ? path63.join(editorPluginDir, "Sidebar.tsx") : path63.join(editorPluginDir, "Surface.tsx");
237815
238238
  return Array.from(new Set([
237816
238239
  editorPlugin.file,
237817
238240
  surfaceFile,
237818
- path62.join(editorPluginDir, "data.ts"),
237819
- path62.join(editorPluginDir, "types.ts"),
237820
- path62.join(editorPluginDir, "style.scss")
238241
+ path63.join(editorPluginDir, "data.ts"),
238242
+ path63.join(editorPluginDir, "types.ts"),
238243
+ path63.join(editorPluginDir, "style.scss")
237821
238244
  ]));
237822
238245
  }
237823
238246
  function checkWorkspaceEditorPluginConfig(editorPlugin) {
@@ -237827,9 +238250,9 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
237827
238250
  }
237828
238251
  function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
237829
238252
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237830
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238253
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237831
238254
  if (!fs47.existsSync(bootstrapPath)) {
237832
- return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238255
+ return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237833
238256
  }
237834
238257
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237835
238258
  const enqueueFunctionName = `${phpPrefix}_enqueue_editor_plugins_editor`;
@@ -237842,13 +238265,13 @@ function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix)
237842
238265
  }
237843
238266
  function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
237844
238267
  const indexRelativePath = [
237845
- path62.join("src", "editor-plugins", "index.ts"),
237846
- path62.join("src", "editor-plugins", "index.js")
237847
- ].find((relativePath) => fs47.existsSync(path62.join(projectDir, relativePath)));
238268
+ path63.join("src", "editor-plugins", "index.ts"),
238269
+ path63.join("src", "editor-plugins", "index.js")
238270
+ ].find((relativePath) => fs47.existsSync(path63.join(projectDir, relativePath)));
237848
238271
  if (!indexRelativePath) {
237849
238272
  return createDoctorCheck2("Editor plugins index", "fail", "Missing src/editor-plugins/index.ts or src/editor-plugins/index.js");
237850
238273
  }
237851
- const indexPath = path62.join(projectDir, indexRelativePath);
238274
+ const indexPath = path63.join(projectDir, indexRelativePath);
237852
238275
  const source = fs47.readFileSync(indexPath, "utf8");
237853
238276
  const missingImports = editorPlugins.filter((editorPlugin) => {
237854
238277
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(editorPlugin.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
@@ -237857,15 +238280,15 @@ function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
237857
238280
  return createDoctorCheck2("Editor plugins index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Editor plugin registrations are aggregated" : `Missing editor plugin imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
237858
238281
  }
237859
238282
  function getWorkspaceAdminViewRequiredFiles(adminView) {
237860
- const adminViewDir = path62.join("src", "admin-views", adminView.slug);
238283
+ const adminViewDir = path63.join("src", "admin-views", adminView.slug);
237861
238284
  return Array.from(new Set([
237862
238285
  adminView.file,
237863
238286
  adminView.phpFile,
237864
- path62.join(adminViewDir, "Screen.tsx"),
237865
- path62.join(adminViewDir, "config.ts"),
237866
- path62.join(adminViewDir, "data.ts"),
237867
- path62.join(adminViewDir, "style.scss"),
237868
- path62.join(adminViewDir, "types.ts")
238287
+ path63.join(adminViewDir, "Screen.tsx"),
238288
+ path63.join(adminViewDir, "config.ts"),
238289
+ path63.join(adminViewDir, "data.ts"),
238290
+ path63.join(adminViewDir, "style.scss"),
238291
+ path63.join(adminViewDir, "types.ts")
237869
238292
  ]));
237870
238293
  }
237871
238294
  function checkWorkspaceAdminViewConfig(adminView, inventory) {
@@ -237882,9 +238305,9 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
237882
238305
  }
237883
238306
  function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
237884
238307
  const packageBaseName = packageName.split("/").pop() ?? packageName;
237885
- const bootstrapPath = path62.join(projectDir, `${packageBaseName}.php`);
238308
+ const bootstrapPath = path63.join(projectDir, `${packageBaseName}.php`);
237886
238309
  if (!fs47.existsSync(bootstrapPath)) {
237887
- return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path62.basename(bootstrapPath)}`);
238310
+ return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path63.basename(bootstrapPath)}`);
237888
238311
  }
237889
238312
  const source = fs47.readFileSync(bootstrapPath, "utf8");
237890
238313
  const loadFunctionName = `${phpPrefix}_load_admin_views`;
@@ -237895,13 +238318,13 @@ function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
237895
238318
  }
237896
238319
  function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
237897
238320
  const indexRelativePath = [
237898
- path62.join("src", "admin-views", "index.ts"),
237899
- path62.join("src", "admin-views", "index.js")
237900
- ].find((relativePath) => fs47.existsSync(path62.join(projectDir, relativePath)));
238321
+ path63.join("src", "admin-views", "index.ts"),
238322
+ path63.join("src", "admin-views", "index.js")
238323
+ ].find((relativePath) => fs47.existsSync(path63.join(projectDir, relativePath)));
237901
238324
  if (!indexRelativePath) {
237902
238325
  return createDoctorCheck2("Admin views index", "fail", "Missing src/admin-views/index.ts or src/admin-views/index.js");
237903
238326
  }
237904
- const indexPath = path62.join(projectDir, indexRelativePath);
238327
+ const indexPath = path63.join(projectDir, indexRelativePath);
237905
238328
  const source = fs47.readFileSync(indexPath, "utf8");
237906
238329
  const missingImports = adminViews.filter((adminView) => {
237907
238330
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(adminView.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
@@ -237910,7 +238333,7 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
237910
238333
  return createDoctorCheck2("Admin views index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Admin view registrations are aggregated" : `Missing admin view imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
237911
238334
  }
237912
238335
  function checkWorkspaceAdminViewPhp(projectDir, adminView) {
237913
- const phpPath = path62.join(projectDir, adminView.phpFile);
238336
+ const phpPath = path63.join(projectDir, adminView.phpFile);
237914
238337
  if (!fs47.existsSync(phpPath)) {
237915
238338
  return createDoctorCheck2(`Admin view PHP ${adminView.slug}`, "fail", `Missing ${adminView.phpFile}`);
237916
238339
  }
@@ -237924,9 +238347,9 @@ function checkWorkspaceAdminViewPhp(projectDir, adminView) {
237924
238347
  return createDoctorCheck2(`Admin view PHP ${adminView.slug}`, hasAdminMenu && hasAdminEnqueue && hasScript && hasAsset && hasStyle && hasComponentsStyleDependency ? "pass" : "fail", hasAdminMenu && hasAdminEnqueue && hasScript && hasAsset && hasStyle && hasComponentsStyleDependency ? "Admin menu, script, style, and wp-components style dependency are wired" : "Missing admin menu, enqueue hook, build/admin-views asset reference, or wp-components style dependency");
237925
238348
  }
237926
238349
  function checkVariationEntrypoint(projectDir, blockSlug) {
237927
- const entryPath = path62.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
238350
+ const entryPath = path63.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
237928
238351
  if (!fs47.existsSync(entryPath)) {
237929
- return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path62.relative(projectDir, entryPath)}`);
238352
+ return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path63.relative(projectDir, entryPath)}`);
237930
238353
  }
237931
238354
  const source = fs47.readFileSync(entryPath, "utf8");
237932
238355
  const hasImport = hasUncommentedPattern2(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
@@ -237934,9 +238357,9 @@ function checkVariationEntrypoint(projectDir, blockSlug) {
237934
238357
  return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Variations registration hook is present" : "Missing ./variations import or registerWorkspaceVariations() call");
237935
238358
  }
237936
238359
  function checkBlockStyleEntrypoint(projectDir, blockSlug) {
237937
- const entryPath = path62.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
238360
+ const entryPath = path63.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
237938
238361
  if (!fs47.existsSync(entryPath)) {
237939
- return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path62.relative(projectDir, entryPath)}`);
238362
+ return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path63.relative(projectDir, entryPath)}`);
237940
238363
  }
237941
238364
  const source = fs47.readFileSync(entryPath, "utf8");
237942
238365
  const hasImport = hasUncommentedPattern2(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
@@ -237944,9 +238367,9 @@ function checkBlockStyleEntrypoint(projectDir, blockSlug) {
237944
238367
  return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block style registration hook is present" : "Missing ./styles import or registerWorkspaceBlockStyles() call");
237945
238368
  }
237946
238369
  function checkBlockTransformEntrypoint(projectDir, blockSlug) {
237947
- const entryPath = path62.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
238370
+ const entryPath = path63.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
237948
238371
  if (!fs47.existsSync(entryPath)) {
237949
- return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path62.relative(projectDir, entryPath)}`);
238372
+ return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path63.relative(projectDir, entryPath)}`);
237950
238373
  }
237951
238374
  const source = fs47.readFileSync(entryPath, "utf8");
237952
238375
  const hasImport = hasUncommentedPattern2(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
@@ -237966,8 +238389,8 @@ function checkBlockTransformConfig(workspace, transform2) {
237966
238389
  }
237967
238390
  function checkMigrationWorkspaceHint(workspace, packageJson) {
237968
238391
  const hasMigrationScript = typeof packageJson.scripts?.["migration:doctor"] === "string";
237969
- const migrationConfigRelativePath = path62.join("src", "migrations", "config.ts");
237970
- const hasMigrationConfig = fs47.existsSync(path62.join(workspace.projectDir, migrationConfigRelativePath));
238392
+ const migrationConfigRelativePath = path63.join("src", "migrations", "config.ts");
238393
+ const hasMigrationConfig = fs47.existsSync(path63.join(workspace.projectDir, migrationConfigRelativePath));
237971
238394
  if (!hasMigrationScript && !hasMigrationConfig) {
237972
238395
  return null;
237973
238396
  }
@@ -238037,7 +238460,7 @@ function getWorkspaceDoctorChecks(cwd) {
238037
238460
  }
238038
238461
  for (const blockSlug of blockStyleTargetBlocks) {
238039
238462
  checks3.push(checkExistingFiles(workspace.projectDir, `Block style registry ${blockSlug}`, [
238040
- path62.join("src", "blocks", blockSlug, "styles", "index.ts")
238463
+ path63.join("src", "blocks", blockSlug, "styles", "index.ts")
238041
238464
  ]));
238042
238465
  checks3.push(checkBlockStyleEntrypoint(workspace.projectDir, blockSlug));
238043
238466
  }
@@ -238053,11 +238476,11 @@ function getWorkspaceDoctorChecks(cwd) {
238053
238476
  }
238054
238477
  for (const blockSlug of blockTransformTargetBlocks) {
238055
238478
  checks3.push(checkExistingFiles(workspace.projectDir, `Block transform registry ${blockSlug}`, [
238056
- path62.join("src", "blocks", blockSlug, "transforms", "index.ts")
238479
+ path63.join("src", "blocks", blockSlug, "transforms", "index.ts")
238057
238480
  ]));
238058
238481
  checks3.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
238059
238482
  }
238060
- const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs47.existsSync(path62.join(workspace.projectDir, "src", "patterns"));
238483
+ const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs47.existsSync(path63.join(workspace.projectDir, "src", "patterns"));
238061
238484
  if (shouldCheckPatternBootstrap) {
238062
238485
  checks3.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
238063
238486
  }
@@ -238225,13 +238648,13 @@ __export(exports_cli_init, {
238225
238648
  });
238226
238649
  import fs48 from "fs";
238227
238650
  import { promises as fsp25 } from "fs";
238228
- import path63 from "path";
238651
+ import path64 from "path";
238229
238652
  import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
238230
238653
  function normalizeRelativePath2(value2) {
238231
238654
  return value2.replace(/\\/gu, "/");
238232
238655
  }
238233
238656
  function readProjectPackageJson(projectDir) {
238234
- const packageJsonPath = path63.join(projectDir, "package.json");
238657
+ const packageJsonPath = path64.join(projectDir, "package.json");
238235
238658
  if (!fs48.existsSync(packageJsonPath)) {
238236
238659
  return null;
238237
238660
  }
@@ -238247,13 +238670,13 @@ function inferInitPackageManager(projectDir, packageJson) {
238247
238670
  if (packageJson?.packageManager) {
238248
238671
  return parseWorkspacePackageManagerId(packageJson.packageManager);
238249
238672
  }
238250
- if (fs48.existsSync(path63.join(projectDir, "bun.lock")) || fs48.existsSync(path63.join(projectDir, "bun.lockb"))) {
238673
+ if (fs48.existsSync(path64.join(projectDir, "bun.lock")) || fs48.existsSync(path64.join(projectDir, "bun.lockb"))) {
238251
238674
  return "bun";
238252
238675
  }
238253
- if (fs48.existsSync(path63.join(projectDir, "pnpm-lock.yaml"))) {
238676
+ if (fs48.existsSync(path64.join(projectDir, "pnpm-lock.yaml"))) {
238254
238677
  return "pnpm";
238255
238678
  }
238256
- if (fs48.existsSync(path63.join(projectDir, "yarn.lock")) || fs48.existsSync(path63.join(projectDir, ".yarnrc.yml"))) {
238679
+ if (fs48.existsSync(path64.join(projectDir, "yarn.lock")) || fs48.existsSync(path64.join(projectDir, ".yarnrc.yml"))) {
238257
238680
  return "yarn";
238258
238681
  }
238259
238682
  return "npm";
@@ -238337,13 +238760,13 @@ function buildPackageManagerFieldChange(packageJson, packageManager, options = {
238337
238760
  };
238338
238761
  }
238339
238762
  function buildGeneratedArtifactPaths(blockJsonFile, manifestFile) {
238340
- const manifestDir = path63.dirname(manifestFile);
238763
+ const manifestDir = path64.dirname(manifestFile);
238341
238764
  const artifactPaths = [
238342
238765
  blockJsonFile,
238343
238766
  manifestFile,
238344
- path63.join(manifestDir, "typia.schema.json"),
238345
- path63.join(manifestDir, "typia-validator.php"),
238346
- path63.join(manifestDir, "typia.openapi.json")
238767
+ path64.join(manifestDir, "typia.schema.json"),
238768
+ path64.join(manifestDir, "typia-validator.php"),
238769
+ path64.join(manifestDir, "typia.openapi.json")
238347
238770
  ];
238348
238771
  return Array.from(new Set(artifactPaths.map((filePath) => normalizeRelativePath2(filePath))));
238349
238772
  }
@@ -238364,7 +238787,7 @@ function isObjectLikeSourceType(projectDir, typesFile, sourceTypeName) {
238364
238787
  return analyzedTypes[sourceTypeName]?.kind === "object";
238365
238788
  }
238366
238789
  function inferRetrofitAttributeTypeName(projectDir, block) {
238367
- const typesPath = path63.join(projectDir, block.typesFile);
238790
+ const typesPath = path64.join(projectDir, block.typesFile);
238368
238791
  const typesSource = fs48.readFileSync(typesPath, "utf8");
238369
238792
  const blockNameSegments = block.blockName.split("/");
238370
238793
  const slug = blockNameSegments[blockNameSegments.length - 1] ?? block.key;
@@ -238670,10 +239093,10 @@ function hasExistingWpTypiaProjectSurface(projectDir, packageJson) {
238670
239093
  const scripts = packageJson?.scripts ?? {};
238671
239094
  const hasSyncSurface = typeof scripts.sync === "string" || typeof scripts["sync-types"] === "string";
238672
239095
  const hasHelperFiles = [
238673
- path63.join("scripts", "block-config.ts"),
238674
- path63.join("scripts", "sync-project.ts"),
238675
- path63.join("scripts", "sync-types-to-block-json.ts")
238676
- ].every((relativePath) => fs48.existsSync(path63.join(projectDir, relativePath)));
239096
+ path64.join("scripts", "block-config.ts"),
239097
+ path64.join("scripts", "sync-project.ts"),
239098
+ path64.join("scripts", "sync-types-to-block-json.ts")
239099
+ ].every((relativePath) => fs48.existsSync(path64.join(projectDir, relativePath)));
238677
239100
  const hasRuntimeDeps = typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-runtime") === "string" && typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-types") === "string";
238678
239101
  return hasSyncSurface && hasHelperFiles && hasRuntimeDeps;
238679
239102
  }
@@ -238683,17 +239106,17 @@ function buildPlannedFiles(projectDir, layoutKind) {
238683
239106
  }
238684
239107
  return [
238685
239108
  {
238686
- action: fs48.existsSync(path63.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
239109
+ action: fs48.existsSync(path64.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
238687
239110
  path: "scripts/block-config.ts",
238688
239111
  purpose: "Declare the current retrofit block targets so sync-types can regenerate metadata from the existing TypeScript source of truth."
238689
239112
  },
238690
239113
  {
238691
- action: fs48.existsSync(path63.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
239114
+ action: fs48.existsSync(path64.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
238692
239115
  path: "scripts/sync-types-to-block-json.ts",
238693
239116
  purpose: "Generate block.json and Typia metadata artifacts from the current TypeScript source of truth."
238694
239117
  },
238695
239118
  {
238696
- action: fs48.existsSync(path63.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
239119
+ action: fs48.existsSync(path64.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
238697
239120
  path: "scripts/sync-project.ts",
238698
239121
  purpose: "Provide one shared sync entrypoint that can grow into sync-rest or workspace-aware refresh steps later."
238699
239122
  }
@@ -238841,13 +239264,13 @@ function buildProjectPackageJsonSource(packageJson) {
238841
239264
  }
238842
239265
  function buildRetrofitHelperFiles(blockTargets) {
238843
239266
  return {
238844
- [path63.join("scripts", "block-config.ts")]: buildRetrofitBlockConfigSource(blockTargets),
238845
- [path63.join("scripts", "sync-project.ts")]: buildRetrofitSyncProjectScriptSource(),
238846
- [path63.join("scripts", "sync-types-to-block-json.ts")]: buildRetrofitSyncTypesScriptSource()
239267
+ [path64.join("scripts", "block-config.ts")]: buildRetrofitBlockConfigSource(blockTargets),
239268
+ [path64.join("scripts", "sync-project.ts")]: buildRetrofitSyncProjectScriptSource(),
239269
+ [path64.join("scripts", "sync-types-to-block-json.ts")]: buildRetrofitSyncTypesScriptSource()
238847
239270
  };
238848
239271
  }
238849
239272
  async function createRetrofitMutationSnapshot(projectDir, filePaths) {
238850
- const scriptsDir = path63.join(projectDir, "scripts");
239273
+ const scriptsDir = path64.join(projectDir, "scripts");
238851
239274
  const scriptsDirExisted = fs48.existsSync(scriptsDir);
238852
239275
  const fileSources = await snapshotWorkspaceFiles(filePaths);
238853
239276
  const targetPaths = fileSources.filter((entry) => entry.source === null).map((entry) => entry.filePath);
@@ -238862,11 +239285,11 @@ async function createRetrofitMutationSnapshot(projectDir, filePaths) {
238862
239285
  }
238863
239286
  async function writeRetrofitFiles(options) {
238864
239287
  const helperFiles = buildRetrofitHelperFiles(options.blockTargets);
238865
- const scriptsDir = path63.join(options.projectDir, "scripts");
239288
+ const scriptsDir = path64.join(options.projectDir, "scripts");
238866
239289
  await fsp25.mkdir(scriptsDir, { recursive: true });
238867
- await fsp25.writeFile(path63.join(options.projectDir, "package.json"), buildProjectPackageJsonSource(options.packageJson), "utf8");
239290
+ await fsp25.writeFile(path64.join(options.projectDir, "package.json"), buildProjectPackageJsonSource(options.packageJson), "utf8");
238868
239291
  for (const [relativePath, source] of Object.entries(helperFiles)) {
238869
- await fsp25.writeFile(path63.join(options.projectDir, relativePath), source, "utf8");
239292
+ await fsp25.writeFile(path64.join(options.projectDir, relativePath), source, "utf8");
238870
239293
  }
238871
239294
  }
238872
239295
  function buildApplyFailureError(error48) {
@@ -238874,7 +239297,7 @@ function buildApplyFailureError(error48) {
238874
239297
  return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unable to apply the retrofit init plan safely. The command restored the previous package.json/helper-file snapshot. ${message}`, error48 instanceof Error ? { cause: error48 } : undefined);
238875
239298
  }
238876
239299
  function getInitPlan(projectDir, options = {}) {
238877
- const resolvedProjectDir = path63.resolve(projectDir);
239300
+ const resolvedProjectDir = path64.resolve(projectDir);
238878
239301
  const packageJson = readProjectPackageJson(resolvedProjectDir);
238879
239302
  const packageManager = resolveInitPackageManager(resolvedProjectDir, packageJson, options.packageManager);
238880
239303
  const workspace = tryResolveWorkspaceProject(resolvedProjectDir);
@@ -238910,7 +239333,7 @@ function getInitPlan(projectDir, options = {}) {
238910
239333
  status: "already-initialized"
238911
239334
  });
238912
239335
  }
238913
- const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : path63.basename(resolvedProjectDir);
239336
+ const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : path64.basename(resolvedProjectDir);
238914
239337
  const layout = buildLayoutDetails(resolvedProjectDir);
238915
239338
  const dependencyChanges = buildDependencyChanges(packageJson);
238916
239339
  const scriptChanges = buildScriptChanges(packageJson, packageManager);
@@ -238976,8 +239399,8 @@ async function applyInitPlan(projectDir, options = {}) {
238976
239399
  });
238977
239400
  const helperFiles = buildRetrofitHelperFiles(previewPlan.blockTargets);
238978
239401
  const filePaths = [
238979
- path63.join(previewPlan.projectDir, "package.json"),
238980
- ...Object.keys(helperFiles).map((relativePath) => path63.join(previewPlan.projectDir, relativePath))
239402
+ path64.join(previewPlan.projectDir, "package.json"),
239403
+ ...Object.keys(helperFiles).map((relativePath) => path64.join(previewPlan.projectDir, relativePath))
238981
239404
  ];
238982
239405
  const mutationSnapshot = await createRetrofitMutationSnapshot(previewPlan.projectDir, filePaths);
238983
239406
  try {
@@ -239041,18 +239464,18 @@ __export(exports_cli_scaffold, {
239041
239464
  });
239042
239465
  import fs49 from "fs";
239043
239466
  import { promises as fsp26 } from "fs";
239044
- import path64 from "path";
239467
+ import path65 from "path";
239045
239468
  async function listRelativeProjectFiles(rootDir) {
239046
239469
  const relativeFiles = [];
239047
239470
  async function visit2(currentDir) {
239048
239471
  const entries = await fsp26.readdir(currentDir, { withFileTypes: true });
239049
239472
  for (const entry of entries) {
239050
- const absolutePath = path64.join(currentDir, entry.name);
239473
+ const absolutePath = path65.join(currentDir, entry.name);
239051
239474
  if (entry.isDirectory()) {
239052
239475
  await visit2(absolutePath);
239053
239476
  continue;
239054
239477
  }
239055
- relativeFiles.push(path64.relative(rootDir, absolutePath).replace(path64.sep === "\\" ? /\\/gu : /\//gu, "/"));
239478
+ relativeFiles.push(path65.relative(rootDir, absolutePath).replace(path65.sep === "\\" ? /\\/gu : /\//gu, "/"));
239056
239479
  }
239057
239480
  }
239058
239481
  await visit2(rootDir);
@@ -239090,7 +239513,7 @@ async function buildScaffoldDryRunPlan({
239090
239513
  }) {
239091
239514
  await assertDryRunTargetDirectoryReady(projectDir, allowExistingDir);
239092
239515
  const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-scaffold-plan-");
239093
- const previewProjectDir = path64.join(tempRoot, "preview-project");
239516
+ const previewProjectDir = path65.join(tempRoot, "preview-project");
239094
239517
  try {
239095
239518
  const result = await scaffoldProject({
239096
239519
  allowExistingDir: false,
@@ -239130,14 +239553,14 @@ function validateCreateProjectInput(projectInput) {
239130
239553
  if (normalizedProjectInput.length === 0) {
239131
239554
  throw new Error("Project directory is required. Usage: wp-typia create <project-dir> (or wp-typia <project-dir> when <project-dir> is the only positional argument).");
239132
239555
  }
239133
- const normalizedProjectPath = path64.normalize(normalizedProjectInput).replace(/[\\/]+$/u, "") || path64.normalize(normalizedProjectInput);
239556
+ const normalizedProjectPath = path65.normalize(normalizedProjectInput).replace(/[\\/]+$/u, "") || path65.normalize(normalizedProjectInput);
239134
239557
  if (normalizedProjectPath === "." || normalizedProjectPath === "..") {
239135
239558
  throw new Error("`wp-typia create` requires a new project directory. Use an explicit child directory instead of `.` or `..`.");
239136
239559
  }
239137
239560
  }
239138
239561
  function collectProjectDirectoryWarnings(projectDir) {
239139
239562
  const warnings = [];
239140
- const projectName = path64.basename(projectDir);
239563
+ const projectName = path65.basename(projectDir);
239141
239564
  if (/\s/u.test(projectName)) {
239142
239565
  warnings.push(`Project directory "${projectName}" contains spaces. The generated next-step commands will be quoted, but a simple kebab-case directory name is usually easier to use with shells and downstream tooling.`);
239143
239566
  }
@@ -239292,7 +239715,7 @@ function getNextSteps({
239292
239715
  noInstall,
239293
239716
  templateId
239294
239717
  }) {
239295
- const cdTarget = path64.isAbsolute(projectInput) ? projectDir : projectInput;
239718
+ const cdTarget = path65.isAbsolute(projectInput) ? projectDir : projectInput;
239296
239719
  const steps = [`cd ${quoteShellValue(cdTarget)}`];
239297
239720
  if (noInstall) {
239298
239721
  steps.push(formatInstallCommand(packageManager));
@@ -239440,8 +239863,8 @@ async function runScaffoldFlow({
239440
239863
  select: selectWithMigrationUi,
239441
239864
  yes
239442
239865
  });
239443
- const projectDir = path64.resolve(cwd, projectInput);
239444
- const projectName = path64.basename(projectDir);
239866
+ const projectDir = path65.resolve(cwd, projectInput);
239867
+ const projectName = path65.basename(projectDir);
239445
239868
  const answers = await collectScaffoldAnswers({
239446
239869
  dataStorageMode: resolvedDataStorage,
239447
239870
  namespace,
@@ -239504,7 +239927,7 @@ async function runScaffoldFlow({
239504
239927
  let availableScripts;
239505
239928
  if (!dryRun) {
239506
239929
  try {
239507
- const parsedPackageJson = JSON.parse(fs49.readFileSync(path64.join(projectDir, "package.json"), "utf8"));
239930
+ const parsedPackageJson = JSON.parse(fs49.readFileSync(path65.join(projectDir, "package.json"), "utf8"));
239508
239931
  const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
239509
239932
  availableScripts = Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
239510
239933
  } catch {
@@ -292421,6 +292844,12 @@ var MIGRATE_OPTION_METADATA = {
292421
292844
  type: "string"
292422
292845
  }
292423
292846
  };
292847
+ var MCP_OPTION_METADATA = {
292848
+ "output-dir": {
292849
+ description: "Output directory for generated MCP metadata.",
292850
+ type: "string"
292851
+ }
292852
+ };
292424
292853
  var SYNC_OPTION_METADATA = {
292425
292854
  check: {
292426
292855
  argumentKind: "flag",
@@ -292458,10 +292887,6 @@ var GLOBAL_OPTION_METADATA = {
292458
292887
  id: {
292459
292888
  description: "Template id for top-level `templates inspect` convenience.",
292460
292889
  type: "string"
292461
- },
292462
- "output-dir": {
292463
- description: "Output directory for generated MCP metadata.",
292464
- type: "string"
292465
292890
  }
292466
292891
  };
292467
292892
  var COMMAND_OPTION_METADATA_BY_GROUP = {
@@ -292471,6 +292896,7 @@ var COMMAND_OPTION_METADATA_BY_GROUP = {
292471
292896
  global: GLOBAL_OPTION_METADATA,
292472
292897
  init: INIT_OPTION_METADATA,
292473
292898
  migrate: MIGRATE_OPTION_METADATA,
292899
+ mcp: MCP_OPTION_METADATA,
292474
292900
  sync: SYNC_OPTION_METADATA,
292475
292901
  templates: TEMPLATES_OPTION_METADATA
292476
292902
  };
@@ -292547,13 +292973,17 @@ function resolveCommandOptionValues(metadata2, options) {
292547
292973
 
292548
292974
  // src/cli-diagnostic-output.ts
292549
292975
  init_cli_diagnostics();
292976
+ function writeStructuredCliJsonToStderr(payload) {
292977
+ process.stderr.write(`${JSON.stringify(payload, null, 2)}
292978
+ `);
292979
+ }
292550
292980
  function prefersStructuredCliOutput(args) {
292551
292981
  return args.formatExplicit && args.format !== "toon" || Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
292552
292982
  }
292553
292983
  function emitCliDiagnosticFailure(args, options) {
292554
292984
  const diagnostic = createCliCommandError(options);
292555
292985
  if (prefersStructuredCliOutput(args)) {
292556
- args.output({
292986
+ writeStructuredCliJsonToStderr({
292557
292987
  ...options.extraOutput ?? {},
292558
292988
  error: serializeCliDiagnosticError(diagnostic),
292559
292989
  ok: false
@@ -292603,6 +293033,24 @@ init_cli_diagnostics();
292603
293033
 
292604
293034
  // src/add-kind-registry.ts
292605
293035
  init_cli_diagnostics();
293036
+
293037
+ // src/add-kind-ids.ts
293038
+ var ADD_KIND_IDS = [
293039
+ "admin-view",
293040
+ "block",
293041
+ "variation",
293042
+ "style",
293043
+ "transform",
293044
+ "pattern",
293045
+ "binding-source",
293046
+ "rest-resource",
293047
+ "ability",
293048
+ "ai-feature",
293049
+ "hooked-block",
293050
+ "editor-plugin"
293051
+ ];
293052
+
293053
+ // src/add-kind-registry.ts
292606
293054
  var BLOCK_VISIBLE_FIELD_ORDER = [
292607
293055
  "kind",
292608
293056
  "name",
@@ -292612,6 +293060,54 @@ var BLOCK_VISIBLE_FIELD_ORDER = [
292612
293060
  "data-storage",
292613
293061
  "persistence-policy"
292614
293062
  ];
293063
+ var NAME_ONLY_VISIBLE_FIELDS = [
293064
+ "kind",
293065
+ "name"
293066
+ ];
293067
+ var NAME_SOURCE_VISIBLE_FIELDS = [
293068
+ "kind",
293069
+ "name",
293070
+ "source"
293071
+ ];
293072
+ var NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS = [
293073
+ "kind",
293074
+ "name",
293075
+ "block",
293076
+ "attribute"
293077
+ ];
293078
+ var NAME_BLOCK_VISIBLE_FIELDS = [
293079
+ "kind",
293080
+ "name",
293081
+ "block"
293082
+ ];
293083
+ var NAME_SLOT_VISIBLE_FIELDS = [
293084
+ "kind",
293085
+ "name",
293086
+ "slot"
293087
+ ];
293088
+ var NAME_ANCHOR_POSITION_VISIBLE_FIELDS = [
293089
+ "kind",
293090
+ "name",
293091
+ "anchor",
293092
+ "position"
293093
+ ];
293094
+ var NAME_FROM_TO_VISIBLE_FIELDS = [
293095
+ "kind",
293096
+ "name",
293097
+ "from",
293098
+ "to"
293099
+ ];
293100
+ var NAME_NAMESPACE_METHODS_VISIBLE_FIELDS = [
293101
+ "kind",
293102
+ "name",
293103
+ "namespace",
293104
+ "methods"
293105
+ ];
293106
+ var NAME_NAMESPACE_VISIBLE_FIELDS = [
293107
+ "kind",
293108
+ "name",
293109
+ "namespace"
293110
+ ];
292615
293111
  function readOptionalStringFlag(flags2, name2) {
292616
293112
  const value2 = flags2[name2];
292617
293113
  if (value2 === undefined || value2 === null) {
@@ -292622,6 +293118,21 @@ function readOptionalStringFlag(flags2, name2) {
292622
293118
  }
292623
293119
  return value2;
292624
293120
  }
293121
+ function requireStringFlag(flags2, name2, message) {
293122
+ const value2 = readOptionalStringFlag(flags2, name2);
293123
+ if (!value2) {
293124
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
293125
+ }
293126
+ return value2;
293127
+ }
293128
+ function readOptionalPairedStringFlags(flags2, leftName, rightName, message) {
293129
+ const leftValue = readOptionalStringFlag(flags2, leftName);
293130
+ const rightValue = readOptionalStringFlag(flags2, rightName);
293131
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
293132
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
293133
+ }
293134
+ return [leftValue, rightValue];
293135
+ }
292625
293136
  function requireAddKindName(context, message) {
292626
293137
  if (!context.name) {
292627
293138
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
@@ -292645,6 +293156,15 @@ function toExternalLayerPromptOptions(options) {
292645
293156
  function defineAddKindRegistryEntry(entry) {
292646
293157
  return entry;
292647
293158
  }
293159
+ function createNamedExecutionPlan(context, options) {
293160
+ const name2 = options.name ?? requireAddKindName(context, options.missingNameMessage);
293161
+ return {
293162
+ execute: (cwd) => options.execute({ cwd, name: name2 }),
293163
+ getValues: options.getValues,
293164
+ ...options.getWarnings ? { getWarnings: options.getWarnings } : {},
293165
+ ...options.warnLine ? { warnLine: options.warnLine } : {}
293166
+ };
293167
+ }
292648
293168
  function isAddPersistenceTemplate(template) {
292649
293169
  return template === "persistence" || template === "compound";
292650
293170
  }
@@ -292667,22 +293187,24 @@ var ADD_KIND_REGISTRY = {
292667
293187
  async prepareExecution(context) {
292668
293188
  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>].");
292669
293189
  const source = readOptionalStringFlag(context.flags, "source");
292670
- return {
292671
- execute: (cwd) => context.addRuntime.runAddAdminViewCommand({
292672
- adminViewName: name2,
293190
+ return createNamedExecutionPlan(context, {
293191
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAdminViewCommand({
293192
+ adminViewName: name3,
292673
293193
  cwd,
292674
293194
  source
292675
293195
  }),
292676
293196
  getValues: (result) => ({
292677
293197
  adminViewSlug: result.adminViewSlug,
292678
293198
  ...result.source ? { source: result.source } : {}
292679
- })
292680
- };
293199
+ }),
293200
+ missingNameMessage: "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].",
293201
+ name: name2
293202
+ });
292681
293203
  },
292682
293204
  sortOrder: 10,
292683
293205
  supportsDryRun: true,
292684
293206
  usage: "wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]",
292685
- visibleFieldNames: () => ["kind", "name", "source"]
293207
+ visibleFieldNames: () => NAME_SOURCE_VISIBLE_FIELDS
292686
293208
  }),
292687
293209
  "binding-source": defineAddKindRegistryEntry({
292688
293210
  completion: {
@@ -292704,15 +293226,11 @@ var ADD_KIND_REGISTRY = {
292704
293226
  nameLabel: "Binding source name",
292705
293227
  async prepareExecution(context) {
292706
293228
  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>].");
292707
- const blockName = readOptionalStringFlag(context.flags, "block");
292708
- const attributeName = readOptionalStringFlag(context.flags, "attribute");
292709
- if (Boolean(blockName) !== Boolean(attributeName)) {
292710
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
292711
- }
292712
- return {
292713
- execute: (cwd) => context.addRuntime.runAddBindingSourceCommand({
293229
+ const [blockName, attributeName] = readOptionalPairedStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
293230
+ return createNamedExecutionPlan(context, {
293231
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBindingSourceCommand({
292714
293232
  attributeName,
292715
- bindingSourceName: name2,
293233
+ bindingSourceName: name3,
292716
293234
  blockName,
292717
293235
  cwd
292718
293236
  }),
@@ -292720,13 +293238,15 @@ var ADD_KIND_REGISTRY = {
292720
293238
  ...result.attributeName ? { attributeName: result.attributeName } : {},
292721
293239
  ...result.blockSlug ? { blockSlug: result.blockSlug } : {},
292722
293240
  bindingSourceSlug: result.bindingSourceSlug
292723
- })
292724
- };
293241
+ }),
293242
+ missingNameMessage: "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].",
293243
+ name: name2
293244
+ });
292725
293245
  },
292726
293246
  sortOrder: 70,
292727
293247
  supportsDryRun: true,
292728
293248
  usage: "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]",
292729
- visibleFieldNames: () => ["kind", "name", "block", "attribute"]
293249
+ visibleFieldNames: () => NAME_BLOCK_ATTRIBUTE_VISIBLE_FIELDS
292730
293250
  }),
292731
293251
  block: defineAddKindRegistryEntry({
292732
293252
  completion: {
@@ -292764,10 +293284,10 @@ var ADD_KIND_REGISTRY = {
292764
293284
  })), 1);
292765
293285
  }
292766
293286
  resolvedTemplateId ??= "basic";
292767
- return {
292768
- execute: (cwd) => context.addRuntime.runAddBlockCommand({
293287
+ return createNamedExecutionPlan(context, {
293288
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockCommand({
292769
293289
  alternateRenderTargets,
292770
- blockName: name2,
293290
+ blockName: name3,
292771
293291
  cwd,
292772
293292
  dataStorageMode,
292773
293293
  externalLayerId,
@@ -292782,8 +293302,10 @@ var ADD_KIND_REGISTRY = {
292782
293302
  templateId: result.templateId
292783
293303
  }),
292784
293304
  getWarnings: (result) => result.warnings,
293305
+ missingNameMessage: "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]",
293306
+ name: name2,
292785
293307
  warnLine: context.warnLine
292786
- };
293308
+ });
292787
293309
  },
292788
293310
  sortOrder: 20,
292789
293311
  supportsDryRun: true,
@@ -292816,21 +293338,21 @@ var ADD_KIND_REGISTRY = {
292816
293338
  description: "Add a typed server/client workflow ability scaffold",
292817
293339
  nameLabel: "Ability name",
292818
293340
  async prepareExecution(context) {
292819
- const name2 = requireAddKindName(context, "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>.");
292820
- return {
292821
- execute: (cwd) => context.addRuntime.runAddAbilityCommand({
293341
+ return createNamedExecutionPlan(context, {
293342
+ execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAbilityCommand({
292822
293343
  abilityName: name2,
292823
293344
  cwd
292824
293345
  }),
292825
293346
  getValues: (result) => ({
292826
293347
  abilitySlug: result.abilitySlug
292827
- })
292828
- };
293348
+ }),
293349
+ missingNameMessage: "`wp-typia add ability` requires <name>. Usage: wp-typia add ability <name>."
293350
+ });
292829
293351
  },
292830
293352
  sortOrder: 90,
292831
293353
  supportsDryRun: true,
292832
293354
  usage: "wp-typia add ability <name> [--dry-run]",
292833
- visibleFieldNames: () => ["kind", "name"]
293355
+ visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
292834
293356
  }),
292835
293357
  "editor-plugin": defineAddKindRegistryEntry({
292836
293358
  completion: {
@@ -292850,22 +293372,24 @@ var ADD_KIND_REGISTRY = {
292850
293372
  async prepareExecution(context) {
292851
293373
  const name2 = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
292852
293374
  const slot = readOptionalStringFlag(context.flags, "slot");
292853
- return {
292854
- execute: (cwd) => context.addRuntime.runAddEditorPluginCommand({
293375
+ return createNamedExecutionPlan(context, {
293376
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddEditorPluginCommand({
292855
293377
  cwd,
292856
- editorPluginName: name2,
293378
+ editorPluginName: name3,
292857
293379
  slot
292858
293380
  }),
292859
293381
  getValues: (result) => ({
292860
293382
  editorPluginSlug: result.editorPluginSlug,
292861
293383
  slot: result.slot
292862
- })
292863
- };
293384
+ }),
293385
+ missingNameMessage: "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].",
293386
+ name: name2
293387
+ });
292864
293388
  },
292865
293389
  sortOrder: 120,
292866
293390
  supportsDryRun: true,
292867
293391
  usage: "wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>] [--dry-run]",
292868
- visibleFieldNames: () => ["kind", "name", "slot"]
293392
+ visibleFieldNames: () => NAME_SLOT_VISIBLE_FIELDS
292869
293393
  }),
292870
293394
  "hooked-block": defineAddKindRegistryEntry({
292871
293395
  completion: {
@@ -292885,18 +293409,12 @@ var ADD_KIND_REGISTRY = {
292885
293409
  nameLabel: "Target block",
292886
293410
  async prepareExecution(context) {
292887
293411
  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>.");
292888
- const anchorBlockName = readOptionalStringFlag(context.flags, "anchor");
292889
- if (!anchorBlockName) {
292890
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
292891
- }
292892
- const position = readOptionalStringFlag(context.flags, "position");
292893
- if (!position) {
292894
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
292895
- }
292896
- return {
292897
- execute: (cwd) => context.addRuntime.runAddHookedBlockCommand({
293412
+ const anchorBlockName = requireStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
293413
+ const position = requireStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
293414
+ return createNamedExecutionPlan(context, {
293415
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddHookedBlockCommand({
292898
293416
  anchorBlockName,
292899
- blockName: name2,
293417
+ blockName: name3,
292900
293418
  cwd,
292901
293419
  position
292902
293420
  }),
@@ -292904,13 +293422,15 @@ var ADD_KIND_REGISTRY = {
292904
293422
  anchorBlockName: result.anchorBlockName,
292905
293423
  blockSlug: result.blockSlug,
292906
293424
  position: result.position
292907
- })
292908
- };
293425
+ }),
293426
+ 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>.",
293427
+ name: name2
293428
+ });
292909
293429
  },
292910
293430
  sortOrder: 110,
292911
293431
  supportsDryRun: true,
292912
293432
  usage: "wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild> [--dry-run]",
292913
- visibleFieldNames: () => ["kind", "name", "anchor", "position"]
293433
+ visibleFieldNames: () => NAME_ANCHOR_POSITION_VISIBLE_FIELDS
292914
293434
  }),
292915
293435
  pattern: defineAddKindRegistryEntry({
292916
293436
  completion: {
@@ -292927,21 +293447,21 @@ var ADD_KIND_REGISTRY = {
292927
293447
  description: "Add a PHP block pattern shell",
292928
293448
  nameLabel: "Pattern name",
292929
293449
  async prepareExecution(context) {
292930
- const name2 = requireAddKindName(context, "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>.");
292931
- return {
292932
- execute: (cwd) => context.addRuntime.runAddPatternCommand({
293450
+ return createNamedExecutionPlan(context, {
293451
+ execute: ({ cwd, name: name2 }) => context.addRuntime.runAddPatternCommand({
292933
293452
  cwd,
292934
293453
  patternName: name2
292935
293454
  }),
292936
293455
  getValues: (result) => ({
292937
293456
  patternSlug: result.patternSlug
292938
- })
292939
- };
293457
+ }),
293458
+ missingNameMessage: "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>."
293459
+ });
292940
293460
  },
292941
293461
  sortOrder: 60,
292942
293462
  supportsDryRun: true,
292943
293463
  usage: "wp-typia add pattern <name> [--dry-run]",
292944
- visibleFieldNames: () => ["kind", "name"]
293464
+ visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
292945
293465
  }),
292946
293466
  style: defineAddKindRegistryEntry({
292947
293467
  completion: {
@@ -292960,26 +293480,25 @@ var ADD_KIND_REGISTRY = {
292960
293480
  nameLabel: "Style name",
292961
293481
  async prepareExecution(context) {
292962
293482
  const name2 = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
292963
- const blockSlug = readOptionalStringFlag(context.flags, "block");
292964
- if (!blockSlug) {
292965
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add style` requires --block <block-slug>.");
292966
- }
292967
- return {
292968
- execute: (cwd) => context.addRuntime.runAddBlockStyleCommand({
293483
+ const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
293484
+ return createNamedExecutionPlan(context, {
293485
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockStyleCommand({
292969
293486
  blockName: blockSlug,
292970
293487
  cwd,
292971
- styleName: name2
293488
+ styleName: name3
292972
293489
  }),
292973
293490
  getValues: (result) => ({
292974
293491
  blockSlug: result.blockSlug,
292975
293492
  styleSlug: result.styleSlug
292976
- })
292977
- };
293493
+ }),
293494
+ missingNameMessage: "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.",
293495
+ name: name2
293496
+ });
292978
293497
  },
292979
293498
  sortOrder: 40,
292980
293499
  supportsDryRun: true,
292981
293500
  usage: "wp-typia add style <name> --block <block-slug> [--dry-run]",
292982
- visibleFieldNames: () => ["kind", "name", "block"]
293501
+ visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
292983
293502
  }),
292984
293503
  transform: defineAddKindRegistryEntry({
292985
293504
  completion: {
@@ -292999,33 +293518,29 @@ var ADD_KIND_REGISTRY = {
292999
293518
  nameLabel: "Transform name",
293000
293519
  async prepareExecution(context) {
293001
293520
  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>.");
293002
- const fromBlockName = readOptionalStringFlag(context.flags, "from");
293003
- if (!fromBlockName) {
293004
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add transform` requires --from <namespace/block>.");
293005
- }
293006
- const toBlockName = readOptionalStringFlag(context.flags, "to");
293007
- if (!toBlockName) {
293008
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
293009
- }
293010
- return {
293011
- execute: (cwd) => context.addRuntime.runAddBlockTransformCommand({
293521
+ const fromBlockName = requireStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
293522
+ const toBlockName = requireStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
293523
+ return createNamedExecutionPlan(context, {
293524
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddBlockTransformCommand({
293012
293525
  cwd,
293013
293526
  fromBlockName,
293014
293527
  toBlockName,
293015
- transformName: name2
293528
+ transformName: name3
293016
293529
  }),
293017
293530
  getValues: (result) => ({
293018
293531
  blockSlug: result.blockSlug,
293019
293532
  fromBlockName: result.fromBlockName,
293020
293533
  toBlockName: result.toBlockName,
293021
293534
  transformSlug: result.transformSlug
293022
- })
293023
- };
293535
+ }),
293536
+ missingNameMessage: "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.",
293537
+ name: name2
293538
+ });
293024
293539
  },
293025
293540
  sortOrder: 50,
293026
293541
  supportsDryRun: true,
293027
293542
  usage: "wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]",
293028
- visibleFieldNames: () => ["kind", "name", "from", "to"]
293543
+ visibleFieldNames: () => NAME_FROM_TO_VISIBLE_FIELDS
293029
293544
  }),
293030
293545
  "rest-resource": defineAddKindRegistryEntry({
293031
293546
  completion: {
@@ -293047,24 +293562,26 @@ var ADD_KIND_REGISTRY = {
293047
293562
  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>].");
293048
293563
  const methods = readOptionalStringFlag(context.flags, "methods");
293049
293564
  const namespace = readOptionalStringFlag(context.flags, "namespace");
293050
- return {
293051
- execute: (cwd) => context.addRuntime.runAddRestResourceCommand({
293565
+ return createNamedExecutionPlan(context, {
293566
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddRestResourceCommand({
293052
293567
  cwd,
293053
293568
  methods,
293054
293569
  namespace,
293055
- restResourceName: name2
293570
+ restResourceName: name3
293056
293571
  }),
293057
293572
  getValues: (result) => ({
293058
293573
  methods: result.methods.join(", "),
293059
293574
  namespace: result.namespace,
293060
293575
  restResourceSlug: result.restResourceSlug
293061
- })
293062
- };
293576
+ }),
293577
+ missingNameMessage: "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].",
293578
+ name: name2
293579
+ });
293063
293580
  },
293064
293581
  sortOrder: 80,
293065
293582
  supportsDryRun: true,
293066
293583
  usage: "wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]",
293067
- visibleFieldNames: () => ["kind", "name", "namespace", "methods"]
293584
+ visibleFieldNames: () => NAME_NAMESPACE_METHODS_VISIBLE_FIELDS
293068
293585
  }),
293069
293586
  "ai-feature": defineAddKindRegistryEntry({
293070
293587
  completion: {
@@ -293084,9 +293601,9 @@ var ADD_KIND_REGISTRY = {
293084
293601
  async prepareExecution(context) {
293085
293602
  const name2 = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
293086
293603
  const namespace = readOptionalStringFlag(context.flags, "namespace");
293087
- return {
293088
- execute: (cwd) => context.addRuntime.runAddAiFeatureCommand({
293089
- aiFeatureName: name2,
293604
+ return createNamedExecutionPlan(context, {
293605
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddAiFeatureCommand({
293606
+ aiFeatureName: name3,
293090
293607
  cwd,
293091
293608
  namespace
293092
293609
  }),
@@ -293095,13 +293612,15 @@ var ADD_KIND_REGISTRY = {
293095
293612
  namespace: result.namespace
293096
293613
  }),
293097
293614
  getWarnings: (result) => result.warnings,
293615
+ missingNameMessage: "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].",
293616
+ name: name2,
293098
293617
  warnLine: context.warnLine
293099
- };
293618
+ });
293100
293619
  },
293101
293620
  sortOrder: 100,
293102
293621
  supportsDryRun: true,
293103
293622
  usage: "wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]",
293104
- visibleFieldNames: () => ["kind", "name", "namespace"]
293623
+ visibleFieldNames: () => NAME_NAMESPACE_VISIBLE_FIELDS
293105
293624
  }),
293106
293625
  variation: defineAddKindRegistryEntry({
293107
293626
  completion: {
@@ -293120,29 +293639,27 @@ var ADD_KIND_REGISTRY = {
293120
293639
  nameLabel: "Variation name",
293121
293640
  async prepareExecution(context) {
293122
293641
  const name2 = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
293123
- const blockSlug = readOptionalStringFlag(context.flags, "block");
293124
- if (!blockSlug) {
293125
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, "`wp-typia add variation` requires --block <block-slug>.");
293126
- }
293127
- return {
293128
- execute: (cwd) => context.addRuntime.runAddVariationCommand({
293642
+ const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
293643
+ return createNamedExecutionPlan(context, {
293644
+ execute: ({ cwd, name: name3 }) => context.addRuntime.runAddVariationCommand({
293129
293645
  blockName: blockSlug,
293130
293646
  cwd,
293131
- variationName: name2
293647
+ variationName: name3
293132
293648
  }),
293133
293649
  getValues: (result) => ({
293134
293650
  blockSlug: result.blockSlug,
293135
293651
  variationSlug: result.variationSlug
293136
- })
293137
- };
293652
+ }),
293653
+ missingNameMessage: "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>",
293654
+ name: name2
293655
+ });
293138
293656
  },
293139
293657
  sortOrder: 30,
293140
293658
  supportsDryRun: true,
293141
293659
  usage: "wp-typia add variation <name> --block <block-slug> [--dry-run]",
293142
- visibleFieldNames: () => ["kind", "name", "block"]
293660
+ visibleFieldNames: () => NAME_BLOCK_VISIBLE_FIELDS
293143
293661
  })
293144
293662
  };
293145
- var ADD_KIND_IDS = Object.keys(ADD_KIND_REGISTRY).sort((left, right) => ADD_KIND_REGISTRY[left].sortOrder - ADD_KIND_REGISTRY[right].sortOrder);
293146
293663
  function isAddKindId(value2) {
293147
293664
  return typeof value2 === "string" && ADD_KIND_IDS.includes(value2);
293148
293665
  }
@@ -293300,7 +293817,7 @@ import path10 from "path";
293300
293817
  // package.json
293301
293818
  var package_default2 = {
293302
293819
  name: "wp-typia",
293303
- version: "0.22.0",
293820
+ version: "0.22.2",
293304
293821
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
293305
293822
  packageManager: "bun@1.3.11",
293306
293823
  type: "module",
@@ -293370,7 +293887,7 @@ var package_default2 = {
293370
293887
  "@bunli/tui": "0.6.0",
293371
293888
  "@bunli/utils": "0.6.0",
293372
293889
  "@wp-typia/api-client": "^0.4.5",
293373
- "@wp-typia/project-tools": "0.22.0",
293890
+ "@wp-typia/project-tools": "0.22.2",
293374
293891
  "better-result": "^2.7.0",
293375
293892
  react: "^19.2.5",
293376
293893
  "react-dom": "^19.2.5",
@@ -293540,15 +294057,7 @@ function buildStructuredCompletionSuccessPayload(command, completion, metadata2
293540
294057
  command,
293541
294058
  ...serializedCompletion ? {
293542
294059
  completion: serializedCompletion,
293543
- files: extractPlannedFiles(serializedCompletion),
293544
- nextSteps: serializedCompletion.nextSteps,
293545
- optionalLines: serializedCompletion.optionalLines,
293546
- optionalNote: serializedCompletion.optionalNote,
293547
- optionalTitle: serializedCompletion.optionalTitle,
293548
- preambleLines: serializedCompletion.preambleLines,
293549
- summaryLines: serializedCompletion.summaryLines,
293550
- title: serializedCompletion.title,
293551
- warnings: serializedCompletion.warningLines
294060
+ files: extractPlannedFiles(serializedCompletion)
293552
294061
  } : {}
293553
294062
  }
293554
294063
  };
@@ -293567,14 +294076,11 @@ function buildStructuredInitSuccessPayload(plan) {
293567
294076
  detectedLayout: plan.detectedLayout,
293568
294077
  files: toNonEmptyArray(files),
293569
294078
  mode: plan.commandMode === "apply" ? "apply" : "preview",
293570
- nextSteps: toNonEmptyArray(plan.nextSteps),
293571
294079
  packageManager: plan.packageManager,
293572
294080
  plan,
293573
294081
  projectDir: plan.projectDir,
293574
294082
  status: plan.status,
293575
- summary: plan.summary,
293576
- title: completion.title,
293577
- warnings: toNonEmptyArray(plan.notes)
294083
+ summary: plan.summary
293578
294084
  }
293579
294085
  };
293580
294086
  }
@@ -295046,7 +295552,7 @@ init_cli_diagnostics();
295046
295552
 
295047
295553
  // src/mcp.ts
295048
295554
  import fs50 from "fs/promises";
295049
- import path65 from "path";
295555
+ import path66 from "path";
295050
295556
 
295051
295557
  // ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
295052
295558
  class SchemaConversionError extends TaggedError("SchemaConversionError")() {
@@ -295574,7 +296080,7 @@ function isToolGroup(value2) {
295574
296080
  return isObject3(value2) && typeof value2.namespace === "string" && Array.isArray(value2.tools) && value2.tools.every(isTool);
295575
296081
  }
295576
296082
  async function readSchemaSource(cwd, source) {
295577
- const schemaPath = path65.resolve(cwd, source.path);
296083
+ const schemaPath = path66.resolve(cwd, source.path);
295578
296084
  const raw = await fs50.readFile(schemaPath, "utf8");
295579
296085
  const parsed = JSON.parse(raw);
295580
296086
  if (isToolGroup(parsed)) {
@@ -295591,7 +296097,7 @@ async function readSchemaSource(cwd, source) {
295591
296097
  async function loadMcpToolGroups(cwd, schemaSources) {
295592
296098
  return Promise.all(schemaSources.map((source) => readSchemaSource(cwd, source)));
295593
296099
  }
295594
- async function syncMcpSchemas(cwd, schemaSources, outputDir = path65.join(cwd, ".bunli", "mcp")) {
296100
+ async function syncMcpSchemas(cwd, schemaSources, outputDir = path66.join(cwd, ".bunli", "mcp")) {
295595
296101
  const groups = await loadMcpToolGroups(cwd, schemaSources);
295596
296102
  const result = await generateMCPTypes({
295597
296103
  outputDir,
@@ -295614,7 +296120,7 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path65.join(cwd, "
295614
296120
  }
295615
296121
  }
295616
296122
  await fs50.mkdir(outputDir, { recursive: true });
295617
- await fs50.writeFile(path65.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
296123
+ await fs50.writeFile(path66.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
295618
296124
  `, "utf8");
295619
296125
  return {
295620
296126
  commandCount: registry2.reduce((count, group) => count + group.tools.length, 0),
@@ -295675,7 +296181,9 @@ var mcpCommand = defineCommand({
295675
296181
  emitCliDiagnosticFailure(args, {
295676
296182
  code: CLI_DIAGNOSTIC_CODES.INVALID_COMMAND,
295677
296183
  command: "mcp",
295678
- detailLines: [`Unknown mcp subcommand "${subcommand}". Expected list or sync.`]
296184
+ detailLines: [
296185
+ `Unknown mcp subcommand "${subcommand}". Expected list or sync.`
296186
+ ]
295679
296187
  });
295680
296188
  } catch (error48) {
295681
296189
  emitCliDiagnosticFailure(args, {
@@ -295685,12 +296193,7 @@ var mcpCommand = defineCommand({
295685
296193
  }
295686
296194
  },
295687
296195
  name: "mcp",
295688
- options: {
295689
- "output-dir": {
295690
- description: "Output directory for generated MCP metadata during `mcp sync`.",
295691
- schema: exports_external.string().optional()
295692
- }
295693
- }
296196
+ options: buildCommandOptions(MCP_OPTION_METADATA)
295694
296197
  });
295695
296198
  var mcp_default = mcpCommand;
295696
296199
 
@@ -295936,4 +296439,4 @@ export {
295936
296439
  cli
295937
296440
  };
295938
296441
 
295939
- //# debugId=D9C2F8E8EFC1ECF864756E2164756E21
296442
+ //# debugId=95E6742032974D4764756E2164756E21