wp-typia 0.22.7 → 0.22.8

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.
@@ -36098,6 +36098,9 @@ function capitalizeSegment(segment) {
36098
36098
  function findCommonAcronymPrefix(segment) {
36099
36099
  return COMMON_ACRONYM_PREFIXES.find((prefix) => segment.startsWith(prefix));
36100
36100
  }
36101
+ function isCommonAcronymLowercaseSuffix(suffix) {
36102
+ return COMMON_ACRONYM_LOWERCASE_SUFFIXES.includes(suffix);
36103
+ }
36101
36104
  function splitKnownAcronymSegment(segment) {
36102
36105
  const prefixes = [];
36103
36106
  let remaining = segment;
@@ -36110,6 +36113,9 @@ function splitKnownAcronymSegment(segment) {
36110
36113
  if (/^[A-Z][a-z]/.test(suffix)) {
36111
36114
  return [...prefixes, prefix, suffix].join("-");
36112
36115
  }
36116
+ if (/^[a-z]+$/.test(suffix) && isCommonAcronymLowercaseSuffix(suffix)) {
36117
+ return [...prefixes, prefix, suffix].join("-");
36118
+ }
36113
36119
  if (!findCommonAcronymPrefix(suffix)) {
36114
36120
  break;
36115
36121
  }
@@ -36140,7 +36146,7 @@ function toSegmentPascalCase(input) {
36140
36146
  function toTitleCase(input) {
36141
36147
  return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
36142
36148
  }
36143
- var COMMON_ACRONYM_PREFIXES;
36149
+ var COMMON_ACRONYM_PREFIXES, COMMON_ACRONYM_LOWERCASE_SUFFIXES;
36144
36150
  var init_string_case = __esm(() => {
36145
36151
  COMMON_ACRONYM_PREFIXES = [
36146
36152
  "HTML",
@@ -36148,7 +36154,9 @@ var init_string_case = __esm(() => {
36148
36154
  "JSON",
36149
36155
  "REST",
36150
36156
  "UUID",
36157
+ "AJAX",
36151
36158
  "API",
36159
+ "CPT",
36152
36160
  "CSS",
36153
36161
  "CTA",
36154
36162
  "DOM",
@@ -36162,6 +36170,7 @@ var init_string_case = __esm(() => {
36162
36170
  "UI",
36163
36171
  "WP"
36164
36172
  ];
36173
+ COMMON_ACRONYM_LOWERCASE_SUFFIXES = ["slug"];
36165
36174
  });
36166
36175
 
36167
36176
  // ../wp-typia-project-tools/src/runtime/scaffold-identifiers.ts
@@ -36184,7 +36193,7 @@ function validatePhpPrefix(input) {
36184
36193
  function assertValidIdentifier(label, value2, validate) {
36185
36194
  const result = validate(value2);
36186
36195
  if (result !== true) {
36187
- throw new Error(typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
36196
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
36188
36197
  }
36189
36198
  return value2;
36190
36199
  }
@@ -36197,9 +36206,9 @@ function resolveNonEmptyNormalizedBlockSlug(options) {
36197
36206
  return normalizedSlug;
36198
36207
  }
36199
36208
  if (options.input.trim().length === 0) {
36200
- throw new Error(`${options.label} is required. Use \`${options.usage}\`.`);
36209
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `${options.label} is required. Use \`${options.usage}\`.`);
36201
36210
  }
36202
- throw new Error(`${options.label} "${options.input.trim()}" normalizes to an empty slug. Use letters or numbers so wp-typia can generate a block slug.`);
36211
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `${options.label} "${options.input.trim()}" normalizes to an empty slug. Use letters or numbers so wp-typia can generate a block slug.`);
36203
36212
  }
36204
36213
  function resolveValidatedBlockSlug(value2) {
36205
36214
  return assertValidIdentifier("Block slug", normalizeBlockSlug(value2), validateBlockSlug);
@@ -36240,6 +36249,7 @@ function resolveScaffoldIdentifiers({
36240
36249
  }
36241
36250
  var BLOCK_SLUG_PATTERN, PHP_PREFIX_PATTERN, PHP_PREFIX_MAX_LENGTH = 50;
36242
36251
  var init_scaffold_identifiers = __esm(() => {
36252
+ init_cli_diagnostics();
36243
36253
  init_string_case();
36244
36254
  BLOCK_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
36245
36255
  PHP_PREFIX_PATTERN = /^[a-z_][a-z0-9_]*$/;
@@ -211297,6 +211307,9 @@ function matchesPhpFunctionCallAt(source, index, functionName) {
211297
211307
  function createPhpScannerState() {
211298
211308
  return {
211299
211309
  heredocDelimiter: "",
211310
+ interpolationComment: "",
211311
+ interpolationDepth: 0,
211312
+ interpolationQuote: "",
211300
211313
  mode: "code"
211301
211314
  };
211302
211315
  }
@@ -211320,11 +211333,73 @@ function advancePhpScanner(source, index, state) {
211320
211333
  if (character === "\\") {
211321
211334
  return { ambiguous: false, inCode: false, index: index + 2 };
211322
211335
  }
211336
+ if (state.mode === "double-quoted" && character === "{" && source[index + 1] === "$") {
211337
+ state.mode = "double-quoted-interpolation";
211338
+ state.interpolationComment = "";
211339
+ state.interpolationDepth = 1;
211340
+ state.interpolationQuote = "";
211341
+ return { ambiguous: false, inCode: false, index: index + 2 };
211342
+ }
211323
211343
  if (character === quote) {
211324
211344
  state.mode = "code";
211325
211345
  }
211326
211346
  return { ambiguous: false, inCode: false, index: index + 1 };
211327
211347
  }
211348
+ if (state.mode === "double-quoted-interpolation") {
211349
+ if (state.interpolationQuote) {
211350
+ if (character === "\\") {
211351
+ return { ambiguous: false, inCode: false, index: index + 2 };
211352
+ }
211353
+ if (character === state.interpolationQuote) {
211354
+ state.interpolationQuote = "";
211355
+ }
211356
+ return { ambiguous: false, inCode: false, index: index + 1 };
211357
+ }
211358
+ if (state.interpolationComment === "line") {
211359
+ if (character === "\r" || character === `
211360
+ `) {
211361
+ state.interpolationComment = "";
211362
+ }
211363
+ return { ambiguous: false, inCode: false, index: index + 1 };
211364
+ }
211365
+ if (state.interpolationComment === "block") {
211366
+ if (character === "*" && source[index + 1] === "/") {
211367
+ state.interpolationComment = "";
211368
+ return { ambiguous: false, inCode: false, index: index + 2 };
211369
+ }
211370
+ return { ambiguous: false, inCode: false, index: index + 1 };
211371
+ }
211372
+ if (character === "/" && source[index + 1] === "/") {
211373
+ state.interpolationComment = "line";
211374
+ return { ambiguous: false, inCode: false, index: index + 2 };
211375
+ }
211376
+ if (character === "#" && source[index + 1] !== "[") {
211377
+ state.interpolationComment = "line";
211378
+ return { ambiguous: false, inCode: false, index: index + 1 };
211379
+ }
211380
+ if (character === "/" && source[index + 1] === "*") {
211381
+ state.interpolationComment = "block";
211382
+ return { ambiguous: false, inCode: false, index: index + 2 };
211383
+ }
211384
+ if (character === "'" || character === '"') {
211385
+ state.interpolationQuote = character;
211386
+ return { ambiguous: false, inCode: false, index: index + 1 };
211387
+ }
211388
+ if (character === "{") {
211389
+ state.interpolationDepth += 1;
211390
+ return { ambiguous: false, inCode: false, index: index + 1 };
211391
+ }
211392
+ if (character === "}") {
211393
+ state.interpolationDepth -= 1;
211394
+ if (state.interpolationDepth <= 0) {
211395
+ state.interpolationComment = "";
211396
+ state.interpolationDepth = 0;
211397
+ state.mode = "double-quoted";
211398
+ }
211399
+ return { ambiguous: false, inCode: false, index: index + 1 };
211400
+ }
211401
+ return { ambiguous: false, inCode: false, index: index + 1 };
211402
+ }
211328
211403
  if (state.mode === "line-comment") {
211329
211404
  if (character === "\r" || character === `
211330
211405
  `) {
@@ -211456,32 +211531,38 @@ function replacePhpFunctionDefinition(source, functionName, replacement, options
211456
211531
  ].join("");
211457
211532
  }
211458
211533
 
211534
+ // ../wp-typia-project-tools/src/runtime/ts-property-names.ts
211535
+ function getPropertyNameText(name2) {
211536
+ if (import_typescript.default.isIdentifier(name2) || import_typescript.default.isStringLiteral(name2) || import_typescript.default.isNumericLiteral(name2)) {
211537
+ return name2.text;
211538
+ }
211539
+ return null;
211540
+ }
211541
+ var import_typescript;
211542
+ var init_ts_property_names = __esm(() => {
211543
+ import_typescript = __toESM(require_typescript(), 1);
211544
+ });
211545
+
211459
211546
  // ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
211460
- import fs18 from "fs";
211547
+ import { readFileSync } from "fs";
211461
211548
  import path26 from "path";
211462
211549
  import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
211463
211550
  function defineInventoryEntryParser(descriptor) {
211464
211551
  return descriptor;
211465
211552
  }
211466
- function getPropertyNameText(name2) {
211467
- if (import_typescript.default.isIdentifier(name2) || import_typescript.default.isStringLiteral(name2)) {
211468
- return name2.text;
211469
- }
211470
- return null;
211471
- }
211472
211553
  function findExportedArrayLiteral(sourceFile, exportName) {
211473
211554
  for (const statement of sourceFile.statements) {
211474
- if (!import_typescript.default.isVariableStatement(statement)) {
211555
+ if (!import_typescript2.default.isVariableStatement(statement)) {
211475
211556
  continue;
211476
211557
  }
211477
- if (!statement.modifiers?.some((modifier) => modifier.kind === import_typescript.default.SyntaxKind.ExportKeyword)) {
211558
+ if (!statement.modifiers?.some((modifier) => modifier.kind === import_typescript2.default.SyntaxKind.ExportKeyword)) {
211478
211559
  continue;
211479
211560
  }
211480
211561
  for (const declaration of statement.declarationList.declarations) {
211481
- if (!import_typescript.default.isIdentifier(declaration.name) || declaration.name.text !== exportName) {
211562
+ if (!import_typescript2.default.isIdentifier(declaration.name) || declaration.name.text !== exportName) {
211482
211563
  continue;
211483
211564
  }
211484
- if (declaration.initializer && import_typescript.default.isArrayLiteralExpression(declaration.initializer)) {
211565
+ if (declaration.initializer && import_typescript2.default.isArrayLiteralExpression(declaration.initializer)) {
211485
211566
  return {
211486
211567
  array: declaration.initializer,
211487
211568
  found: true
@@ -211500,14 +211581,14 @@ function findExportedArrayLiteral(sourceFile, exportName) {
211500
211581
  }
211501
211582
  function getOptionalStringProperty(entryName, elementIndex, objectLiteral, key2) {
211502
211583
  for (const property of objectLiteral.properties) {
211503
- if (!import_typescript.default.isPropertyAssignment(property)) {
211584
+ if (!import_typescript2.default.isPropertyAssignment(property)) {
211504
211585
  continue;
211505
211586
  }
211506
211587
  const propertyName = getPropertyNameText(property.name);
211507
211588
  if (propertyName !== key2) {
211508
211589
  continue;
211509
211590
  }
211510
- if (import_typescript.default.isStringLiteralLike(property.initializer)) {
211591
+ if (import_typescript2.default.isStringLiteralLike(property.initializer)) {
211511
211592
  return property.initializer.text;
211512
211593
  }
211513
211594
  throw new Error(`${entryName}[${elementIndex}] must use a string literal for "${key2}" in scripts/block-config.ts.`);
@@ -211523,18 +211604,18 @@ function getRequiredStringProperty(entryName, elementIndex, objectLiteral, key2)
211523
211604
  }
211524
211605
  function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral, key2) {
211525
211606
  for (const property of objectLiteral.properties) {
211526
- if (!import_typescript.default.isPropertyAssignment(property)) {
211607
+ if (!import_typescript2.default.isPropertyAssignment(property)) {
211527
211608
  continue;
211528
211609
  }
211529
211610
  const propertyName = getPropertyNameText(property.name);
211530
211611
  if (propertyName !== key2) {
211531
211612
  continue;
211532
211613
  }
211533
- if (!import_typescript.default.isArrayLiteralExpression(property.initializer)) {
211614
+ if (!import_typescript2.default.isArrayLiteralExpression(property.initializer)) {
211534
211615
  throw new Error(`${entryName}[${elementIndex}] must use an array literal for "${key2}" in scripts/block-config.ts.`);
211535
211616
  }
211536
211617
  return property.initializer.elements.map((element, itemIndex) => {
211537
- if (!import_typescript.default.isStringLiteralLike(element)) {
211618
+ if (!import_typescript2.default.isStringLiteralLike(element)) {
211538
211619
  throw new Error(`${entryName}[${elementIndex}].${key2}[${itemIndex}] must use a string literal in scripts/block-config.ts.`);
211539
211620
  }
211540
211621
  return element.text;
@@ -211544,7 +211625,7 @@ function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral,
211544
211625
  }
211545
211626
  function parseInventoryEntries(arrayLiteral, descriptor) {
211546
211627
  return arrayLiteral.elements.map((element, elementIndex) => {
211547
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211628
+ if (!import_typescript2.default.isObjectLiteralExpression(element)) {
211548
211629
  throw new Error(`${descriptor.entryName}[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211549
211630
  }
211550
211631
  const entry = {};
@@ -211594,7 +211675,7 @@ function parseInventorySection(sourceFile, descriptor) {
211594
211675
  };
211595
211676
  }
211596
211677
  function parseWorkspaceInventorySource(source) {
211597
- const sourceFile = import_typescript.default.createSourceFile("block-config.ts", source, import_typescript.default.ScriptTarget.Latest, true, import_typescript.default.ScriptKind.TS);
211678
+ const sourceFile = import_typescript2.default.createSourceFile("block-config.ts", source, import_typescript2.default.ScriptTarget.Latest, true, import_typescript2.default.ScriptKind.TS);
211598
211679
  const parsedInventory = {
211599
211680
  abilities: [],
211600
211681
  adminViews: [],
@@ -211636,7 +211717,23 @@ function readWorkspaceInventory(projectDir) {
211636
211717
  const blockConfigPath = path26.join(projectDir, "scripts", "block-config.ts");
211637
211718
  let source;
211638
211719
  try {
211639
- source = fs18.readFileSync(blockConfigPath, "utf8");
211720
+ source = readFileSync(blockConfigPath, "utf8");
211721
+ } catch (error48) {
211722
+ if (typeof error48 === "object" && error48 !== null && "code" in error48 && error48.code === "ENOENT") {
211723
+ throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
211724
+ }
211725
+ throw error48;
211726
+ }
211727
+ return {
211728
+ blockConfigPath,
211729
+ ...parseWorkspaceInventorySource(source)
211730
+ };
211731
+ }
211732
+ async function readWorkspaceInventoryAsync(projectDir) {
211733
+ const blockConfigPath = path26.join(projectDir, "scripts", "block-config.ts");
211734
+ let source;
211735
+ try {
211736
+ source = await readFile3(blockConfigPath, "utf8");
211640
211737
  } catch (error48) {
211641
211738
  if (typeof error48 === "object" && error48 !== null && "code" in error48 && error48.code === "ENOENT") {
211642
211739
  throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
@@ -211764,7 +211861,7 @@ async function appendWorkspaceInventoryEntries(projectDir, options) {
211764
211861
  await writeFile3(blockConfigPath, nextSource, "utf8");
211765
211862
  }
211766
211863
  }
211767
- var import_typescript, BLOCK_CONFIG_ENTRY_MARKER = "\t// wp-typia add block entries", VARIATION_CONFIG_ENTRY_MARKER = "\t// wp-typia add variation entries", BLOCK_STYLE_CONFIG_ENTRY_MARKER = "\t// wp-typia add style entries", BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER = "\t// wp-typia add transform entries", PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries", BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries", REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries", ABILITY_CONFIG_ENTRY_MARKER = "\t// wp-typia add ability entries", AI_FEATURE_CONFIG_ENTRY_MARKER = "\t// wp-typia add ai-feature entries", ADMIN_VIEW_CONFIG_ENTRY_MARKER = "\t// wp-typia add admin-view entries", EDITOR_PLUGIN_CONFIG_ENTRY_MARKER = "\t// wp-typia add editor-plugin entries", VARIATIONS_INTERFACE_SECTION = `
211864
+ var import_typescript2, BLOCK_CONFIG_ENTRY_MARKER = "\t// wp-typia add block entries", VARIATION_CONFIG_ENTRY_MARKER = "\t// wp-typia add variation entries", BLOCK_STYLE_CONFIG_ENTRY_MARKER = "\t// wp-typia add style entries", BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER = "\t// wp-typia add transform entries", PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries", BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries", REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries", ABILITY_CONFIG_ENTRY_MARKER = "\t// wp-typia add ability entries", AI_FEATURE_CONFIG_ENTRY_MARKER = "\t// wp-typia add ai-feature entries", ADMIN_VIEW_CONFIG_ENTRY_MARKER = "\t// wp-typia add admin-view entries", EDITOR_PLUGIN_CONFIG_ENTRY_MARKER = "\t// wp-typia add editor-plugin entries", VARIATIONS_INTERFACE_SECTION = `
211768
211865
 
211769
211866
  export interface WorkspaceVariationConfig {
211770
211867
  block: string;
@@ -211899,7 +211996,8 @@ export const EDITOR_PLUGINS: WorkspaceEditorPluginConfig[] = [
211899
211996
  `, BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS;
211900
211997
  var init_workspace_inventory = __esm(() => {
211901
211998
  init_cli_add_shared();
211902
- import_typescript = __toESM(require_typescript(), 1);
211999
+ init_ts_property_names();
212000
+ import_typescript2 = __toESM(require_typescript(), 1);
211903
212001
  ABILITIES_INTERFACE_SECTION = `
211904
212002
 
211905
212003
  export interface WorkspaceAbilityConfig {
@@ -212255,7 +212353,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
212255
212353
  });
212256
212354
 
212257
212355
  // ../wp-typia-project-tools/src/runtime/migration-maintenance-verify.ts
212258
- import fs19 from "fs";
212356
+ import fs18 from "fs";
212259
212357
  import path27 from "path";
212260
212358
  import { execFileSync } from "child_process";
212261
212359
  function verifyProjectMigrations(projectDir, {
@@ -212281,7 +212379,7 @@ function verifyProjectMigrations(projectDir, {
212281
212379
  assertRuleHasNoTodos(projectDir, block, entry.fromVersion, state.config.currentMigrationVersion);
212282
212380
  }
212283
212381
  const verifyScriptPath = path27.join(getGeneratedDirForBlock(state.paths, block), "verify.ts");
212284
- if (!fs19.existsSync(verifyScriptPath)) {
212382
+ if (!fs18.existsSync(verifyScriptPath)) {
212285
212383
  const selectedVersionsForBlock2 = entries.map((entry) => entry.fromVersion);
212286
212384
  throw new Error(`Generated verify script is missing for ${block.blockName} (${selectedVersionsForBlock2.join(", ")}). ` + `Run \`${formatScaffoldCommand(selectedVersionsForBlock2)}\` first, then \`wp-typia migrate doctor --all\` if the workspace should already be scaffolded.`);
212287
212385
  }
@@ -212357,14 +212455,14 @@ function doctorProjectMigrations(projectDir, {
212357
212455
  const blockJsonPath = getSnapshotBlockJsonPath(projectDir, block, version2);
212358
212456
  const manifestPath = getSnapshotManifestPath(projectDir, block, version2);
212359
212457
  const savePath = getSnapshotSavePath(projectDir, block, version2);
212360
- const hasSnapshot = fs19.existsSync(snapshotRoot);
212458
+ const hasSnapshot = fs18.existsSync(snapshotRoot);
212361
212459
  const snapshotIsOptional = !hasSnapshot && isSnapshotOptionalForBlockVersion(state, block, version2);
212362
212460
  recordCheck(hasSnapshot || snapshotIsOptional ? "pass" : "fail", legacySingleBlock ? `Snapshot ${version2}` : `Snapshot ${block.blockName} @ ${version2}`, hasSnapshot ? path27.relative(projectDir, snapshotRoot) : "Not present for this version");
212363
212461
  if (!hasSnapshot) {
212364
212462
  continue;
212365
212463
  }
212366
212464
  for (const targetPath of [blockJsonPath, manifestPath, savePath]) {
212367
- recordCheck(fs19.existsSync(targetPath) ? "pass" : "fail", legacySingleBlock ? `Snapshot file ${version2}` : `Snapshot file ${block.blockName} @ ${version2}`, fs19.existsSync(targetPath) ? path27.relative(projectDir, targetPath) : `Missing ${path27.relative(projectDir, targetPath)}`);
212465
+ recordCheck(fs18.existsSync(targetPath) ? "pass" : "fail", legacySingleBlock ? `Snapshot file ${version2}` : `Snapshot file ${block.blockName} @ ${version2}`, fs18.existsSync(targetPath) ? path27.relative(projectDir, targetPath) : `Missing ${path27.relative(projectDir, targetPath)}`);
212368
212466
  }
212369
212467
  }
212370
212468
  }
@@ -212383,7 +212481,7 @@ function doctorProjectMigrations(projectDir, {
212383
212481
  expectedGeneratedFiles.set(path27.join(state.paths.generatedDir, "index.ts"), renderGeneratedMigrationIndexFile(state, generatedEntries.map(({ entry }) => entry)));
212384
212482
  expectedGeneratedFiles.set(path27.join(projectDir, ROOT_PHP_MIGRATION_REGISTRY), renderPhpMigrationRegistryFile(state, generatedEntries.map(({ entry }) => entry)));
212385
212483
  for (const [filePath, expectedSource] of expectedGeneratedFiles) {
212386
- const inSync = fs19.existsSync(filePath) && fs19.readFileSync(filePath, "utf8") === expectedSource;
212484
+ const inSync = fs18.existsSync(filePath) && fs18.readFileSync(filePath, "utf8") === expectedSource;
212387
212485
  recordCheck(inSync ? "pass" : "fail", `Generated ${path27.relative(projectDir, filePath)}`, inSync ? "In sync" : "Run `wp-typia migrate scaffold --from-migration-version <label>` or regenerate artifacts");
212388
212486
  }
212389
212487
  } catch (error48) {
@@ -212397,9 +212495,9 @@ function doctorProjectMigrations(projectDir, {
212397
212495
  }
212398
212496
  const rulePath = getRuleFilePath(state.paths, block, version2, state.config.currentMigrationVersion);
212399
212497
  const fixturePath = getFixtureFilePath(state.paths, block, version2, state.config.currentMigrationVersion);
212400
- recordCheck(fs19.existsSync(rulePath) ? "pass" : "fail", legacySingleBlock ? `Rule ${version2}` : `Rule ${block.blockName} @ ${version2}`, fs19.existsSync(rulePath) ? path27.relative(projectDir, rulePath) : `Missing ${path27.relative(projectDir, rulePath)}`);
212401
- recordCheck(fs19.existsSync(fixturePath) ? "pass" : "fail", legacySingleBlock ? `Fixture ${version2}` : `Fixture ${block.blockName} @ ${version2}`, fs19.existsSync(fixturePath) ? path27.relative(projectDir, fixturePath) : `Missing ${path27.relative(projectDir, fixturePath)}`);
212402
- if (!fs19.existsSync(rulePath) || !fs19.existsSync(fixturePath)) {
212498
+ recordCheck(fs18.existsSync(rulePath) ? "pass" : "fail", legacySingleBlock ? `Rule ${version2}` : `Rule ${block.blockName} @ ${version2}`, fs18.existsSync(rulePath) ? path27.relative(projectDir, rulePath) : `Missing ${path27.relative(projectDir, rulePath)}`);
212499
+ recordCheck(fs18.existsSync(fixturePath) ? "pass" : "fail", legacySingleBlock ? `Fixture ${version2}` : `Fixture ${block.blockName} @ ${version2}`, fs18.existsSync(fixturePath) ? path27.relative(projectDir, fixturePath) : `Missing ${path27.relative(projectDir, fixturePath)}`);
212500
+ if (!fs18.existsSync(rulePath) || !fs18.existsSync(fixturePath)) {
212403
212501
  continue;
212404
212502
  }
212405
212503
  try {
@@ -212452,7 +212550,7 @@ var init_migration_maintenance_verify = __esm(() => {
212452
212550
  });
212453
212551
 
212454
212552
  // ../wp-typia-project-tools/src/runtime/migration-maintenance-fixtures.ts
212455
- import fs20 from "fs";
212553
+ import fs19 from "fs";
212456
212554
  import path28 from "path";
212457
212555
  import { execFileSync as execFileSync2 } from "child_process";
212458
212556
  function fixturesProjectMigrations(projectDir, {
@@ -212475,7 +212573,7 @@ function fixturesProjectMigrations(projectDir, {
212475
212573
  const skippedVersions = [];
212476
212574
  const fixtureTargets = collectFixtureTargets(state, targetVersions, targetMigrationVersion);
212477
212575
  if (force) {
212478
- const overwriteTargets = fixtureTargets.filter(({ fixturePath }) => fs20.existsSync(fixturePath));
212576
+ const overwriteTargets = fixtureTargets.filter(({ fixturePath }) => fs19.existsSync(fixturePath));
212479
212577
  if (isInteractive && overwriteTargets.length > 0) {
212480
212578
  const confirmed = confirmOverwrite?.(`About to overwrite ${overwriteTargets.length} existing migration fixture file(s). Continue?`) ?? promptForConfirmation(`About to overwrite ${overwriteTargets.length} existing migration fixture file(s). Continue?`);
212481
212579
  if (!confirmed) {
@@ -212488,7 +212586,7 @@ function fixturesProjectMigrations(projectDir, {
212488
212586
  }
212489
212587
  }
212490
212588
  for (const { block, fixturePath, scopedLabel, version: version2 } of fixtureTargets) {
212491
- const existed = fs20.existsSync(fixturePath);
212589
+ const existed = fs19.existsSync(fixturePath);
212492
212590
  const diff = createMigrationDiff(state, block, version2, targetMigrationVersion);
212493
212591
  const result = ensureEdgeFixtureFile(projectDir, block, version2, targetMigrationVersion, diff, { force });
212494
212592
  if (result.written) {
@@ -212529,7 +212627,7 @@ function fuzzProjectMigrations(projectDir, {
212529
212627
  assertRuleHasNoTodos(projectDir, block, entry.fromVersion, state.config.currentMigrationVersion);
212530
212628
  }
212531
212629
  const fuzzScriptPath = path28.join(getGeneratedDirForBlock(state.paths, block), "fuzz.ts");
212532
- if (!fs20.existsSync(fuzzScriptPath)) {
212630
+ if (!fs19.existsSync(fuzzScriptPath)) {
212533
212631
  const selectedVersionsForBlock2 = entries.map((entry) => entry.fromVersion);
212534
212632
  throw new Error(`Generated fuzz script is missing for ${block.blockName} (${selectedVersionsForBlock2.join(", ")}). ` + `Run \`${formatScaffoldCommand(selectedVersionsForBlock2)}\` first, then \`wp-typia migrate doctor --all\` if the workspace should already be scaffolded.`);
212535
212633
  }
@@ -212555,7 +212653,7 @@ function promptForConfirmation(message) {
212555
212653
  const buffer = Buffer.alloc(1);
212556
212654
  let answer = "";
212557
212655
  while (true) {
212558
- const bytesRead = fs20.readSync(process.stdin.fd, buffer, 0, 1, null);
212656
+ const bytesRead = fs19.readSync(process.stdin.fd, buffer, 0, 1, null);
212559
212657
  if (bytesRead === 0) {
212560
212658
  break;
212561
212659
  }
@@ -212602,7 +212700,7 @@ __export(exports_migrations, {
212602
212700
  doctorProjectMigrations: () => doctorProjectMigrations,
212603
212701
  diffProjectMigrations: () => diffProjectMigrations
212604
212702
  });
212605
- import fs21 from "fs";
212703
+ import fs20 from "fs";
212606
212704
  import path29 from "path";
212607
212705
  function runMigrationCommand(command, cwd, { prompt, renderLine = console.log } = {}) {
212608
212706
  switch (command.command) {
@@ -212820,11 +212918,11 @@ function snapshotProjectVersion(projectDir, migrationVersion, {
212820
212918
  const state = loadMigrationProject(projectDir, { allowMissingConfig: skipConfigUpdate });
212821
212919
  for (const block of state.blocks) {
212822
212920
  const snapshotRoot = getSnapshotRoot(projectDir, block, migrationVersion);
212823
- fs21.mkdirSync(snapshotRoot, { recursive: true });
212824
- fs21.writeFileSync(getSnapshotBlockJsonPath(projectDir, block, migrationVersion), `${JSON.stringify(sanitizeSnapshotBlockJson(readJson(path29.join(projectDir, block.blockJsonFile))), null, "\t")}
212921
+ fs20.mkdirSync(snapshotRoot, { recursive: true });
212922
+ fs20.writeFileSync(getSnapshotBlockJsonPath(projectDir, block, migrationVersion), `${JSON.stringify(sanitizeSnapshotBlockJson(readJson(path29.join(projectDir, block.blockJsonFile))), null, "\t")}
212825
212923
  `, "utf8");
212826
212924
  copyFile(path29.join(projectDir, block.manifestFile), getSnapshotManifestPath(projectDir, block, migrationVersion));
212827
- fs21.writeFileSync(getSnapshotSavePath(projectDir, block, migrationVersion), sanitizeSaveSnapshotSource(fs21.readFileSync(path29.join(projectDir, block.saveFile), "utf8")), "utf8");
212925
+ fs20.writeFileSync(getSnapshotSavePath(projectDir, block, migrationVersion), sanitizeSaveSnapshotSource(fs20.readFileSync(path29.join(projectDir, block.saveFile), "utf8")), "utf8");
212828
212926
  }
212829
212927
  if (!skipConfigUpdate) {
212830
212928
  const nextSupported = [
@@ -212887,9 +212985,9 @@ function scaffoldProjectMigrations(projectDir, {
212887
212985
  eligibleBlocks += 1;
212888
212986
  const diff = createMigrationDiff(state, block, fromMigrationVersion, targetMigrationVersion);
212889
212987
  const rulePath = getRuleFilePath(paths, block, fromMigrationVersion, targetMigrationVersion);
212890
- if (!fs21.existsSync(rulePath)) {
212891
- fs21.mkdirSync(path29.dirname(rulePath), { recursive: true });
212892
- fs21.writeFileSync(rulePath, renderMigrationRuleFile({
212988
+ if (!fs20.existsSync(rulePath)) {
212989
+ fs20.mkdirSync(path29.dirname(rulePath), { recursive: true });
212990
+ fs20.writeFileSync(rulePath, renderMigrationRuleFile({
212893
212991
  block,
212894
212992
  currentAttributes: block.currentManifest.attributes ?? {},
212895
212993
  currentTypeName: block.currentManifest.sourceType,
@@ -212991,16 +213089,16 @@ var init_template_defaults = __esm(() => {
212991
213089
  });
212992
213090
 
212993
213091
  // ../wp-typia-project-tools/src/runtime/template-registry.ts
212994
- import fs22 from "fs";
213092
+ import fs21 from "fs";
212995
213093
  import path30 from "path";
212996
213094
  import { fileURLToPath as fileURLToPath3 } from "url";
212997
213095
  function resolveValidProjectToolsPackageRoot(candidateRoot) {
212998
213096
  const packageJsonPath = path30.join(candidateRoot, "package.json");
212999
- if (!fs22.existsSync(packageJsonPath)) {
213097
+ if (!fs21.existsSync(packageJsonPath)) {
213000
213098
  return;
213001
213099
  }
213002
213100
  try {
213003
- const packageJson = JSON.parse(fs22.readFileSync(packageJsonPath, "utf8"));
213101
+ const packageJson = JSON.parse(fs21.readFileSync(packageJsonPath, "utf8"));
213004
213102
  return packageJson.name === PROJECT_TOOLS_PACKAGE_NAME ? candidateRoot : undefined;
213005
213103
  } catch {
213006
213104
  return;
@@ -213018,9 +213116,9 @@ function resolvePackageRoot(startDir) {
213018
213116
  let currentDir = startDir;
213019
213117
  while (true) {
213020
213118
  const packageJsonPath = path30.join(currentDir, "package.json");
213021
- if (fs22.existsSync(packageJsonPath)) {
213119
+ if (fs21.existsSync(packageJsonPath)) {
213022
213120
  try {
213023
- const packageJson = JSON.parse(fs22.readFileSync(packageJsonPath, "utf8"));
213121
+ const packageJson = JSON.parse(fs21.readFileSync(packageJsonPath, "utf8"));
213024
213122
  if (packageJson.name === PROJECT_TOOLS_PACKAGE_NAME) {
213025
213123
  return currentDir;
213026
213124
  }
@@ -213773,7 +213871,7 @@ var init_template_render = __esm(() => {
213773
213871
  });
213774
213872
 
213775
213873
  // ../wp-typia-project-tools/src/runtime/local-dev-presets.ts
213776
- import fs23 from "fs";
213874
+ import fs22 from "fs";
213777
213875
  import { promises as fsp6 } from "fs";
213778
213876
  import path32 from "path";
213779
213877
  function templateHasPersistenceSync(templateId, compoundPersistenceEnabled) {
@@ -213825,7 +213923,7 @@ async function appendGitignoreLines(projectDir, lines) {
213825
213923
  return;
213826
213924
  }
213827
213925
  const gitignorePath = path32.join(projectDir, ".gitignore");
213828
- const current = fs23.existsSync(gitignorePath) ? await fsp6.readFile(gitignorePath, "utf8") : "";
213926
+ const current = fs22.existsSync(gitignorePath) ? await fsp6.readFile(gitignorePath, "utf8") : "";
213829
213927
  const missingLines = lines.filter((line) => !current.includes(`${line}
213830
213928
  `) && !current.endsWith(line));
213831
213929
  if (missingLines.length === 0) {
@@ -213914,7 +214012,7 @@ var init_local_dev_presets = __esm(() => {
213914
214012
  });
213915
214013
 
213916
214014
  // ../wp-typia-project-tools/src/runtime/package-versions.ts
213917
- import fs24 from "fs";
214015
+ import fs23 from "fs";
213918
214016
  import { createRequire } from "module";
213919
214017
  import path33 from "path";
213920
214018
  function getErrorCode(error48) {
@@ -213952,10 +214050,19 @@ function createContentFingerprint(source) {
213952
214050
  }
213953
214051
  return (hash2 >>> 0).toString(16);
213954
214052
  }
214053
+ function readPackageManifestFile(packageJsonPath) {
214054
+ const fileDescriptor = fs23.openSync(packageJsonPath, "r");
214055
+ try {
214056
+ const stats = fs23.fstatSync(fileDescriptor);
214057
+ const source = fs23.readFileSync(fileDescriptor, "utf8");
214058
+ return { source, stats };
214059
+ } finally {
214060
+ fs23.closeSync(fileDescriptor);
214061
+ }
214062
+ }
213955
214063
  function resolvePackageManifestLocation(packageJsonPath) {
213956
214064
  try {
213957
- const stats = fs24.statSync(packageJsonPath);
213958
- const source = fs24.readFileSync(packageJsonPath, "utf8");
214065
+ const { source, stats } = readPackageManifestFile(packageJsonPath);
213959
214066
  return {
213960
214067
  cacheKey: `file:${packageJsonPath}:${stats.ino}:${stats.mtimeMs}:${stats.ctimeMs}:${stats.size}:${createContentFingerprint(source)}`,
213961
214068
  packageJsonPath,
@@ -214492,6 +214599,13 @@ function attachScaffoldTemplateVariableGroups(variables, groups) {
214492
214599
  function getScaffoldTemplateVariableGroups(variables) {
214493
214600
  return variables[SCAFFOLD_TEMPLATE_VARIABLE_GROUPS];
214494
214601
  }
214602
+ function isCompoundPersistenceEnabled(variables) {
214603
+ const compound = getScaffoldTemplateVariableGroups(variables).compound;
214604
+ return compound.enabled && compound.persistenceEnabled;
214605
+ }
214606
+ function getScaffoldAlternateRenderTargets(variables) {
214607
+ return getScaffoldTemplateVariableGroups(variables).alternateRenderTargets;
214608
+ }
214495
214609
  var SCAFFOLD_TEMPLATE_VARIABLE_GROUPS;
214496
214610
  var init_scaffold_template_variable_groups = __esm(() => {
214497
214611
  SCAFFOLD_TEMPLATE_VARIABLE_GROUPS = Symbol("wp-typia.scaffold-template-variable-groups");
@@ -214930,7 +215044,7 @@ function buildPersistenceAttributes(variables) {
214930
215044
  return buildAttributesFromSpecs(PERSISTENCE_ATTRIBUTE_SPECS, variables);
214931
215045
  }
214932
215046
  function buildCompoundParentAttributes(variables) {
214933
- return buildAttributesFromSpecs(variables.compoundPersistenceEnabled === "true" ? [
215047
+ return buildAttributesFromSpecs(isCompoundPersistenceEnabled(variables) ? [
214934
215048
  ...COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS,
214935
215049
  ...COMPOUND_PARENT_PERSISTENCE_ATTRIBUTE_SPECS
214936
215050
  ] : COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS, variables);
@@ -214944,6 +215058,7 @@ function buildCompoundChildAttributes(childTitle, childCssClassName, bodyPlaceho
214944
215058
  }
214945
215059
  var ALIGNMENT_VALUES, BASIC_ALIGNMENT_VALUES, INTERACTIVE_MODE_VALUES, ANIMATION_VALUES, BASIC_ATTRIBUTE_SPECS, INTERACTIVITY_ATTRIBUTE_SPECS, PERSISTENCE_ATTRIBUTE_SPECS, COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS, COMPOUND_PARENT_PERSISTENCE_ATTRIBUTE_SPECS, COMPOUND_CHILD_ATTRIBUTE_SPECS;
214946
215060
  var init_built_in_block_attribute_specs = __esm(() => {
215061
+ init_scaffold_template_variable_groups();
214947
215062
  ALIGNMENT_VALUES = ["left", "center", "right"];
214948
215063
  BASIC_ALIGNMENT_VALUES = ["left", "center", "right", "justify"];
214949
215064
  INTERACTIVE_MODE_VALUES = ["click", "hover"];
@@ -215436,7 +215551,7 @@ function buildPersistenceTypesSource(variables, attributes) {
215436
215551
  });
215437
215552
  }
215438
215553
  function buildCompoundTypesSource(variables, attributes) {
215439
- const persistenceEnabled = variables.compoundPersistenceEnabled === "true";
215554
+ const persistenceEnabled = isCompoundPersistenceEnabled(variables);
215440
215555
  return emitTypesModule({
215441
215556
  preambleLines: persistenceEnabled ? [...STANDARD_PREAMBLE_LINES] : [...VALIDATION_ONLY_PREAMBLE_LINES],
215442
215557
  interfaces: [
@@ -215524,6 +215639,7 @@ function buildCompoundChildTypesSource(variables, attributes) {
215524
215639
  }
215525
215640
  var STANDARD_PREAMBLE_LINES, VALIDATION_ONLY_PREAMBLE_LINES;
215526
215641
  var init_built_in_block_artifact_types = __esm(() => {
215642
+ init_scaffold_template_variable_groups();
215527
215643
  STANDARD_PREAMBLE_LINES = [
215528
215644
  'import type { TextAlignment } from "@wp-typia/block-types/block-editor/alignment";',
215529
215645
  "import type {",
@@ -215765,7 +215881,7 @@ var init_starter_manifests = __esm(() => {
215765
215881
  });
215766
215882
 
215767
215883
  // ../wp-typia-project-tools/src/runtime/scaffold-bootstrap.ts
215768
- import fs25 from "fs";
215884
+ import fs24 from "fs";
215769
215885
  import { promises as fsp8 } from "fs";
215770
215886
  import path35 from "path";
215771
215887
  async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
@@ -215780,10 +215896,10 @@ async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
215780
215896
  }
215781
215897
  function readGeneratedPackageJson(projectDir) {
215782
215898
  const packageJsonPath = path35.join(projectDir, "package.json");
215783
- if (!fs25.existsSync(packageJsonPath)) {
215899
+ if (!fs24.existsSync(packageJsonPath)) {
215784
215900
  return null;
215785
215901
  }
215786
- return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8"));
215902
+ return JSON.parse(fs24.readFileSync(packageJsonPath, "utf8"));
215787
215903
  }
215788
215904
  function formatNonEmptyTargetDirectoryError(targetDir) {
215789
215905
  return `Target directory is not empty: ${targetDir}. Choose a new project directory, or empty this directory before rerunning the scaffold.`;
@@ -215962,7 +216078,7 @@ var init_scaffold_package_manager_files = __esm(() => {
215962
216078
  });
215963
216079
 
215964
216080
  // ../wp-typia-project-tools/src/runtime/scaffold-repository-reference.ts
215965
- import fs26 from "fs";
216081
+ import fs25 from "fs";
215966
216082
  import { createRequire as createRequire2 } from "module";
215967
216083
  import path37 from "path";
215968
216084
  function getErrorCode2(error48) {
@@ -215970,7 +216086,7 @@ function getErrorCode2(error48) {
215970
216086
  }
215971
216087
  function readRepositoryPackageManifest(packageJsonPath) {
215972
216088
  try {
215973
- return JSON.parse(fs26.readFileSync(packageJsonPath, "utf8"));
216089
+ return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8"));
215974
216090
  } catch (error48) {
215975
216091
  if (getErrorCode2(error48) === "ENOENT") {
215976
216092
  return null;
@@ -216133,7 +216249,7 @@ async function withEphemeralScaffoldNodeModules2(targetDir, callback) {
216133
216249
  }
216134
216250
  }
216135
216251
  async function seedBuiltInPersistenceArtifacts2(targetDir, templateId, variables) {
216136
- const needsPersistenceArtifacts = templateId === "persistence" || templateId === "compound" && variables.compoundPersistenceEnabled === "true";
216252
+ const needsPersistenceArtifacts = templateId === "persistence" || templateId === "compound" && isCompoundPersistenceEnabled(variables);
216137
216253
  if (!needsPersistenceArtifacts) {
216138
216254
  return;
216139
216255
  }
@@ -216301,7 +216417,7 @@ async function applyBuiltInScaffoldProjectFiles({
216301
216417
  await fsp10.writeFile(gitignorePath, mergeTextLines(gitignoreContent ?? buildGitignore(), existingGitignore), "utf8");
216302
216418
  await normalizePackageJson(projectDir, packageManager);
216303
216419
  await applyGeneratedProjectDxPackageJson({
216304
- compoundPersistenceEnabled: variables.compoundPersistenceEnabled === "true",
216420
+ compoundPersistenceEnabled: isCompoundPersistenceEnabled(variables),
216305
216421
  packageManager,
216306
216422
  projectDir,
216307
216423
  templateId,
@@ -216342,6 +216458,7 @@ var init_scaffold_apply_utils = __esm(() => {
216342
216458
  init_scaffold_package_manager_files();
216343
216459
  init_scaffold_bootstrap();
216344
216460
  init_scaffold_repository_reference();
216461
+ init_scaffold_template_variable_groups();
216345
216462
  init_scaffold_documents();
216346
216463
  EPHEMERAL_NODE_MODULES_LINK_TYPE2 = process.platform === "win32" ? "junction" : "dir";
216347
216464
  __dirname4 = path38.dirname(fileURLToPath4(import.meta.url));
@@ -216354,7 +216471,7 @@ var init_scaffold_apply_utils = __esm(() => {
216354
216471
  });
216355
216472
 
216356
216473
  // ../wp-typia-project-tools/src/runtime/template-builtins.ts
216357
- import fs27 from "fs";
216474
+ import fs26 from "fs";
216358
216475
  import path39 from "path";
216359
216476
  import { promises as fsp11 } from "fs";
216360
216477
  function isBuiltInSharedTemplateLayerId(layerId) {
@@ -216406,7 +216523,7 @@ function isOmittableBuiltInTemplateLayerDir(templateId, layerDir) {
216406
216523
  }
216407
216524
  function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
216408
216525
  return layerDirs.flatMap((layerDir) => {
216409
- if (fs27.existsSync(layerDir)) {
216526
+ if (fs26.existsSync(layerDir)) {
216410
216527
  return [layerDir];
216411
216528
  }
216412
216529
  if (isOmittableBuiltInTemplateLayerDir(templateId, layerDir)) {
@@ -220114,7 +220231,7 @@ var init_template_source_locators = __esm(() => {
220114
220231
  });
220115
220232
 
220116
220233
  // ../wp-typia-project-tools/src/runtime/template-layers.ts
220117
- import fs28 from "fs";
220234
+ import fs27 from "fs";
220118
220235
  import path41 from "path";
220119
220236
  import { promises as fsp12 } from "fs";
220120
220237
  function resolveLayerPath(sourceRoot, relativePath) {
@@ -220164,7 +220281,7 @@ function parseLayerDefinition(layerId, value2) {
220164
220281
  }
220165
220282
  async function loadExternalTemplateLayerManifest(sourceRoot) {
220166
220283
  const manifestPath = path41.join(sourceRoot, TEMPLATE_LAYER_MANIFEST_FILENAME);
220167
- if (!fs28.existsSync(manifestPath)) {
220284
+ if (!fs27.existsSync(manifestPath)) {
220168
220285
  return null;
220169
220286
  }
220170
220287
  const raw = JSON.parse(await fsp12.readFile(manifestPath, "utf8"));
@@ -220305,7 +220422,7 @@ var init_template_layers = __esm(() => {
220305
220422
  });
220306
220423
 
220307
220424
  // ../wp-typia-project-tools/src/runtime/external-template-guards.ts
220308
- import fs29 from "fs";
220425
+ import fs28 from "fs";
220309
220426
  function parsePositiveIntegerEnv(value2, fallback) {
220310
220427
  if (typeof value2 !== "string" || value2.trim().length === 0) {
220311
220428
  return fallback;
@@ -220340,7 +220457,7 @@ function createExternalTemplateTooLargeError(label, maxBytes) {
220340
220457
  return createTemplateGuardError(TEMPLATE_SOURCE_TOO_LARGE_CODE, `${label} exceeded the external template size limit (${maxBytes} bytes).`);
220341
220458
  }
220342
220459
  function assertExternalTemplateFileSize(filePath, options) {
220343
- const stats = fs29.statSync(filePath);
220460
+ const stats = fs28.statSync(filePath);
220344
220461
  if (stats.size > options.maxBytes) {
220345
220462
  throw createExternalTemplateTooLargeError(options.label, options.maxBytes);
220346
220463
  }
@@ -220434,7 +220551,7 @@ var init_external_template_guards = __esm(() => {
220434
220551
  });
220435
220552
 
220436
220553
  // ../wp-typia-project-tools/src/runtime/template-source-external.ts
220437
- import fs30 from "fs";
220554
+ import fs29 from "fs";
220438
220555
  import { promises as fsp13 } from "fs";
220439
220556
  import path42 from "path";
220440
220557
  import { pathToFileURL } from "url";
@@ -220581,7 +220698,7 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
220581
220698
  await copyRenderedDirectory(blockTemplateDir, blockDir, view, {
220582
220699
  filter: (sourcePath, _destinationPath, entry) => {
220583
220700
  const mustacheVariantPath = path42.join(path42.dirname(sourcePath), `${entry.name}.mustache`);
220584
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs30.existsSync(mustacheVariantPath));
220701
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs29.existsSync(mustacheVariantPath));
220585
220702
  }
220586
220703
  });
220587
220704
  const assetsPath = typeof variantConfig.assetsPath === "string" ? variantConfig.assetsPath : config2.assetsPath;
@@ -220619,7 +220736,7 @@ var init_template_source_external = __esm(() => {
220619
220736
  });
220620
220737
 
220621
220738
  // ../wp-typia-project-tools/src/runtime/template-source-remote.ts
220622
- import fs31 from "fs";
220739
+ import fs30 from "fs";
220623
220740
  import { promises as fsp14 } from "fs";
220624
220741
  import path43 from "path";
220625
220742
  async function cleanupSeedRootPair(cleanup, seedCleanup) {
@@ -220706,7 +220823,7 @@ async function normalizeWpTypiaTemplateSeed(seed) {
220706
220823
  await copyRawDirectory(seed.blockDir, normalizedDir, {
220707
220824
  filter: (sourcePath, _targetPath, entry) => {
220708
220825
  const mustacheVariantPath = path43.join(path43.dirname(sourcePath), `${entry.name}.mustache`);
220709
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs31.existsSync(mustacheVariantPath));
220826
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs30.existsSync(mustacheVariantPath));
220710
220827
  }
220711
220828
  });
220712
220829
  if (seed.assetsDir && await pathExists(seed.assetsDir)) {
@@ -221378,7 +221495,7 @@ var kr, vr = (s, t2) => {
221378
221495
  s2 = s2.slice(i.length), t2 += i, e = Ys(s2);
221379
221496
  }
221380
221497
  return [t2, s2];
221381
- }, Je2, $i, Fn, kn, Xi = (s2) => Je2.reduce((t2, e) => t2.split(e).join(Fn.get(e)), s2), Ks = (s2) => $i.reduce((t2, e) => t2.split(e).join(kn.get(e)), s2), Js = (s2, t2) => t2 ? (s2 = f(s2).replace(/^\.(\/|$)/, ""), mt(t2) + "/" + s2) : f(s2), vn, Xs, qs, js, ji, Qs, fe, ti, Qi, ei, Ji, ts2, es, is, pt, ii, ss, qi, X2, de2, si, ri, Mn = (s2) => s2.isFile() ? "File" : s2.isDirectory() ? "Directory" : s2.isSymbolicLink() ? "SymbolicLink" : "Unsupported", ni, ue2 = class {
221498
+ }, Je2, $i, Fn, kn, Xi = (s2) => Je2.reduce((t2, e) => t2.split(e).join(Fn.get(e)), s2), Ks = (s2) => $i.reduce((t2, e) => t2.split(e).join(kn.get(e)), s2), Js = (s2, t2) => t2 ? (s2 = f(s2).replace(/^\.(\/|$)/, ""), mt(t2) + "/" + s2) : f(s2), vn, Xs, qs, js, ji, Qs, fe, ti, Qi, ei, Ji, ts3, es, is, pt, ii, ss, qi, X2, de2, si, ri, Mn = (s2) => s2.isFile() ? "File" : s2.isDirectory() ? "Directory" : s2.isSymbolicLink() ? "SymbolicLink" : "Unsupported", ni, ue2 = class {
221382
221499
  list;
221383
221500
  next;
221384
221501
  prev;
@@ -221424,7 +221541,7 @@ var kr, vr = (s, t2) => {
221424
221541
  }, Gn = (s3, t2) => {
221425
221542
  let e = new Et(s3);
221426
221543
  return hr(e, t2).catch((i) => e.emit("error", i)), e;
221427
- }, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs32 = (s3, t2, e) => {
221544
+ }, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs31 = (s3, t2, e) => {
221428
221545
  try {
221429
221546
  return mi.lchownSync(s3, t2, e);
221430
221547
  } catch (i) {
@@ -221469,7 +221586,7 @@ var kr, vr = (s, t2) => {
221469
221586
  Xn(s3, l, t2, e, a);
221470
221587
  });
221471
221588
  }, qn = (s3, t2, e, i) => {
221472
- t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i), fs32(Ee2.resolve(s3, t2.name), e, i);
221589
+ t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i), fs31(Ee2.resolve(s3, t2.name), e, i);
221473
221590
  }, us = (s3, t2, e) => {
221474
221591
  let i;
221475
221592
  try {
@@ -221479,12 +221596,12 @@ var kr, vr = (s, t2) => {
221479
221596
  if (n?.code === "ENOENT")
221480
221597
  return;
221481
221598
  if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP")
221482
- return fs32(s3, t2, e);
221599
+ return fs31(s3, t2, e);
221483
221600
  throw n;
221484
221601
  }
221485
221602
  for (let r of i)
221486
221603
  qn(s3, r, t2, e);
221487
- return fs32(s3, t2, e);
221604
+ return fs31(s3, t2, e);
221488
221605
  }, we2, wt, Qn = (s3, t2) => {
221489
221606
  k2.stat(s3, (e, i) => {
221490
221607
  (e || !i.isDirectory()) && (e = new we2(s3, e?.code || "ENOTDIR")), t2(e);
@@ -222894,7 +223011,7 @@ var init_index_min = __esm(() => {
222894
223011
  Qi = Symbol("lstat");
222895
223012
  ei = Symbol("onlstat");
222896
223013
  Ji = Symbol("onread");
222897
- ts2 = Symbol("onreadlink");
223014
+ ts3 = Symbol("onreadlink");
222898
223015
  es = Symbol("openfile");
222899
223016
  is = Symbol("onopenfile");
222900
223017
  pt = Symbol("close");
@@ -222997,10 +223114,10 @@ var init_index_min = __esm(() => {
222997
223114
  $2.readlink(this.absolute, (t2, e) => {
222998
223115
  if (t2)
222999
223116
  return this.emit("error", t2);
223000
- this[ts2](e);
223117
+ this[ts3](e);
223001
223118
  });
223002
223119
  }
223003
- [ts2](t2) {
223120
+ [ts3](t2) {
223004
223121
  this.linkpath = f(t2), this[fe](), this.end();
223005
223122
  }
223006
223123
  [Qs](t2) {
@@ -223091,7 +223208,7 @@ var init_index_min = __esm(() => {
223091
223208
  this[ei]($2.lstatSync(this.absolute));
223092
223209
  }
223093
223210
  [ji]() {
223094
- this[ts2]($2.readlinkSync(this.absolute));
223211
+ this[ts3]($2.readlinkSync(this.absolute));
223095
223212
  }
223096
223213
  [es]() {
223097
223214
  this[is]($2.openSync(this.absolute, "r"));
@@ -224085,10 +224202,7 @@ var init_index_min = __esm(() => {
224085
224202
  });
224086
224203
  });
224087
224204
 
224088
- // ../wp-typia-project-tools/src/runtime/template-source-cache.ts
224089
- import { createHash } from "crypto";
224090
- import fs33 from "fs";
224091
- import { promises as fsp15 } from "fs";
224205
+ // ../wp-typia-project-tools/src/runtime/template-source-cache-policy.ts
224092
224206
  import os4 from "os";
224093
224207
  import path45 from "path";
224094
224208
  function isExternalTemplateCacheEnabled(env2 = process.env) {
@@ -224145,17 +224259,38 @@ function resolveExternalTemplateCachePruneIntervalMs(options = {}) {
224145
224259
  }
224146
224260
  return parseExternalTemplateCachePruneIntervalMs(envValue);
224147
224261
  }
224148
- function createExternalTemplateCacheKey(keyParts) {
224149
- return createHash("sha256").update(JSON.stringify(keyParts)).digest("hex");
224262
+ function getExternalTemplateCacheNowMs(now) {
224263
+ const nowMs = now instanceof Date ? now.getTime() : typeof now === "number" ? now : Date.now();
224264
+ return Number.isFinite(nowMs) ? nowMs : Date.now();
224150
224265
  }
224151
- async function pathExists2(filePath) {
224266
+ function getCurrentUserCacheSegment() {
224267
+ if (typeof process.getuid === "function") {
224268
+ return String(process.getuid());
224269
+ }
224152
224270
  try {
224153
- await fsp15.access(filePath, fs33.constants.F_OK);
224154
- return true;
224271
+ const safeUsername = os4.userInfo().username.trim().replace(/[^A-Za-z0-9._-]+/gu, "-");
224272
+ return safeUsername.length > 0 ? safeUsername : "user";
224155
224273
  } catch {
224156
- return false;
224274
+ return "user";
224157
224275
  }
224158
224276
  }
224277
+ var EXTERNAL_TEMPLATE_CACHE_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE", EXTERNAL_TEMPLATE_CACHE_DIR_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_DIR", EXTERNAL_TEMPLATE_CACHE_TTL_DAYS_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_TTL_DAYS", EXTERNAL_TEMPLATE_CACHE_PRUNE_INTERVAL_MS_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_PRUNE_INTERVAL_MS", MILLISECONDS_PER_DAY, DEFAULT_CACHE_PRUNE_INTERVAL_MS, DISABLED_CACHE_VALUES;
224278
+ var init_template_source_cache_policy = __esm(() => {
224279
+ MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
224280
+ DEFAULT_CACHE_PRUNE_INTERVAL_MS = 60 * 60 * 1000;
224281
+ DISABLED_CACHE_VALUES = new Set(["0", "false", "no", "off"]);
224282
+ });
224283
+
224284
+ // ../wp-typia-project-tools/src/runtime/template-source-cache.ts
224285
+ import { createHash, randomUUID } from "crypto";
224286
+ import { promises as fsp15 } from "fs";
224287
+ import path46 from "path";
224288
+ function createTemporaryCacheEntryDirName(cacheKey) {
224289
+ return `.tmp-${cacheKey}-${process.pid}-${Date.now()}-${randomUUID()}`;
224290
+ }
224291
+ function createExternalTemplateCacheKey(keyParts) {
224292
+ return createHash("sha256").update(JSON.stringify(keyParts)).digest("hex");
224293
+ }
224159
224294
  async function isDirectoryPath(directory) {
224160
224295
  try {
224161
224296
  const stats = await fsp15.lstat(directory);
@@ -224164,25 +224299,11 @@ async function isDirectoryPath(directory) {
224164
224299
  return false;
224165
224300
  }
224166
224301
  }
224167
- function getNodeErrorCode2(error48) {
224168
- return typeof error48 === "object" && error48 !== null && "code" in error48 ? String(error48.code) : "";
224169
- }
224170
224302
  async function removeTemporaryCacheEntry(entryDir) {
224171
224303
  try {
224172
224304
  await fsp15.rm(entryDir, { force: true, recursive: true });
224173
224305
  } catch {}
224174
224306
  }
224175
- function getCurrentUserCacheSegment() {
224176
- if (typeof process.getuid === "function") {
224177
- return String(process.getuid());
224178
- }
224179
- try {
224180
- const safeUsername = os4.userInfo().username.trim().replace(/[^A-Za-z0-9._-]+/gu, "-");
224181
- return safeUsername.length > 0 ? safeUsername : "user";
224182
- } catch {
224183
- return "user";
224184
- }
224185
- }
224186
224307
  function getCurrentUid() {
224187
224308
  return typeof process.getuid === "function" ? process.getuid() : null;
224188
224309
  }
@@ -224253,9 +224374,9 @@ function resolveCacheNamespaceDir(cacheRoot, namespace) {
224253
224374
  if (namespace === "." || namespace === ".." || !SAFE_CACHE_NAMESPACE_SEGMENT.test(namespace)) {
224254
224375
  return null;
224255
224376
  }
224256
- const namespaceDir = path45.join(cacheRoot, namespace);
224257
- const relativeNamespaceDir = path45.relative(cacheRoot, namespaceDir);
224258
- if (relativeNamespaceDir.length === 0 || relativeNamespaceDir.startsWith("..") || path45.isAbsolute(relativeNamespaceDir)) {
224377
+ const namespaceDir = path46.join(cacheRoot, namespace);
224378
+ const relativeNamespaceDir = path46.relative(cacheRoot, namespaceDir);
224379
+ if (relativeNamespaceDir.length === 0 || relativeNamespaceDir.startsWith("..") || path46.isAbsolute(relativeNamespaceDir)) {
224259
224380
  return null;
224260
224381
  }
224261
224382
  return namespaceDir;
@@ -224267,18 +224388,18 @@ function getCacheEntryPaths(descriptor) {
224267
224388
  if (!namespaceDir) {
224268
224389
  return null;
224269
224390
  }
224270
- const entryDir = path45.join(namespaceDir, cacheKey);
224391
+ const entryDir = path46.join(namespaceDir, cacheKey);
224271
224392
  return {
224272
224393
  cacheKey,
224273
224394
  cacheRoot,
224274
224395
  entryDir,
224275
- markerPath: path45.join(entryDir, CACHE_MARKER_FILE),
224396
+ markerPath: path46.join(entryDir, CACHE_MARKER_FILE),
224276
224397
  namespaceDir,
224277
- sourceDir: path45.join(entryDir, "source")
224398
+ sourceDir: path46.join(entryDir, "source")
224278
224399
  };
224279
224400
  }
224280
224401
  async function isReusableCacheEntry(entryDir, markerPath, sourceDir) {
224281
- return await isPrivateCacheDirectory(entryDir) && await pathExists2(markerPath) && await isDirectoryPath(sourceDir);
224402
+ return await isPrivateCacheDirectory(entryDir) && await pathExists(markerPath) && await isDirectoryPath(sourceDir);
224282
224403
  }
224283
224404
  function parseCacheMarkerMetadata(markerText) {
224284
224405
  let marker;
@@ -224318,10 +224439,6 @@ async function readCacheEntryMarker(markerPath) {
224318
224439
  function cacheMetadataMatches(actual, expected) {
224319
224440
  return Object.entries(expected).every(([key2, value2]) => actual[key2] === value2);
224320
224441
  }
224321
- function getExternalTemplateCacheNowMs(now) {
224322
- const nowMs = now instanceof Date ? now.getTime() : typeof now === "number" ? now : Date.now();
224323
- return Number.isFinite(nowMs) ? nowMs : Date.now();
224324
- }
224325
224442
  function isCacheEntryFreshForTtl(createdAtMs, nowMs, ttlMs) {
224326
224443
  return ttlMs === null || createdAtMs >= nowMs - ttlMs;
224327
224444
  }
@@ -224336,8 +224453,8 @@ async function isReusableFreshCacheEntry(entryDir, markerPath, sourceDir, nowMs,
224336
224453
  return marker !== null && isCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs);
224337
224454
  }
224338
224455
  function isPathInsideDirectory(directory, candidatePath) {
224339
- const relativePath = path45.relative(directory, candidatePath);
224340
- return relativePath.length > 0 && !relativePath.startsWith("..") && !path45.isAbsolute(relativePath);
224456
+ const relativePath = path46.relative(directory, candidatePath);
224457
+ return relativePath.length > 0 && !relativePath.startsWith("..") && !path46.isAbsolute(relativePath);
224341
224458
  }
224342
224459
  async function removeCacheEntryWithinRoot(cacheRoot, entryDir) {
224343
224460
  if (!isPathInsideDirectory(cacheRoot, entryDir)) {
@@ -224351,7 +224468,7 @@ async function removeCacheEntryWithinRoot(cacheRoot, entryDir) {
224351
224468
  }
224352
224469
  }
224353
224470
  function getCachePruneMarkerPath(cacheRoot) {
224354
- return path45.join(cacheRoot, CACHE_PRUNE_MARKER_FILE);
224471
+ return path46.join(cacheRoot, CACHE_PRUNE_MARKER_FILE);
224355
224472
  }
224356
224473
  function parseCachePruneMarker(markerText) {
224357
224474
  let marker;
@@ -224484,14 +224601,14 @@ async function pruneExternalTemplateCache(options = {}) {
224484
224601
  result.skippedEntries += 1;
224485
224602
  continue;
224486
224603
  }
224487
- const entryDir = path45.join(namespaceDir, cacheEntry.name);
224604
+ const entryDir = path46.join(namespaceDir, cacheEntry.name);
224488
224605
  result.scannedEntries += 1;
224489
224606
  if (!isPathInsideDirectory(cacheRoot, entryDir)) {
224490
224607
  result.skippedEntries += 1;
224491
224608
  continue;
224492
224609
  }
224493
- const markerPath = path45.join(entryDir, CACHE_MARKER_FILE);
224494
- const sourceDir = path45.join(entryDir, "source");
224610
+ const markerPath = path46.join(entryDir, CACHE_MARKER_FILE);
224611
+ const sourceDir = path46.join(entryDir, "source");
224495
224612
  const marker = await getReusableCacheEntryMarker(entryDir, markerPath, sourceDir);
224496
224613
  if (!marker) {
224497
224614
  result.skippedEntries += 1;
@@ -224540,9 +224657,9 @@ async function findReusableExternalTemplateSourceCache(descriptor) {
224540
224657
  if (!entry.isDirectory()) {
224541
224658
  continue;
224542
224659
  }
224543
- const entryDir = path45.join(namespaceDir, entry.name);
224544
- const markerPath = path45.join(entryDir, CACHE_MARKER_FILE);
224545
- const sourceDir = path45.join(entryDir, "source");
224660
+ const entryDir = path46.join(namespaceDir, entry.name);
224661
+ const markerPath = path46.join(entryDir, CACHE_MARKER_FILE);
224662
+ const sourceDir = path46.join(entryDir, "source");
224546
224663
  const marker = await getReusableCacheEntryMarker(entryDir, markerPath, sourceDir);
224547
224664
  if (!marker || !isCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs) || !cacheMetadataMatches(marker.metadata, descriptor.metadata)) {
224548
224665
  continue;
@@ -224584,8 +224701,8 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
224584
224701
  if (existingMarker) {
224585
224702
  await removeCacheEntryWithinRoot(cacheRoot, entryDir);
224586
224703
  }
224587
- const temporaryEntryDir = path45.join(namespaceDir, `.tmp-${cacheKey}-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`);
224588
- const temporarySourceDir = path45.join(temporaryEntryDir, "source");
224704
+ const temporaryEntryDir = path46.join(namespaceDir, createTemporaryCacheEntryDirName(cacheKey));
224705
+ const temporarySourceDir = path46.join(temporaryEntryDir, "source");
224589
224706
  let populateFailed = false;
224590
224707
  try {
224591
224708
  await fsp15.mkdir(temporarySourceDir, {
@@ -224601,7 +224718,7 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
224601
224718
  populateFailed = true;
224602
224719
  throw error48;
224603
224720
  }
224604
- await fsp15.writeFile(path45.join(temporaryEntryDir, CACHE_MARKER_FILE), `${JSON.stringify({
224721
+ await fsp15.writeFile(path46.join(temporaryEntryDir, CACHE_MARKER_FILE), `${JSON.stringify({
224605
224722
  createdAt: new Date().toISOString(),
224606
224723
  key: cacheKey,
224607
224724
  metadata: sanitizeCacheMetadata(descriptor.metadata),
@@ -224616,12 +224733,12 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
224616
224733
  } catch (error48) {
224617
224734
  await removeTemporaryCacheEntry(temporaryEntryDir);
224618
224735
  if (populateFailed) {
224619
- if (CACHE_UNAVAILABLE_ERROR_CODES.has(getNodeErrorCode2(error48))) {
224736
+ if (CACHE_UNAVAILABLE_ERROR_CODES.has(getNodeErrorCode(error48))) {
224620
224737
  return null;
224621
224738
  }
224622
224739
  throw error48;
224623
224740
  }
224624
- const errorCode = getNodeErrorCode2(error48);
224741
+ const errorCode = getNodeErrorCode(error48);
224625
224742
  if (CACHE_PUBLISH_RACE_ERROR_CODES.has(errorCode) && await isReusableFreshCacheEntry(entryDir, markerPath, sourceDir, nowMs, ttlMs)) {
224626
224743
  return {
224627
224744
  cacheHit: true,
@@ -224634,11 +224751,11 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
224634
224751
  throw error48;
224635
224752
  }
224636
224753
  }
224637
- var EXTERNAL_TEMPLATE_CACHE_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE", EXTERNAL_TEMPLATE_CACHE_DIR_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_DIR", EXTERNAL_TEMPLATE_CACHE_TTL_DAYS_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_TTL_DAYS", EXTERNAL_TEMPLATE_CACHE_PRUNE_INTERVAL_MS_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE_PRUNE_INTERVAL_MS", CACHE_MARKER_FILE = "wp-typia-template-cache.json", CACHE_PRUNE_MARKER_FILE = "wp-typia-template-cache-prune.json", MILLISECONDS_PER_DAY, DEFAULT_CACHE_PRUNE_INTERVAL_MS, PRIVATE_CACHE_DIRECTORY_MODE = 448, REDACTED_CACHE_METADATA_VALUE = "[redacted]", DISABLED_CACHE_VALUES, CACHE_PUBLISH_RACE_ERROR_CODES, CACHE_UNAVAILABLE_ERROR_CODES, URL_LIKE_METADATA_KEY, SAFE_CACHE_NAMESPACE_SEGMENT, SAFE_CACHE_ENTRY_SEGMENT;
224754
+ var CACHE_MARKER_FILE = "wp-typia-template-cache.json", CACHE_PRUNE_MARKER_FILE = "wp-typia-template-cache-prune.json", PRIVATE_CACHE_DIRECTORY_MODE = 448, REDACTED_CACHE_METADATA_VALUE = "[redacted]", CACHE_PUBLISH_RACE_ERROR_CODES, CACHE_UNAVAILABLE_ERROR_CODES, URL_LIKE_METADATA_KEY, SAFE_CACHE_NAMESPACE_SEGMENT, SAFE_CACHE_ENTRY_SEGMENT;
224638
224755
  var init_template_source_cache = __esm(() => {
224639
- MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
224640
- DEFAULT_CACHE_PRUNE_INTERVAL_MS = 60 * 60 * 1000;
224641
- DISABLED_CACHE_VALUES = new Set(["0", "false", "no", "off"]);
224756
+ init_fs_async();
224757
+ init_template_source_cache_policy();
224758
+ init_template_source_cache_policy();
224642
224759
  CACHE_PUBLISH_RACE_ERROR_CODES = new Set(["EEXIST", "ENOTEMPTY"]);
224643
224760
  CACHE_UNAVAILABLE_ERROR_CODES = new Set([
224644
224761
  "EACCES",
@@ -224653,10 +224770,10 @@ var init_template_source_cache = __esm(() => {
224653
224770
  });
224654
224771
 
224655
224772
  // ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
224656
- import fs34 from "fs";
224773
+ import fs32 from "fs";
224657
224774
  import { promises as fsp16 } from "fs";
224658
224775
  import { createRequire as createRequire3 } from "module";
224659
- import path46 from "path";
224776
+ import path47 from "path";
224660
224777
  import { spawnSync as spawnSync3 } from "child_process";
224661
224778
  function createGitHubTemplateCacheRevisionRaceError(message) {
224662
224779
  const error48 = new Error(message);
@@ -224696,7 +224813,7 @@ async function downloadNpmTemplateTarball(locator, resolvedVersion, tarballUrl,
224696
224813
  if (!tarballResponse.ok) {
224697
224814
  throw new Error(`Failed to download npm template tarball for ${locator.raw}: ${tarballResponse.status}`);
224698
224815
  }
224699
- const tarballPath = path46.join(path46.dirname(unpackDir), "template.tgz");
224816
+ const tarballPath = path47.join(path47.dirname(unpackDir), "template.tgz");
224700
224817
  await fsp16.mkdir(unpackDir, { recursive: true });
224701
224818
  await fsp16.writeFile(tarballPath, await readBufferResponseWithLimit(tarballResponse, {
224702
224819
  label: `npm template tarball for ${locator.raw}@${resolvedVersion}`,
@@ -224802,7 +224919,7 @@ async function fetchNpmTemplateSource(locator) {
224802
224919
  }
224803
224920
  const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-source-");
224804
224921
  try {
224805
- const unpackDir = path46.join(tempRoot, "source");
224922
+ const unpackDir = path47.join(tempRoot, "source");
224806
224923
  await downloadNpmTemplateTarball(locator, resolvedVersion, tarballUrl, unpackDir);
224807
224924
  return {
224808
224925
  blockDir: unpackDir,
@@ -224818,20 +224935,20 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224818
224935
  if (locator.rawSpec !== "" && locator.rawSpec !== "*") {
224819
224936
  return null;
224820
224937
  }
224821
- const workspacePackagesRoot = path46.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
224822
- if (fs34.existsSync(workspacePackagesRoot)) {
224823
- for (const entry of fs34.readdirSync(workspacePackagesRoot, {
224938
+ const workspacePackagesRoot = path47.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
224939
+ if (fs32.existsSync(workspacePackagesRoot)) {
224940
+ for (const entry of fs32.readdirSync(workspacePackagesRoot, {
224824
224941
  withFileTypes: true
224825
224942
  })) {
224826
224943
  if (!entry.isDirectory()) {
224827
224944
  continue;
224828
224945
  }
224829
- const packageDir = path46.join(workspacePackagesRoot, entry.name);
224830
- const packageJsonPath = path46.join(packageDir, "package.json");
224831
- if (!fs34.existsSync(packageJsonPath)) {
224946
+ const packageDir = path47.join(workspacePackagesRoot, entry.name);
224947
+ const packageJsonPath = path47.join(packageDir, "package.json");
224948
+ if (!fs32.existsSync(packageJsonPath)) {
224832
224949
  continue;
224833
224950
  }
224834
- const manifest = JSON.parse(fs34.readFileSync(packageJsonPath, "utf8"));
224951
+ const manifest = JSON.parse(fs32.readFileSync(packageJsonPath, "utf8"));
224835
224952
  if (manifest.name === locator.name) {
224836
224953
  return {
224837
224954
  blockDir: packageDir,
@@ -224840,10 +224957,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224840
224957
  }
224841
224958
  }
224842
224959
  }
224843
- const workspaceRequire = createRequire3(path46.join(path46.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
224960
+ const workspaceRequire = createRequire3(path47.join(path47.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
224844
224961
  try {
224845
- const packageJsonPath = fs34.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
224846
- const sourceDir = path46.dirname(packageJsonPath);
224962
+ const packageJsonPath = fs32.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
224963
+ const sourceDir = path47.dirname(packageJsonPath);
224847
224964
  return {
224848
224965
  blockDir: sourceDir,
224849
224966
  rootDir: sourceDir
@@ -224852,11 +224969,11 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224852
224969
  const errorCode = typeof error48 === "object" && error48 !== null && "code" in error48 ? String(error48.code) : "";
224853
224970
  if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
224854
224971
  for (const basePath of workspaceRequire.resolve.paths(locator.name) ?? []) {
224855
- const packageJsonPath = path46.join(basePath, locator.name, "package.json");
224856
- if (!fs34.existsSync(packageJsonPath)) {
224972
+ const packageJsonPath = path47.join(basePath, locator.name, "package.json");
224973
+ if (!fs32.existsSync(packageJsonPath)) {
224857
224974
  continue;
224858
224975
  }
224859
- const sourceDir = path46.dirname(fs34.realpathSync(packageJsonPath));
224976
+ const sourceDir = path47.dirname(fs32.realpathSync(packageJsonPath));
224860
224977
  return {
224861
224978
  blockDir: sourceDir,
224862
224979
  rootDir: sourceDir
@@ -224868,12 +224985,12 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
224868
224985
  }
224869
224986
  }
224870
224987
  function isOfficialWorkspaceTemplateSeed(seed) {
224871
- const packageJsonPath = path46.join(seed.rootDir, "package.json");
224872
- if (!fs34.existsSync(packageJsonPath)) {
224988
+ const packageJsonPath = path47.join(seed.rootDir, "package.json");
224989
+ if (!fs32.existsSync(packageJsonPath)) {
224873
224990
  return false;
224874
224991
  }
224875
224992
  try {
224876
- const packageJson = JSON.parse(fs34.readFileSync(packageJsonPath, "utf8"));
224993
+ const packageJson = JSON.parse(fs32.readFileSync(packageJsonPath, "utf8"));
224877
224994
  return packageJson.name === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE;
224878
224995
  } catch {
224879
224996
  return false;
@@ -224888,7 +225005,7 @@ async function assertNoSymlinks2(sourceDir) {
224888
225005
  return;
224889
225006
  }
224890
225007
  for (const entry of await fsp16.readdir(sourceDir)) {
224891
- await assertNoSymlinks2(path46.join(sourceDir, entry));
225008
+ await assertNoSymlinks2(path47.join(sourceDir, entry));
224892
225009
  }
224893
225010
  }
224894
225011
  function runGitTemplateCommand(args, label, options = {}) {
@@ -224917,12 +225034,12 @@ function getGitHubTemplateRepositoryUrl(locator) {
224917
225034
  return `https://github.com/${locator.owner}/${locator.repo}.git`;
224918
225035
  }
224919
225036
  function resolveGitHubTemplateDirectory(checkoutDir, locator) {
224920
- const sourceDir = path46.resolve(checkoutDir, locator.sourcePath);
224921
- const relativeSourceDir = path46.relative(checkoutDir, sourceDir);
224922
- if (relativeSourceDir.startsWith("..") || path46.isAbsolute(relativeSourceDir)) {
225037
+ const sourceDir = path47.resolve(checkoutDir, locator.sourcePath);
225038
+ const relativeSourceDir = path47.relative(checkoutDir, sourceDir);
225039
+ if (relativeSourceDir.startsWith("..") || path47.isAbsolute(relativeSourceDir)) {
224923
225040
  throw new Error("GitHub template path must stay within the cloned repository.");
224924
225041
  }
224925
- if (!fs34.existsSync(sourceDir)) {
225042
+ if (!fs32.existsSync(sourceDir)) {
224926
225043
  throw new Error(`GitHub template path does not exist: ${locator.sourcePath}`);
224927
225044
  }
224928
225045
  return sourceDir;
@@ -225108,7 +225225,7 @@ async function resolveGitHubTemplateSource(locator) {
225108
225225
  }
225109
225226
  }
225110
225227
  const { path: remoteRoot, cleanup } = await createManagedTempRoot("wp-typia-template-source-");
225111
- const checkoutDir = path46.join(remoteRoot, "source");
225228
+ const checkoutDir = path47.join(remoteRoot, "source");
225112
225229
  try {
225113
225230
  cloneGitHubTemplateSource(locator, checkoutDir);
225114
225231
  const sourceDir = resolveGitHubTemplateDirectory(checkoutDir, locator);
@@ -225125,8 +225242,8 @@ async function resolveGitHubTemplateSource(locator) {
225125
225242
  }
225126
225243
  async function resolveTemplateSeed(locator, cwd) {
225127
225244
  if (locator.kind === "path") {
225128
- const sourceDir = path46.resolve(cwd, locator.templatePath);
225129
- if (!fs34.existsSync(sourceDir)) {
225245
+ const sourceDir = path47.resolve(cwd, locator.templatePath);
225246
+ if (!fs32.existsSync(sourceDir)) {
225130
225247
  throw new Error(`Template path does not exist: ${sourceDir}`);
225131
225248
  }
225132
225249
  await assertNoSymlinks2(sourceDir);
@@ -225162,8 +225279,8 @@ var init_template_source_seeds = __esm(() => {
225162
225279
  });
225163
225280
 
225164
225281
  // ../wp-typia-project-tools/src/runtime/cli-validation.ts
225165
- import fs35 from "fs";
225166
- import path47 from "path";
225282
+ import fs33 from "fs";
225283
+ import path48 from "path";
225167
225284
  function normalizeOptionalCliString(value2) {
225168
225285
  if (typeof value2 !== "string") {
225169
225286
  return;
@@ -225172,15 +225289,15 @@ function normalizeOptionalCliString(value2) {
225172
225289
  return trimmed.length > 0 ? trimmed : undefined;
225173
225290
  }
225174
225291
  function looksLikeLocalCliPath(value2) {
225175
- return path47.isAbsolute(value2) || value2.startsWith("./") || value2.startsWith("../") || value2.startsWith(".\\") || value2.startsWith("..\\");
225292
+ return path48.isAbsolute(value2) || value2.startsWith("./") || value2.startsWith("../") || value2.startsWith(".\\") || value2.startsWith("..\\");
225176
225293
  }
225177
225294
  function resolveLocalCliPathOption(options) {
225178
225295
  const normalizedValue = normalizeOptionalCliString(options.value);
225179
225296
  if (!normalizedValue || !looksLikeLocalCliPath(normalizedValue)) {
225180
225297
  return normalizedValue;
225181
225298
  }
225182
- const resolvedPath = path47.resolve(options.cwd, normalizedValue);
225183
- if (!fs35.existsSync(resolvedPath)) {
225299
+ const resolvedPath = path48.resolve(options.cwd, normalizedValue);
225300
+ if (!fs33.existsSync(resolvedPath)) {
225184
225301
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `\`${options.label}\` path does not exist: ${resolvedPath}. Check the path relative to ${options.cwd}.`);
225185
225302
  }
225186
225303
  return resolvedPath;
@@ -226134,8 +226251,42 @@ var init_block_generator_service_spec = __esm(() => {
226134
226251
  ];
226135
226252
  });
226136
226253
 
226254
+ // ../wp-typia-project-tools/src/runtime/scaffold-template-assertions.ts
226255
+ function assertOptionalStringPattern(view, key2, pattern, description) {
226256
+ const value2 = view[key2];
226257
+ if (typeof value2 === "undefined") {
226258
+ return;
226259
+ }
226260
+ if (typeof value2 !== "string" || !pattern.test(value2)) {
226261
+ throw new Error(`Unsafe scaffold template variable "${key2}" for ${description}: ${JSON.stringify(value2)}.`);
226262
+ }
226263
+ }
226264
+ function assertScaffoldTemplateCodeIdentifiers(view) {
226265
+ assertOptionalStringPattern(view, "namespace", BLOCK_SLUG_PATTERN2, "block namespace");
226266
+ assertOptionalStringPattern(view, "slug", BLOCK_SLUG_PATTERN2, "block slug");
226267
+ assertOptionalStringPattern(view, "slugKebabCase", BLOCK_SLUG_PATTERN2, "block slug");
226268
+ assertOptionalStringPattern(view, "textDomain", BLOCK_SLUG_PATTERN2, "text domain");
226269
+ assertOptionalStringPattern(view, "textdomain", BLOCK_SLUG_PATTERN2, "text domain");
226270
+ assertOptionalStringPattern(view, "queryPostType", QUERY_POST_TYPE_PATTERN, "query post type");
226271
+ assertOptionalStringPattern(view, "phpPrefix", PHP_IDENTIFIER_PATTERN, "PHP identifier");
226272
+ assertOptionalStringPattern(view, "slugSnakeCase", PHP_IDENTIFIER_PATTERN, "PHP identifier");
226273
+ assertOptionalStringPattern(view, "phpPrefixUpper", PHP_CONSTANT_IDENTIFIER_PATTERN, "PHP constant identifier");
226274
+ assertOptionalStringPattern(view, "pascalCase", JAVASCRIPT_IDENTIFIER_PATTERN, "JavaScript identifier");
226275
+ assertOptionalStringPattern(view, "slugCamelCase", JAVASCRIPT_IDENTIFIER_PATTERN, "JavaScript identifier");
226276
+ assertOptionalStringPattern(view, "titleCase", JAVASCRIPT_IDENTIFIER_PATTERN, "JavaScript identifier");
226277
+ }
226278
+ var BLOCK_SLUG_PATTERN2, PHP_IDENTIFIER_PATTERN, PHP_CONSTANT_IDENTIFIER_PATTERN, JAVASCRIPT_IDENTIFIER_PATTERN, QUERY_POST_TYPE_PATTERN;
226279
+ var init_scaffold_template_assertions = __esm(() => {
226280
+ BLOCK_SLUG_PATTERN2 = /^[a-z][a-z0-9-]*$/u;
226281
+ PHP_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_]*$/u;
226282
+ PHP_CONSTANT_IDENTIFIER_PATTERN = /^[A-Z_][A-Z0-9_]*$/u;
226283
+ JAVASCRIPT_IDENTIFIER_PATTERN = /^[A-Za-z_$][\w$]*$/u;
226284
+ QUERY_POST_TYPE_PATTERN = /^[a-z0-9_-]{1,20}$/u;
226285
+ });
226286
+
226137
226287
  // ../wp-typia-project-tools/src/runtime/built-in-block-non-ts-render-utils.ts
226138
226288
  function renderArtifact(relativePath, template, view) {
226289
+ assertScaffoldTemplateCodeIdentifiers(view);
226139
226290
  const source = renderMustacheTemplateString(template, view);
226140
226291
  return {
226141
226292
  relativePath,
@@ -226166,6 +226317,7 @@ function toPhpSingleQuotedString(value2) {
226166
226317
  return `'${value2.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
226167
226318
  }
226168
226319
  var init_built_in_block_non_ts_render_utils = __esm(() => {
226320
+ init_scaffold_template_assertions();
226169
226321
  init_template_render();
226170
226322
  });
226171
226323
 
@@ -226184,7 +226336,8 @@ function buildInteractivityArtifacts(variables) {
226184
226336
  ];
226185
226337
  }
226186
226338
  function buildPersistenceArtifacts(variables) {
226187
- if (variables.hasAlternateRenderTargets !== "true") {
226339
+ const alternateRenderTargets = getScaffoldAlternateRenderTargets(variables);
226340
+ if (!alternateRenderTargets.enabled) {
226188
226341
  return [
226189
226342
  renderArtifact("src/style.scss", PERSISTENCE_STYLE_TEMPLATE, variables),
226190
226343
  renderArtifact("src/render.php", PERSISTENCE_RENDER_TEMPLATE, variables)
@@ -226195,35 +226348,36 @@ function buildPersistenceArtifacts(variables) {
226195
226348
  renderArtifact("src/render-targets.php", PERSISTENCE_RENDER_TARGETS_TEMPLATE, variables),
226196
226349
  buildAlternateRenderEntryArtifact("src/render.php", "web", variables)
226197
226350
  ];
226198
- if (variables.hasAlternateEmailRenderTarget === "true") {
226351
+ if (alternateRenderTargets.hasEmail) {
226199
226352
  artifacts.push(buildAlternateRenderEntryArtifact("src/render-email.php", "email", variables));
226200
226353
  }
226201
- if (variables.hasAlternateMjmlRenderTarget === "true") {
226354
+ if (alternateRenderTargets.hasMjml) {
226202
226355
  artifacts.push(buildAlternateRenderEntryArtifact("src/render-mjml.php", "mjml", variables));
226203
226356
  }
226204
- if (variables.hasAlternatePlainTextRenderTarget === "true") {
226357
+ if (alternateRenderTargets.hasPlainText) {
226205
226358
  artifacts.push(buildAlternateRenderEntryArtifact("src/render-text.php", "plain-text", variables));
226206
226359
  }
226207
226360
  return artifacts;
226208
226361
  }
226209
226362
  function buildCompoundArtifacts(variables) {
226363
+ const alternateRenderTargets = getScaffoldAlternateRenderTargets(variables);
226210
226364
  const artifacts = [
226211
226365
  renderArtifact(`src/blocks/${variables.slugKebabCase}/style.scss`, COMPOUND_STYLE_TEMPLATE, variables)
226212
226366
  ];
226213
- if (variables.compoundPersistenceEnabled === "true") {
226367
+ if (isCompoundPersistenceEnabled(variables)) {
226214
226368
  const renderView = {
226215
226369
  ...variables,
226216
226370
  titlePhpLiteral: toPhpSingleQuotedString(variables.title)
226217
226371
  };
226218
- if (variables.hasAlternateRenderTargets === "true") {
226372
+ if (alternateRenderTargets.enabled) {
226219
226373
  artifacts.push(renderArtifact(`src/blocks/${variables.slugKebabCase}/render-targets.php`, COMPOUND_PERSISTENCE_RENDER_TARGETS_TEMPLATE, renderView), buildAlternateRenderEntryArtifact(`src/blocks/${variables.slugKebabCase}/render.php`, "web", variables));
226220
- if (variables.hasAlternateEmailRenderTarget === "true") {
226374
+ if (alternateRenderTargets.hasEmail) {
226221
226375
  artifacts.push(buildAlternateRenderEntryArtifact(`src/blocks/${variables.slugKebabCase}/render-email.php`, "email", variables));
226222
226376
  }
226223
- if (variables.hasAlternateMjmlRenderTarget === "true") {
226377
+ if (alternateRenderTargets.hasMjml) {
226224
226378
  artifacts.push(buildAlternateRenderEntryArtifact(`src/blocks/${variables.slugKebabCase}/render-mjml.php`, "mjml", variables));
226225
226379
  }
226226
- if (variables.hasAlternatePlainTextRenderTarget === "true") {
226380
+ if (alternateRenderTargets.hasPlainText) {
226227
226381
  artifacts.push(buildAlternateRenderEntryArtifact(`src/blocks/${variables.slugKebabCase}/render-text.php`, "plain-text", variables));
226228
226382
  }
226229
226383
  return artifacts;
@@ -227173,6 +227327,7 @@ if ( ! function_exists( '{{phpPrefix}}_{{slugSnakeCase}}_render_target' ) ) {
227173
227327
  `;
227174
227328
  var init_built_in_block_non_ts_family_artifacts = __esm(() => {
227175
227329
  init_built_in_block_non_ts_render_utils();
227330
+ init_scaffold_template_variable_groups();
227176
227331
  });
227177
227332
 
227178
227333
  // ../wp-typia-project-tools/src/runtime/built-in-block-non-ts-artifacts.ts
@@ -229875,6 +230030,7 @@ var init_built_in_block_code_templates = __esm(() => {
229875
230030
 
229876
230031
  // ../wp-typia-project-tools/src/runtime/built-in-block-code-artifacts.ts
229877
230032
  function renderCodeTemplate(template, variables) {
230033
+ assertScaffoldTemplateCodeIdentifiers(variables);
229878
230034
  const rendered = renderMustacheTemplateString(template, variables);
229879
230035
  return rendered.endsWith(`
229880
230036
  `) ? rendered : `${rendered}
@@ -230070,6 +230226,7 @@ var init_built_in_block_code_artifacts = __esm(() => {
230070
230226
  init_built_in_block_non_ts_artifacts();
230071
230227
  init_built_in_block_code_templates();
230072
230228
  init_scaffold_template_variable_groups();
230229
+ init_scaffold_template_assertions();
230073
230230
  init_template_render();
230074
230231
  });
230075
230232
 
@@ -230562,66 +230719,23 @@ var init_scaffold_template_variables = __esm(() => {
230562
230719
  init_scaffold_compatibility();
230563
230720
  });
230564
230721
 
230565
- // ../wp-typia-project-tools/src/runtime/scaffold-answer-resolution.ts
230566
- import { execSync as execSync4 } from "child_process";
230567
- import path48 from "path";
230568
- function detectAuthor() {
230569
- try {
230570
- return execSync4("git config user.name", {
230571
- encoding: "utf8",
230572
- stdio: ["ignore", "pipe", "ignore"]
230573
- }).trim() || "Your Name";
230574
- } catch {
230575
- return "Your Name";
230576
- }
230577
- }
230578
- function getDefaultAnswers(projectName, templateId) {
230579
- const template = isBuiltInTemplateId(templateId) ? getTemplateById(templateId) : null;
230580
- const slugDefault = normalizeBlockSlug(projectName) || "my-wp-typia-block";
230581
- return {
230582
- author: detectAuthor(),
230583
- dataStorageMode: templateId === "persistence" ? "custom-table" : undefined,
230584
- description: template?.description ?? "A WordPress block scaffolded from a remote template",
230585
- namespace: slugDefault,
230586
- persistencePolicy: templateId === "persistence" ? "authenticated" : undefined,
230587
- phpPrefix: toSnakeCase(slugDefault),
230588
- queryPostType: templateId === "query-loop" ? "post" : undefined,
230589
- slug: slugDefault,
230590
- textDomain: slugDefault,
230591
- title: toTitleCase(slugDefault)
230592
- };
230593
- }
230594
- function validateQueryPostType(value2) {
230595
- const rawValue2 = value2.trim();
230596
- const normalizedValue = rawValue2.toLowerCase();
230597
- if (normalizedValue.length === 0) {
230598
- return "Query post type is required.";
230599
- }
230600
- if (!/^[a-z0-9_-]{1,20}$/u.test(normalizedValue)) {
230601
- return rawValue2 === normalizedValue ? `Query post type "${rawValue2}" is invalid. ${QUERY_POST_TYPE_RULE}` : `Query post type "${rawValue2}" normalizes to "${normalizedValue}", which is invalid. ${QUERY_POST_TYPE_RULE}`;
230602
- }
230603
- return true;
230604
- }
230605
- function normalizeQueryPostType(value2) {
230606
- if (typeof value2 !== "string") {
230607
- return;
230608
- }
230609
- const validationResult = validateQueryPostType(value2);
230610
- if (validationResult !== true) {
230611
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, validationResult);
230612
- }
230613
- return value2.trim().toLowerCase();
230614
- }
230615
- function normalizeTemplateSelection(templateId) {
230616
- return templateId === WORKSPACE_TEMPLATE_ALIAS ? OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE : templateId;
230722
+ // ../wp-typia-project-tools/src/runtime/create-template-validation.ts
230723
+ var exports_create_template_validation = {};
230724
+ __export(exports_create_template_validation, {
230725
+ validateExplicitCreateTemplateId: () => validateExplicitCreateTemplateId,
230726
+ CREATE_TEMPLATE_SELECTION_HINT: () => CREATE_TEMPLATE_SELECTION_HINT
230727
+ });
230728
+ import path49 from "path";
230729
+ function normalizeCreateTemplateSelection(templateId) {
230730
+ return templateId === OFFICIAL_WORKSPACE_TEMPLATE_ALIAS ? OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE : templateId;
230617
230731
  }
230618
230732
  function looksLikeWindowsAbsoluteTemplatePath(templateId) {
230619
230733
  return /^[a-z]:[\\/]/iu.test(templateId) || /^\\\\[^\\]+\\[^\\]+/u.test(templateId);
230620
230734
  }
230621
230735
  function looksLikeExplicitNonNpmExternalTemplateLocator(templateId) {
230622
- return path48.isAbsolute(templateId) || looksLikeWindowsAbsoluteTemplatePath(templateId) || templateId.startsWith("./") || templateId.startsWith("../") || templateId.startsWith("@") || templateId.startsWith("github:") || templateId.includes("/");
230736
+ return path49.isAbsolute(templateId) || looksLikeWindowsAbsoluteTemplatePath(templateId) || templateId.startsWith("./") || templateId.startsWith(".\\") || templateId.startsWith("../") || templateId.startsWith("..\\") || templateId.startsWith("@") || templateId.startsWith("github:") || templateId.includes("/") || templateId.includes("\\");
230623
230737
  }
230624
- function looksLikeExplicitExternalTemplateLocator(templateId) {
230738
+ function looksLikeExplicitCreateExternalTemplateLocator(templateId) {
230625
230739
  return looksLikeExplicitNonNpmExternalTemplateLocator(templateId) || parseNpmTemplateLocator(templateId) !== null;
230626
230740
  }
230627
230741
  function getEditDistance(left, right) {
@@ -230661,7 +230775,7 @@ function getMistypedBuiltInTemplateMessage(templateId) {
230661
230775
  if (!suggestion) {
230662
230776
  return null;
230663
230777
  }
230664
- const suggestionDescription = suggestion === WORKSPACE_TEMPLATE_ALIAS ? "official workspace scaffold" : "built-in scaffold";
230778
+ const suggestionDescription = suggestion === OFFICIAL_WORKSPACE_TEMPLATE_ALIAS ? "official workspace scaffold" : "built-in scaffold";
230665
230779
  return `Unknown template "${templateId}". Did you mean "${suggestion}"? Use \`--template ${suggestion}\` for the ${suggestionDescription}, or pass a local path, \`github:owner/repo/path[#ref]\`, or an npm package spec for an external template.`;
230666
230780
  }
230667
230781
  function getUnknownTemplateMessage(templateId) {
@@ -230671,6 +230785,95 @@ function getUnknownTemplateMessage(templateId) {
230671
230785
  "Pass an explicit external template locator such as `./path`, `github:owner/repo/path[#ref]`, or `@scope/template` for custom templates."
230672
230786
  ].join(" ");
230673
230787
  }
230788
+ function validateExplicitCreateTemplateId(templateId) {
230789
+ const normalizedTemplateId = normalizeCreateTemplateSelection(templateId);
230790
+ if (isRemovedBuiltInTemplateId(templateId)) {
230791
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getRemovedBuiltInTemplateMessage(templateId));
230792
+ }
230793
+ if (normalizedTemplateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE) {
230794
+ return normalizedTemplateId;
230795
+ }
230796
+ if (isBuiltInTemplateId(normalizedTemplateId)) {
230797
+ return getTemplateById(normalizedTemplateId).id;
230798
+ }
230799
+ const mistypedBuiltInTemplateMessage = getMistypedBuiltInTemplateMessage(templateId);
230800
+ if (mistypedBuiltInTemplateMessage) {
230801
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, mistypedBuiltInTemplateMessage);
230802
+ }
230803
+ if (!looksLikeExplicitCreateExternalTemplateLocator(normalizedTemplateId)) {
230804
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getUnknownTemplateMessage(templateId));
230805
+ }
230806
+ return normalizedTemplateId;
230807
+ }
230808
+ var CREATE_TEMPLATE_SELECTION_HINT, TEMPLATE_SUGGESTION_IDS, USER_FACING_TEMPLATE_IDS2;
230809
+ var init_create_template_validation = __esm(() => {
230810
+ init_cli_diagnostics();
230811
+ init_template_registry();
230812
+ init_template_defaults();
230813
+ init_template_source_locators();
230814
+ CREATE_TEMPLATE_SELECTION_HINT = `--template <${[
230815
+ ...TEMPLATE_IDS,
230816
+ OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
230817
+ ].join("|")}|./path|github:owner/repo/path[#ref]|npm-package>`;
230818
+ TEMPLATE_SUGGESTION_IDS = [
230819
+ ...TEMPLATE_IDS,
230820
+ OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
230821
+ ];
230822
+ USER_FACING_TEMPLATE_IDS2 = [
230823
+ ...TEMPLATE_IDS,
230824
+ OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
230825
+ ];
230826
+ });
230827
+
230828
+ // ../wp-typia-project-tools/src/runtime/scaffold-answer-resolution.ts
230829
+ import { execSync as execSync4 } from "child_process";
230830
+ function detectAuthor() {
230831
+ try {
230832
+ return execSync4("git config user.name", {
230833
+ encoding: "utf8",
230834
+ stdio: ["ignore", "pipe", "ignore"]
230835
+ }).trim() || "Your Name";
230836
+ } catch {
230837
+ return "Your Name";
230838
+ }
230839
+ }
230840
+ function getDefaultAnswers(projectName, templateId) {
230841
+ const template = isBuiltInTemplateId(templateId) ? getTemplateById(templateId) : null;
230842
+ const slugDefault = normalizeBlockSlug(projectName) || "my-wp-typia-block";
230843
+ return {
230844
+ author: detectAuthor(),
230845
+ dataStorageMode: templateId === "persistence" ? "custom-table" : undefined,
230846
+ description: template?.description ?? "A WordPress block scaffolded from a remote template",
230847
+ namespace: slugDefault,
230848
+ persistencePolicy: templateId === "persistence" ? "authenticated" : undefined,
230849
+ phpPrefix: toSnakeCase(slugDefault),
230850
+ queryPostType: templateId === "query-loop" ? "post" : undefined,
230851
+ slug: slugDefault,
230852
+ textDomain: slugDefault,
230853
+ title: toTitleCase(slugDefault)
230854
+ };
230855
+ }
230856
+ function validateQueryPostType(value2) {
230857
+ const rawValue2 = value2.trim();
230858
+ const normalizedValue = rawValue2.toLowerCase();
230859
+ if (normalizedValue.length === 0) {
230860
+ return "Query post type is required.";
230861
+ }
230862
+ if (!/^[a-z0-9_-]{1,20}$/u.test(normalizedValue)) {
230863
+ return rawValue2 === normalizedValue ? `Query post type "${rawValue2}" is invalid. ${QUERY_POST_TYPE_RULE}` : `Query post type "${rawValue2}" normalizes to "${normalizedValue}", which is invalid. ${QUERY_POST_TYPE_RULE}`;
230864
+ }
230865
+ return true;
230866
+ }
230867
+ function normalizeQueryPostType(value2) {
230868
+ if (typeof value2 !== "string") {
230869
+ return;
230870
+ }
230871
+ const validationResult = validateQueryPostType(value2);
230872
+ if (validationResult !== true) {
230873
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, validationResult);
230874
+ }
230875
+ return value2.trim().toLowerCase();
230876
+ }
230674
230877
  async function resolveTemplateId({
230675
230878
  templateId,
230676
230879
  yes = false,
@@ -230678,32 +230881,15 @@ async function resolveTemplateId({
230678
230881
  selectTemplate
230679
230882
  }) {
230680
230883
  if (templateId) {
230681
- const normalizedTemplateId = normalizeTemplateSelection(templateId);
230682
- if (isRemovedBuiltInTemplateId(templateId)) {
230683
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getRemovedBuiltInTemplateMessage(templateId));
230684
- }
230685
- if (normalizedTemplateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE) {
230686
- return normalizedTemplateId;
230687
- }
230688
- if (isBuiltInTemplateId(normalizedTemplateId)) {
230689
- return getTemplateById(normalizedTemplateId).id;
230690
- }
230691
- const mistypedBuiltInTemplateMessage = getMistypedBuiltInTemplateMessage(templateId);
230692
- if (mistypedBuiltInTemplateMessage) {
230693
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, mistypedBuiltInTemplateMessage);
230694
- }
230695
- if (!looksLikeExplicitExternalTemplateLocator(normalizedTemplateId)) {
230696
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getUnknownTemplateMessage(templateId));
230697
- }
230698
- return normalizedTemplateId;
230884
+ return validateExplicitCreateTemplateId(templateId);
230699
230885
  }
230700
230886
  if (yes) {
230701
230887
  return "basic";
230702
230888
  }
230703
230889
  if (!isInteractive || !selectTemplate) {
230704
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `Template is required in non-interactive mode. Use ${TEMPLATE_SELECTION_HINT}.`);
230890
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `Template is required in non-interactive mode. Use ${CREATE_TEMPLATE_SELECTION_HINT}.`);
230705
230891
  }
230706
- return normalizeTemplateSelection(await selectTemplate());
230892
+ return validateExplicitCreateTemplateId(await selectTemplate());
230707
230893
  }
230708
230894
  async function resolvePackageManagerId({
230709
230895
  packageManager,
@@ -230774,37 +230960,27 @@ async function collectScaffoldAnswers({
230774
230960
  title: await promptText("Block title", toTitleCase(identifiers.slug))
230775
230961
  };
230776
230962
  }
230777
- var WORKSPACE_TEMPLATE_ALIAS = "workspace", TEMPLATE_SELECTION_HINT, TEMPLATE_SUGGESTION_IDS, QUERY_POST_TYPE_RULE = 'Use lowercase, 1-20 chars, and only a-z, 0-9, "_" or "-".', USER_FACING_TEMPLATE_IDS2;
230963
+ var QUERY_POST_TYPE_RULE = 'Use lowercase, 1-20 chars, and only a-z, 0-9, "_" or "-".';
230778
230964
  var init_scaffold_answer_resolution = __esm(() => {
230779
230965
  init_package_managers();
230780
230966
  init_scaffold_identifiers();
230781
230967
  init_cli_diagnostics();
230782
230968
  init_template_registry();
230783
- init_template_defaults();
230784
- init_template_source_locators();
230969
+ init_create_template_validation();
230785
230970
  init_string_case();
230786
- TEMPLATE_SELECTION_HINT = `--template <${[
230787
- ...TEMPLATE_IDS,
230788
- WORKSPACE_TEMPLATE_ALIAS
230789
- ].join("|")}|./path|github:owner/repo/path[#ref]|npm-package>`;
230790
- TEMPLATE_SUGGESTION_IDS = [...TEMPLATE_IDS, WORKSPACE_TEMPLATE_ALIAS];
230791
- USER_FACING_TEMPLATE_IDS2 = [
230792
- ...TEMPLATE_IDS,
230793
- WORKSPACE_TEMPLATE_ALIAS
230794
- ];
230795
230971
  });
230796
230972
 
230797
230973
  // ../wp-typia-project-tools/src/runtime/scaffold.ts
230798
- import fs36 from "fs";
230974
+ import fs34 from "fs";
230799
230975
  import { promises as fsp17 } from "fs";
230800
- import path49 from "path";
230976
+ import path50 from "path";
230801
230977
  function isDataStorageMode(value2) {
230802
230978
  return DATA_STORAGE_MODES.includes(value2);
230803
230979
  }
230804
230980
  function isPersistencePolicy(value2) {
230805
230981
  return PERSISTENCE_POLICIES.includes(value2);
230806
230982
  }
230807
- function normalizeTemplateSelection2(templateId) {
230983
+ function normalizeTemplateSelection(templateId) {
230808
230984
  return normalizeTemplateLookupId(templateId);
230809
230985
  }
230810
230986
  async function reportScaffoldProgress2(onProgress, event) {
@@ -230832,7 +231008,7 @@ async function scaffoldProject({
230832
231008
  withTestPreset = false,
230833
231009
  withWpEnv = false
230834
231010
  }) {
230835
- const resolvedTemplateId = normalizeTemplateSelection2(templateId);
231011
+ const resolvedTemplateId = normalizeTemplateSelection(templateId);
230836
231012
  const resolvedPackageManager = getPackageManager(packageManager).id;
230837
231013
  const isBuiltInTemplate = isBuiltInTemplateId(resolvedTemplateId);
230838
231014
  assertExternalLayerCompositionOptions({
@@ -230943,16 +231119,16 @@ async function scaffoldProject({
230943
231119
  phase: "finalize-project",
230944
231120
  title: "Finalizing scaffold output"
230945
231121
  });
230946
- const readmePath = path49.join(projectDir, "README.md");
230947
- if (!fs36.existsSync(readmePath)) {
231122
+ const readmePath = path50.join(projectDir, "README.md");
231123
+ if (!fs34.existsSync(readmePath)) {
230948
231124
  await fsp17.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
230949
231125
  withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
230950
231126
  withTestPreset: isBuiltInTemplate ? withTestPreset : false,
230951
231127
  withWpEnv: isBuiltInTemplate ? withWpEnv : false
230952
231128
  }), "utf8");
230953
231129
  }
230954
- const gitignorePath = path49.join(projectDir, ".gitignore");
230955
- const existingGitignore = fs36.existsSync(gitignorePath) ? await fsp17.readFile(gitignorePath, "utf8") : "";
231130
+ const gitignorePath = path50.join(projectDir, ".gitignore");
231131
+ const existingGitignore = fs34.existsSync(gitignorePath) ? await fsp17.readFile(gitignorePath, "utf8") : "";
230956
231132
  await fsp17.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
230957
231133
  await normalizePackageJson(projectDir, resolvedPackageManager);
230958
231134
  if (isBuiltInTemplate) {
@@ -231016,9 +231192,9 @@ var init_scaffold = __esm(() => {
231016
231192
  });
231017
231193
 
231018
231194
  // ../wp-typia-project-tools/src/runtime/cli-add-block-config.ts
231019
- import path50 from "path";
231195
+ import path51 from "path";
231020
231196
  function buildServerTemplateRoot(persistencePolicy) {
231021
- return path50.join(SHARED_WORKSPACE_TEMPLATE_ROOT, persistencePolicy === "public" ? "persistence-public" : "persistence-auth");
231197
+ return path51.join(SHARED_WORKSPACE_TEMPLATE_ROOT, persistencePolicy === "public" ? "persistence-public" : "persistence-auth");
231022
231198
  }
231023
231199
  function buildSingleBlockConfigEntry(variables) {
231024
231200
  return [
@@ -231117,7 +231293,7 @@ function buildConfigEntries(templateId, variables) {
231117
231293
  if (templateId === "persistence") {
231118
231294
  return [buildPersistenceBlockConfigEntry(variables)];
231119
231295
  }
231120
- if (variables.compoundPersistenceEnabled === "true") {
231296
+ if (isCompoundPersistenceEnabled(variables)) {
231121
231297
  return [
231122
231298
  buildPersistenceBlockConfigEntry(variables),
231123
231299
  buildCompoundChildConfigEntry(variables)
@@ -231162,13 +231338,14 @@ function buildMigrationBlocks2(templateId, variables) {
231162
231338
  }
231163
231339
  var init_cli_add_block_config = __esm(() => {
231164
231340
  init_template_registry();
231341
+ init_scaffold_template_variable_groups();
231165
231342
  init_cli_add_shared();
231166
231343
  });
231167
231344
 
231168
231345
  // ../wp-typia-project-tools/src/runtime/cli-add-block-legacy-validator.ts
231169
- import fs37 from "fs";
231346
+ import fs35 from "fs";
231170
231347
  import { promises as fsp18 } from "fs";
231171
- import path51 from "path";
231348
+ import path52 from "path";
231172
231349
  function ensureBlockConfigCanAddRestManifests(source) {
231173
231350
  const importLine = "import { defineEndpointManifest } from '@wp-typia/block-runtime/metadata-core';";
231174
231351
  if (REST_MANIFEST_IMPORT_PATTERN.test(source)) {
@@ -231270,22 +231447,22 @@ function renderLegacyManifestDefaultsWrapperSource() {
231270
231447
  `);
231271
231448
  }
231272
231449
  async function ensureLegacyCompoundValidatorManifestDefaultsWrapper(validatorPath) {
231273
- const validatorDir = path51.dirname(validatorPath);
231274
- const wrapperPath = path51.join(validatorDir, "manifest-defaults-document.ts");
231275
- const manifestPath = path51.join(validatorDir, "typia.manifest.json");
231276
- if (fs37.existsSync(wrapperPath) || !fs37.existsSync(manifestPath)) {
231450
+ const validatorDir = path52.dirname(validatorPath);
231451
+ const wrapperPath = path52.join(validatorDir, "manifest-defaults-document.ts");
231452
+ const manifestPath = path52.join(validatorDir, "typia.manifest.json");
231453
+ if (fs35.existsSync(wrapperPath) || !fs35.existsSync(manifestPath)) {
231277
231454
  return;
231278
231455
  }
231279
231456
  await fsp18.writeFile(wrapperPath, renderLegacyManifestDefaultsWrapperSource(), "utf8");
231280
231457
  }
231281
231458
  async function collectLegacyCompoundValidatorPaths(projectDir) {
231282
- const blocksDir = path51.join(projectDir, "src", "blocks");
231283
- if (!fs37.existsSync(blocksDir)) {
231459
+ const blocksDir = path52.join(projectDir, "src", "blocks");
231460
+ if (!fs35.existsSync(blocksDir)) {
231284
231461
  return [];
231285
231462
  }
231286
231463
  const blockEntries = await fsp18.readdir(blocksDir, { withFileTypes: true });
231287
231464
  const validatorPaths = await Promise.all(blockEntries.filter((entry) => entry.isDirectory()).map(async (entry) => {
231288
- const validatorPath = path51.join(blocksDir, entry.name, "validators.ts");
231465
+ const validatorPath = path52.join(blocksDir, entry.name, "validators.ts");
231289
231466
  const validatorSource = await readOptionalFile(validatorPath);
231290
231467
  return isLegacyCompoundValidatorSource(validatorSource) ? validatorPath : null;
231291
231468
  }));
@@ -231293,14 +231470,14 @@ async function collectLegacyCompoundValidatorPaths(projectDir) {
231293
231470
  }
231294
231471
  async function ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths) {
231295
231472
  for (const fileName of COMPOUND_SHARED_SUPPORT_FILES) {
231296
- const sourcePath = path51.join(tempProjectDir, "src", fileName);
231297
- if (!fs37.existsSync(sourcePath)) {
231473
+ const sourcePath = path52.join(tempProjectDir, "src", fileName);
231474
+ if (!fs35.existsSync(sourcePath)) {
231298
231475
  continue;
231299
231476
  }
231300
- const targetPath = path51.join(projectDir, "src", fileName);
231477
+ const targetPath = path52.join(projectDir, "src", fileName);
231301
231478
  const currentSource = await readOptionalFile(targetPath);
231302
231479
  if (fileName === "validator-toolkit.ts" ? shouldRefreshCompoundValidatorToolkit(currentSource) : currentSource === null) {
231303
- await fsp18.mkdir(path51.dirname(targetPath), { recursive: true });
231480
+ await fsp18.mkdir(path52.dirname(targetPath), { recursive: true });
231304
231481
  await fsp18.copyFile(sourcePath, targetPath);
231305
231482
  }
231306
231483
  }
@@ -231385,7 +231562,7 @@ var init_external_layer_selection = __esm(() => {
231385
231562
 
231386
231563
  // ../wp-typia-project-tools/src/runtime/cli-add-block.ts
231387
231564
  import { promises as fsp19 } from "fs";
231388
- import path52 from "path";
231565
+ import path53 from "path";
231389
231566
  import {
231390
231567
  syncBlockMetadata
231391
231568
  } from "@wp-typia/block-runtime/metadata-core";
@@ -231407,16 +231584,16 @@ ${source}`;
231407
231584
  });
231408
231585
  }
231409
231586
  async function copyTempDirectory(sourceDir, targetDir) {
231410
- await fsp19.mkdir(path52.dirname(targetDir), { recursive: true });
231587
+ await fsp19.mkdir(path53.dirname(targetDir), { recursive: true });
231411
231588
  await fsp19.cp(sourceDir, targetDir, { recursive: true });
231412
231589
  }
231413
231590
  async function addCollectionImportsForTemplate(projectDir, templateId, variables) {
231414
231591
  if (templateId === "compound") {
231415
- await ensureCollectionImport(path52.join(projectDir, "src", "blocks", variables.slugKebabCase, "index.tsx"));
231416
- await ensureCollectionImport(path52.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`, "index.tsx"));
231592
+ await ensureCollectionImport(path53.join(projectDir, "src", "blocks", variables.slugKebabCase, "index.tsx"));
231593
+ await ensureCollectionImport(path53.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`, "index.tsx"));
231417
231594
  return;
231418
231595
  }
231419
- await ensureCollectionImport(path52.join(projectDir, "src", "blocks", variables.slugKebabCase, "index.tsx"));
231596
+ await ensureCollectionImport(path53.join(projectDir, "src", "blocks", variables.slugKebabCase, "index.tsx"));
231420
231597
  }
231421
231598
  async function appendBlockConfigEntries(projectDir, entries, needsRestManifestImport) {
231422
231599
  await appendWorkspaceInventoryEntries(projectDir, {
@@ -231425,13 +231602,13 @@ async function appendBlockConfigEntries(projectDir, entries, needsRestManifestIm
231425
231602
  });
231426
231603
  }
231427
231604
  async function renderWorkspacePersistenceServerModule(projectDir, variables) {
231428
- const targetDir = path52.join(projectDir, "src", "blocks", variables.slugKebabCase);
231605
+ const targetDir = path53.join(projectDir, "src", "blocks", variables.slugKebabCase);
231429
231606
  const templateDir = buildServerTemplateRoot(variables.persistencePolicy);
231430
231607
  await copyInterpolatedDirectory(templateDir, targetDir, variables);
231431
231608
  }
231432
231609
  async function hasInstalledWorkspaceDependencies(projectDir) {
231433
231610
  for (const marker of WORKSPACE_INSTALL_MARKERS) {
231434
- if (await pathExists(path52.join(projectDir, marker))) {
231611
+ if (await pathExists(path53.join(projectDir, marker))) {
231435
231612
  return true;
231436
231613
  }
231437
231614
  }
@@ -231446,14 +231623,14 @@ async function assertWorkspaceDependenciesInstalled(workspace) {
231446
231623
  async function copyScaffoldedBlockSlice(projectDir, templateId, tempProjectDir, variables, legacyValidatorPaths = []) {
231447
231624
  if (templateId === "compound") {
231448
231625
  await ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths);
231449
- await copyTempDirectory(path52.join(tempProjectDir, "src", "blocks", variables.slugKebabCase), path52.join(projectDir, "src", "blocks", variables.slugKebabCase));
231450
- await copyTempDirectory(path52.join(tempProjectDir, "src", "blocks", `${variables.slugKebabCase}-item`), path52.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`));
231451
- if (variables.compoundPersistenceEnabled === "true") {
231626
+ await copyTempDirectory(path53.join(tempProjectDir, "src", "blocks", variables.slugKebabCase), path53.join(projectDir, "src", "blocks", variables.slugKebabCase));
231627
+ await copyTempDirectory(path53.join(tempProjectDir, "src", "blocks", `${variables.slugKebabCase}-item`), path53.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`));
231628
+ if (isCompoundPersistenceEnabled(variables)) {
231452
231629
  await renderWorkspacePersistenceServerModule(projectDir, variables);
231453
231630
  }
231454
231631
  return;
231455
231632
  }
231456
- await copyTempDirectory(path52.join(tempProjectDir, "src"), path52.join(projectDir, "src", "blocks", variables.slugKebabCase));
231633
+ await copyTempDirectory(path53.join(tempProjectDir, "src"), path53.join(projectDir, "src", "blocks", variables.slugKebabCase));
231457
231634
  if (templateId === "persistence") {
231458
231635
  await renderWorkspacePersistenceServerModule(projectDir, variables);
231459
231636
  }
@@ -231504,21 +231681,21 @@ async function assertAddBlockSupportsExternalLayerOutputs(options) {
231504
231681
  function collectWorkspaceBlockPaths(projectDir, templateId, variables) {
231505
231682
  if (templateId === "compound") {
231506
231683
  return [
231507
- path52.join(projectDir, "src", "blocks", variables.slugKebabCase),
231508
- path52.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`)
231684
+ path53.join(projectDir, "src", "blocks", variables.slugKebabCase),
231685
+ path53.join(projectDir, "src", "blocks", `${variables.slugKebabCase}-item`)
231509
231686
  ];
231510
231687
  }
231511
- return [path52.join(projectDir, "src", "blocks", variables.slugKebabCase)];
231688
+ return [path53.join(projectDir, "src", "blocks", variables.slugKebabCase)];
231512
231689
  }
231513
231690
  async function assertBlockTargetsDoNotExist(projectDir, templateId, variables) {
231514
231691
  for (const targetPath of collectWorkspaceBlockPaths(projectDir, templateId, variables)) {
231515
231692
  if (await pathExists(targetPath)) {
231516
- throw new Error(`A block already exists at ${path52.relative(projectDir, targetPath)}. Choose a different name.`);
231693
+ throw new Error(`A block already exists at ${path53.relative(projectDir, targetPath)}. Choose a different name.`);
231517
231694
  }
231518
231695
  }
231519
231696
  }
231520
231697
  async function updateWorkspaceMigrationConfigIfPresent(projectDir, newBlocks) {
231521
- const configPath = path52.join(projectDir, "src", "migrations", "config.ts");
231698
+ const configPath = path53.join(projectDir, "src", "migrations", "config.ts");
231522
231699
  const configSource = await readOptionalFile(configPath);
231523
231700
  if (configSource === null) {
231524
231701
  return;
@@ -231539,10 +231716,10 @@ async function updateWorkspaceMigrationConfigIfPresent(projectDir, newBlocks) {
231539
231716
  }
231540
231717
  async function syncWorkspaceBlockMetadata(projectDir, slug, sourceTypeName, typesFile) {
231541
231718
  await syncBlockMetadata({
231542
- blockJsonFile: path52.join("src", "blocks", slug, "block.json"),
231543
- jsonSchemaFile: path52.join("src", "blocks", slug, "typia.schema.json"),
231544
- manifestFile: path52.join("src", "blocks", slug, "typia.manifest.json"),
231545
- openApiFile: path52.join("src", "blocks", slug, "typia.openapi.json"),
231719
+ blockJsonFile: path53.join("src", "blocks", slug, "block.json"),
231720
+ jsonSchemaFile: path53.join("src", "blocks", slug, "typia.schema.json"),
231721
+ manifestFile: path53.join("src", "blocks", slug, "typia.manifest.json"),
231722
+ openApiFile: path53.join("src", "blocks", slug, "typia.openapi.json"),
231546
231723
  projectRoot: projectDir,
231547
231724
  sourceTypeName,
231548
231725
  typesFile
@@ -231550,18 +231727,18 @@ async function syncWorkspaceBlockMetadata(projectDir, slug, sourceTypeName, type
231550
231727
  }
231551
231728
  async function syncWorkspacePersistenceArtifacts(projectDir, variables) {
231552
231729
  await syncPersistenceRestArtifacts({
231553
- apiTypesFile: path52.join("src", "blocks", variables.slugKebabCase, "api-types.ts"),
231554
- outputDir: path52.join("src", "blocks", variables.slugKebabCase),
231730
+ apiTypesFile: path53.join("src", "blocks", variables.slugKebabCase, "api-types.ts"),
231731
+ outputDir: path53.join("src", "blocks", variables.slugKebabCase),
231555
231732
  projectDir,
231556
231733
  variables
231557
231734
  });
231558
231735
  }
231559
231736
  async function syncWorkspaceAddedBlockArtifacts(projectDir, templateId, variables) {
231560
- await syncWorkspaceBlockMetadata(projectDir, variables.slugKebabCase, `${variables.pascalCase}Attributes`, path52.join("src", "blocks", variables.slugKebabCase, "types.ts"));
231737
+ await syncWorkspaceBlockMetadata(projectDir, variables.slugKebabCase, `${variables.pascalCase}Attributes`, path53.join("src", "blocks", variables.slugKebabCase, "types.ts"));
231561
231738
  if (templateId === "compound") {
231562
- await syncWorkspaceBlockMetadata(projectDir, `${variables.slugKebabCase}-item`, `${variables.pascalCase}ItemAttributes`, path52.join("src", "blocks", `${variables.slugKebabCase}-item`, "types.ts"));
231739
+ await syncWorkspaceBlockMetadata(projectDir, `${variables.slugKebabCase}-item`, `${variables.pascalCase}ItemAttributes`, path53.join("src", "blocks", `${variables.slugKebabCase}-item`, "types.ts"));
231563
231740
  }
231564
- if (templateId === "persistence" || templateId === "compound" && variables.compoundPersistenceEnabled === "true") {
231741
+ if (templateId === "persistence" || templateId === "compound" && isCompoundPersistenceEnabled(variables)) {
231565
231742
  await syncWorkspacePersistenceArtifacts(projectDir, variables);
231566
231743
  }
231567
231744
  }
@@ -231661,13 +231838,13 @@ async function runAddBlockCommand({
231661
231838
  path: tempRoot,
231662
231839
  cleanup: cleanupTempRoot
231663
231840
  } = await createManagedTempRoot("wp-typia-add-block-"));
231664
- const tempProjectDir = path52.join(tempRoot, normalizedSlug);
231665
- const blockConfigPath = path52.join(workspace.projectDir, "scripts", "block-config.ts");
231666
- const migrationConfigPath = path52.join(workspace.projectDir, "src", "migrations", "config.ts");
231841
+ const tempProjectDir = path53.join(tempRoot, normalizedSlug);
231842
+ const blockConfigPath = path53.join(workspace.projectDir, "scripts", "block-config.ts");
231843
+ const migrationConfigPath = path53.join(workspace.projectDir, "src", "migrations", "config.ts");
231667
231844
  const blockPhpPrefix = buildWorkspacePhpPrefix(workspace.workspace.phpPrefix, normalizedSlug);
231668
231845
  const migrationConfigSource = await readOptionalFile(migrationConfigPath);
231669
231846
  const migrationConfig = migrationConfigSource === null ? null : parseMigrationConfig(migrationConfigSource);
231670
- const compoundSupportPaths = resolvedTemplateId === "compound" ? COMPOUND_SHARED_SUPPORT_FILES.map((fileName) => path52.join(workspace.projectDir, "src", fileName)) : [];
231847
+ const compoundSupportPaths = resolvedTemplateId === "compound" ? COMPOUND_SHARED_SUPPORT_FILES.map((fileName) => path53.join(workspace.projectDir, "src", fileName)) : [];
231671
231848
  const legacyCompoundValidatorPaths = resolvedTemplateId === "compound" ? await collectLegacyCompoundValidatorPaths(workspace.projectDir) : [];
231672
231849
  const result = await (async () => {
231673
231850
  const scaffoldResult = await scaffoldProject({
@@ -231710,17 +231887,17 @@ async function runAddBlockCommand({
231710
231887
  ...compoundSupportPaths,
231711
231888
  ...legacyCompoundValidatorPaths
231712
231889
  ]),
231713
- snapshotDirs: migrationConfig === null ? [] : buildMigrationBlocks2(resolvedTemplateId, result.variables).map((block) => path52.join(workspace.projectDir, ...migrationConfig.snapshotDir.split("/"), migrationConfig.currentMigrationVersion, block.key)),
231890
+ snapshotDirs: migrationConfig === null ? [] : buildMigrationBlocks2(resolvedTemplateId, result.variables).map((block) => path53.join(workspace.projectDir, ...migrationConfig.snapshotDir.split("/"), migrationConfig.currentMigrationVersion, block.key)),
231714
231891
  targetPaths: collectWorkspaceBlockPaths(workspace.projectDir, resolvedTemplateId, result.variables)
231715
231892
  };
231716
231893
  try {
231717
231894
  await copyScaffoldedBlockSlice(workspace.projectDir, resolvedTemplateId, tempProjectDir, result.variables, legacyCompoundValidatorPaths);
231718
231895
  await addCollectionImportsForTemplate(workspace.projectDir, resolvedTemplateId, result.variables);
231719
- await appendBlockConfigEntries(workspace.projectDir, buildConfigEntries(resolvedTemplateId, result.variables), resolvedTemplateId === "persistence" || resolvedTemplateId === "compound" && result.variables.compoundPersistenceEnabled === "true");
231896
+ await appendBlockConfigEntries(workspace.projectDir, buildConfigEntries(resolvedTemplateId, result.variables), resolvedTemplateId === "persistence" || resolvedTemplateId === "compound" && isCompoundPersistenceEnabled(result.variables));
231720
231897
  await syncWorkspaceAddedBlockArtifacts(workspace.projectDir, resolvedTemplateId, result.variables);
231721
231898
  await updateWorkspaceMigrationConfigIfPresent(workspace.projectDir, buildMigrationBlocks2(resolvedTemplateId, result.variables));
231722
231899
  return {
231723
- blockSlugs: collectWorkspaceBlockPaths(workspace.projectDir, resolvedTemplateId, result.variables).map((targetPath) => path52.basename(targetPath)),
231900
+ blockSlugs: collectWorkspaceBlockPaths(workspace.projectDir, resolvedTemplateId, result.variables).map((targetPath) => path53.basename(targetPath)),
231724
231901
  projectDir: workspace.projectDir,
231725
231902
  templateId: resolvedTemplateId,
231726
231903
  warnings: result.warnings
@@ -231755,6 +231932,7 @@ var init_cli_add_block = __esm(() => {
231755
231932
  init_template_layers();
231756
231933
  init_package_managers();
231757
231934
  init_compound_inner_blocks();
231935
+ init_scaffold_template_variable_groups();
231758
231936
  init_external_layer_selection();
231759
231937
  init_alternate_render_targets();
231760
231938
  init_cli_validation();
@@ -231762,6 +231940,53 @@ var init_cli_add_block = __esm(() => {
231762
231940
  WORKSPACE_INSTALL_MARKERS = ["node_modules", ".pnp.cjs", ".pnp.loader.mjs"];
231763
231941
  });
231764
231942
 
231943
+ // ../wp-typia-project-tools/src/runtime/block-targets.ts
231944
+ function assertFullBlockName(blockName, flagName) {
231945
+ const trimmed = blockName.trim();
231946
+ if (!trimmed) {
231947
+ throw new Error(`\`${flagName}\` requires a block name.`);
231948
+ }
231949
+ if (!FULL_BLOCK_NAME_PATTERN.test(trimmed)) {
231950
+ throw new Error(`\`${flagName}\` must use <namespace/block-slug> format.`);
231951
+ }
231952
+ return trimmed;
231953
+ }
231954
+ function resolveWorkspaceBlockTargetName(blockName, namespace, diagnostics) {
231955
+ const trimmed = blockName.trim();
231956
+ if (!trimmed) {
231957
+ throw new Error(diagnostics.empty());
231958
+ }
231959
+ const blockNameSegments = trimmed.split("/");
231960
+ if (blockNameSegments.length > 2) {
231961
+ throw new Error(diagnostics.invalidFormat(trimmed));
231962
+ }
231963
+ if (blockNameSegments.some((segment) => segment.trim() === "")) {
231964
+ throw new Error(diagnostics.emptySegment(trimmed));
231965
+ }
231966
+ const [maybeNamespace, maybeSlug] = blockNameSegments.length === 2 ? blockNameSegments : [undefined, blockNameSegments[0]];
231967
+ if (maybeNamespace && maybeNamespace !== namespace) {
231968
+ throw new Error(diagnostics.namespaceMismatch(trimmed, maybeNamespace, namespace));
231969
+ }
231970
+ const blockSlug = normalizeBlockSlug(maybeSlug ?? "");
231971
+ return {
231972
+ blockName: `${namespace}/${blockSlug}`,
231973
+ blockSlug
231974
+ };
231975
+ }
231976
+ function resolveWorkspaceTargetBlockName(blockName, namespace, flagName) {
231977
+ return resolveWorkspaceBlockTargetName(blockName, namespace, {
231978
+ empty: () => `\`${flagName}\` requires <block-slug|namespace/block-slug>.`,
231979
+ emptySegment: () => `\`${flagName}\` must use <block-slug|namespace/block-slug> format.`,
231980
+ invalidFormat: () => `\`${flagName}\` must use <block-slug|namespace/block-slug> format.`,
231981
+ namespaceMismatch: (_input, actualNamespace, expectedNamespace) => `\`${flagName}\` references namespace "${actualNamespace}". Expected "${expectedNamespace}".`
231982
+ });
231983
+ }
231984
+ var FULL_BLOCK_NAME_PATTERN;
231985
+ var init_block_targets = __esm(() => {
231986
+ init_scaffold_identifiers();
231987
+ FULL_BLOCK_NAME_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
231988
+ });
231989
+
231765
231990
  // ../wp-typia-project-tools/src/runtime/ts-source-masking.ts
231766
231991
  function maskSourceSegment(segment) {
231767
231992
  return segment.replace(/[^\n\r]/gu, " ");
@@ -231952,12 +232177,12 @@ var init_cli_add_workspace_admin_view_source = __esm(() => {
231952
232177
  });
231953
232178
 
231954
232179
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-templates.ts
231955
- import path53 from "path";
232180
+ import path54 from "path";
231956
232181
  function getAdminViewRelativeModuleSpecifier(adminViewSlug, workspaceFile) {
231957
232182
  const adminViewDir = `src/admin-views/${adminViewSlug}`;
231958
232183
  const normalizedFile = workspaceFile.replace(/\\/gu, "/");
231959
232184
  const modulePath = normalizedFile.replace(/\.[cm]?[jt]sx?$/u, "");
231960
- const relativeModulePath = path53.posix.relative(adminViewDir, modulePath);
232185
+ const relativeModulePath = path54.posix.relative(adminViewDir, modulePath);
231961
232186
  return relativeModulePath.startsWith(".") ? relativeModulePath : `./${relativeModulePath}`;
231962
232187
  }
231963
232188
  function buildAdminViewConfigEntry(adminViewSlug, source) {
@@ -232980,15 +233205,14 @@ var init_cli_add_workspace_mutation = __esm(() => {
232980
233205
  });
232981
233206
 
232982
233207
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-scaffold.ts
232983
- import fs38 from "fs";
232984
233208
  import { promises as fsp20 } from "fs";
232985
- import path54 from "path";
233209
+ import path55 from "path";
232986
233210
  function detectJsonIndent(source) {
232987
233211
  const indentMatch = /\n([ \t]+)"/u.exec(source);
232988
233212
  return indentMatch?.[1] ?? 2;
232989
233213
  }
232990
233214
  async function ensureAdminViewPackageDependencies(workspace, adminViewSource) {
232991
- const packageJsonPath = path54.join(workspace.projectDir, "package.json");
233215
+ const packageJsonPath = path55.join(workspace.projectDir, "package.json");
232992
233216
  const wpTypiaDataViewsVersion = resolveManagedPackageVersionRange({
232993
233217
  fallback: DEFAULT_WP_TYPIA_DATAVIEWS_VERSION,
232994
233218
  packageName: "@wp-typia/dataviews",
@@ -233053,7 +233277,7 @@ function ${loadFunctionName}() {
233053
233277
  if (!functionSource.includes(ADMIN_VIEWS_PHP_GLOB)) {
233054
233278
  const replacedSource = replacePhpFunctionDefinition(nextSource, loadFunctionName, loadFunction);
233055
233279
  if (!replacedSource) {
233056
- throw new Error(`Unable to repair ${path54.basename(bootstrapPath)} for ${loadFunctionName}.`);
233280
+ throw new Error(`Unable to repair ${path55.basename(bootstrapPath)} for ${loadFunctionName}.`);
233057
233281
  }
233058
233282
  nextSource = replacedSource;
233059
233283
  }
@@ -233065,7 +233289,7 @@ function ${loadFunctionName}() {
233065
233289
  });
233066
233290
  }
233067
233291
  async function ensureAdminViewBuildScriptAnchors(workspace) {
233068
- const buildScriptPath = path54.join(workspace.projectDir, "scripts", "build-workspace.mjs");
233292
+ const buildScriptPath = path55.join(workspace.projectDir, "scripts", "build-workspace.mjs");
233069
233293
  await patchFile(buildScriptPath, (source) => {
233070
233294
  if (/['"]src\/admin-views\/index\.(?:ts|js)['"]/u.test(source)) {
233071
233295
  return source;
@@ -233089,11 +233313,11 @@ async function ensureAdminViewBuildScriptAnchors(workspace) {
233089
233313
  if (nextSource !== source) {
233090
233314
  return nextSource;
233091
233315
  }
233092
- throw new Error(`Unable to update ${path54.relative(workspace.projectDir, buildScriptPath)} for admin view shared entries.`);
233316
+ throw new Error(`Unable to update ${path55.relative(workspace.projectDir, buildScriptPath)} for admin view shared entries.`);
233093
233317
  });
233094
233318
  }
233095
233319
  async function ensureAdminViewWebpackAnchors(workspace) {
233096
- const webpackConfigPath = path54.join(workspace.projectDir, "webpack.config.js");
233320
+ const webpackConfigPath = path55.join(workspace.projectDir, "webpack.config.js");
233097
233321
  await patchFile(webpackConfigPath, (source) => {
233098
233322
  if (/['"]admin-views\/index['"]/u.test(source)) {
233099
233323
  return source;
@@ -233134,31 +233358,36 @@ async function ensureAdminViewWebpackAnchors(workspace) {
233134
233358
  }`;
233135
233359
  nextSource = source.replace(legacySharedEntriesBlockPattern, nextSharedEntriesBlock);
233136
233360
  if (nextSource === source) {
233137
- throw new Error(`Unable to update ${path54.relative(workspace.projectDir, webpackConfigPath)} for admin view shared entries.`);
233361
+ throw new Error(`Unable to update ${path55.relative(workspace.projectDir, webpackConfigPath)} for admin view shared entries.`);
233138
233362
  }
233139
233363
  return nextSource;
233140
233364
  });
233141
233365
  }
233142
- function resolveAdminViewRegistryPath(projectDir) {
233143
- const adminViewsDir = path54.join(projectDir, "src", "admin-views");
233144
- return [
233145
- path54.join(adminViewsDir, "index.ts"),
233146
- path54.join(adminViewsDir, "index.js")
233147
- ].find((candidatePath) => fs38.existsSync(candidatePath)) ?? path54.join(adminViewsDir, "index.ts");
233366
+ async function resolveAdminViewRegistryPath(projectDir) {
233367
+ const adminViewsDir = path55.join(projectDir, "src", "admin-views");
233368
+ for (const candidatePath of [
233369
+ path55.join(adminViewsDir, "index.ts"),
233370
+ path55.join(adminViewsDir, "index.js")
233371
+ ]) {
233372
+ if (await pathExists(candidatePath)) {
233373
+ return candidatePath;
233374
+ }
233375
+ }
233376
+ return path55.join(adminViewsDir, "index.ts");
233148
233377
  }
233149
- function readAdminViewRegistrySlugs(registryPath) {
233150
- if (!fs38.existsSync(registryPath)) {
233378
+ async function readAdminViewRegistrySlugs(registryPath) {
233379
+ const source = await readOptionalUtf8File(registryPath);
233380
+ if (source === null) {
233151
233381
  return [];
233152
233382
  }
233153
- const source = fs38.readFileSync(registryPath, "utf8");
233154
233383
  return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
233155
233384
  }
233156
233385
  async function writeAdminViewRegistry(projectDir, adminViewSlug) {
233157
- const adminViewsDir = path54.join(projectDir, "src", "admin-views");
233158
- const registryPath = resolveAdminViewRegistryPath(projectDir);
233386
+ const adminViewsDir = path55.join(projectDir, "src", "admin-views");
233387
+ const registryPath = await resolveAdminViewRegistryPath(projectDir);
233159
233388
  await fsp20.mkdir(adminViewsDir, { recursive: true });
233160
- const existingAdminViewSlugs = readWorkspaceInventory(projectDir).adminViews.map((entry) => entry.slug);
233161
- const existingRegistrySlugs = readAdminViewRegistrySlugs(registryPath);
233389
+ const existingAdminViewSlugs = (await readWorkspaceInventoryAsync(projectDir)).adminViews.map((entry) => entry.slug);
233390
+ const existingRegistrySlugs = await readAdminViewRegistrySlugs(registryPath);
233162
233391
  const nextAdminViewSlugs = Array.from(new Set([
233163
233392
  ...existingAdminViewSlugs,
233164
233393
  ...existingRegistrySlugs,
@@ -233174,14 +233403,14 @@ async function scaffoldAdminViewWorkspace(options) {
233174
233403
  restResource,
233175
233404
  workspace
233176
233405
  } = options;
233177
- const blockConfigPath = path54.join(workspace.projectDir, "scripts", "block-config.ts");
233406
+ const blockConfigPath = path55.join(workspace.projectDir, "scripts", "block-config.ts");
233178
233407
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
233179
- const buildScriptPath = path54.join(workspace.projectDir, "scripts", "build-workspace.mjs");
233180
- const packageJsonPath = path54.join(workspace.projectDir, "package.json");
233181
- const webpackConfigPath = path54.join(workspace.projectDir, "webpack.config.js");
233182
- const adminViewsIndexPath = resolveAdminViewRegistryPath(workspace.projectDir);
233183
- const adminViewDir = path54.join(workspace.projectDir, "src", "admin-views", adminViewSlug);
233184
- const adminViewPhpPath = path54.join(workspace.projectDir, "inc", "admin-views", `${adminViewSlug}.php`);
233408
+ const buildScriptPath = path55.join(workspace.projectDir, "scripts", "build-workspace.mjs");
233409
+ const packageJsonPath = path55.join(workspace.projectDir, "package.json");
233410
+ const webpackConfigPath = path55.join(workspace.projectDir, "webpack.config.js");
233411
+ const adminViewsIndexPath = await resolveAdminViewRegistryPath(workspace.projectDir);
233412
+ const adminViewDir = path55.join(workspace.projectDir, "src", "admin-views", adminViewSlug);
233413
+ const adminViewPhpPath = path55.join(workspace.projectDir, "inc", "admin-views", `${adminViewSlug}.php`);
233185
233414
  await executeWorkspaceMutationPlan({
233186
233415
  filePaths: [
233187
233416
  adminViewsIndexPath,
@@ -233194,17 +233423,17 @@ async function scaffoldAdminViewWorkspace(options) {
233194
233423
  targetPaths: [adminViewDir, adminViewPhpPath],
233195
233424
  run: async () => {
233196
233425
  await fsp20.mkdir(adminViewDir, { recursive: true });
233197
- await fsp20.mkdir(path54.dirname(adminViewPhpPath), { recursive: true });
233426
+ await fsp20.mkdir(path55.dirname(adminViewPhpPath), { recursive: true });
233198
233427
  await ensureAdminViewPackageDependencies(workspace, parsedSource);
233199
233428
  await ensureAdminViewBootstrapAnchors(workspace);
233200
233429
  await ensureAdminViewBuildScriptAnchors(workspace);
233201
233430
  await ensureAdminViewWebpackAnchors(workspace);
233202
- await fsp20.writeFile(path54.join(adminViewDir, "types.ts"), buildAdminViewTypesSource(adminViewSlug, restResource, coreDataSource), "utf8");
233203
- await fsp20.writeFile(path54.join(adminViewDir, "config.ts"), buildAdminViewConfigSource(adminViewSlug, workspace.workspace.textDomain, parsedSource, restResource), "utf8");
233204
- await fsp20.writeFile(path54.join(adminViewDir, "data.ts"), coreDataSource ? buildCoreDataAdminViewDataSource(adminViewSlug, coreDataSource) : restResource ? buildRestAdminViewDataSource(adminViewSlug, restResource) : buildDefaultAdminViewDataSource(adminViewSlug), "utf8");
233205
- await fsp20.writeFile(path54.join(adminViewDir, "Screen.tsx"), coreDataSource ? buildCoreDataAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain) : buildAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain), "utf8");
233206
- await fsp20.writeFile(path54.join(adminViewDir, "index.tsx"), buildAdminViewEntrySource(adminViewSlug), "utf8");
233207
- await fsp20.writeFile(path54.join(adminViewDir, "style.scss"), buildAdminViewStyleSource(), "utf8");
233431
+ await fsp20.writeFile(path55.join(adminViewDir, "types.ts"), buildAdminViewTypesSource(adminViewSlug, restResource, coreDataSource), "utf8");
233432
+ await fsp20.writeFile(path55.join(adminViewDir, "config.ts"), buildAdminViewConfigSource(adminViewSlug, workspace.workspace.textDomain, parsedSource, restResource), "utf8");
233433
+ await fsp20.writeFile(path55.join(adminViewDir, "data.ts"), coreDataSource ? buildCoreDataAdminViewDataSource(adminViewSlug, coreDataSource) : restResource ? buildRestAdminViewDataSource(adminViewSlug, restResource) : buildDefaultAdminViewDataSource(adminViewSlug), "utf8");
233434
+ await fsp20.writeFile(path55.join(adminViewDir, "Screen.tsx"), coreDataSource ? buildCoreDataAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain) : buildAdminViewScreenSource(adminViewSlug, workspace.workspace.textDomain), "utf8");
233435
+ await fsp20.writeFile(path55.join(adminViewDir, "index.tsx"), buildAdminViewEntrySource(adminViewSlug), "utf8");
233436
+ await fsp20.writeFile(path55.join(adminViewDir, "style.scss"), buildAdminViewStyleSource(), "utf8");
233208
233437
  await fsp20.writeFile(adminViewPhpPath, buildAdminViewPhpSource(adminViewSlug, workspace), "utf8");
233209
233438
  await writeAdminViewRegistry(workspace.projectDir, adminViewSlug);
233210
233439
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
@@ -233216,6 +233445,7 @@ async function scaffoldAdminViewWorkspace(options) {
233216
233445
  });
233217
233446
  }
233218
233447
  var init_cli_add_workspace_admin_view_scaffold = __esm(() => {
233448
+ init_fs_async();
233219
233449
  init_workspace_inventory();
233220
233450
  init_cli_add_workspace_admin_view_templates();
233221
233451
  init_cli_add_workspace_admin_view_types();
@@ -233234,7 +233464,7 @@ async function runAddAdminViewCommand({
233234
233464
  assertAdminViewPackageAvailability();
233235
233465
  const adminViewSlug = assertValidGeneratedSlug("Admin view name", normalizeBlockSlug(adminViewName), ADD_ADMIN_VIEW_USAGE);
233236
233466
  const parsedSource = parseAdminViewSource(source);
233237
- const inventory = readWorkspaceInventory(workspace.projectDir);
233467
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
233238
233468
  const restResource = resolveRestResourceSource(inventory.restResources, parsedSource);
233239
233469
  const coreDataSource = resolveAdminViewCoreDataSource(parsedSource);
233240
233470
  assertAdminViewDoesNotExist(workspace.projectDir, adminViewSlug, inventory);
@@ -233262,9 +233492,8 @@ var init_cli_add_workspace_admin_view = __esm(() => {
233262
233492
  });
233263
233493
 
233264
233494
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-assets.ts
233265
- import fs39 from "fs";
233266
233495
  import { promises as fsp21 } from "fs";
233267
- import path55 from "path";
233496
+ import path56 from "path";
233268
233497
  import {
233269
233498
  syncBlockMetadata as syncBlockMetadata2
233270
233499
  } from "@wp-typia/block-runtime/metadata-core";
@@ -233299,24 +233528,6 @@ function assertValidBindingAttributeName(attributeName) {
233299
233528
  }
233300
233529
  return trimmed;
233301
233530
  }
233302
- function resolveBindingTargetBlockSlug(blockName, namespace) {
233303
- const trimmed = blockName.trim();
233304
- if (!trimmed) {
233305
- throw new Error("`wp-typia add binding-source` requires --block <block-slug|namespace/block-slug> to include a value when --attribute is provided.");
233306
- }
233307
- const blockNameSegments = trimmed.split("/");
233308
- if (blockNameSegments.length > 2) {
233309
- throw new Error(`Binding target block "${trimmed}" must use <block-slug> or <namespace/block-slug> format.`);
233310
- }
233311
- if (blockNameSegments.some((segment) => segment.trim() === "")) {
233312
- throw new Error(`Binding target block "${trimmed}" must use <block-slug> or <namespace/block-slug> format without empty path segments.`);
233313
- }
233314
- const [maybeNamespace, maybeSlug] = blockNameSegments.length === 2 ? blockNameSegments : [undefined, blockNameSegments[0]];
233315
- if (maybeNamespace && maybeNamespace !== namespace) {
233316
- throw new Error(`Binding target block "${trimmed}" uses namespace "${maybeNamespace}". Expected "${namespace}".`);
233317
- }
233318
- return normalizeBlockSlug(maybeSlug ?? "");
233319
- }
233320
233531
  function buildEditorPluginConfigEntry(editorPluginSlug, slot) {
233321
233532
  return [
233322
233533
  "\t{",
@@ -233481,9 +233692,15 @@ function resolveBindingTarget(options, namespace) {
233481
233692
  if (!hasBlock || !hasAttribute) {
233482
233693
  throw new Error("`wp-typia add binding-source` requires --block and --attribute to be provided together.");
233483
233694
  }
233695
+ const targetBlock = resolveWorkspaceBlockTargetName(blockName ?? "", namespace, {
233696
+ empty: () => "`wp-typia add binding-source` requires --block <block-slug|namespace/block-slug> to include a value when --attribute is provided.",
233697
+ emptySegment: (input) => `Binding target block "${input}" must use <block-slug> or <namespace/block-slug> format without empty path segments.`,
233698
+ invalidFormat: (input) => `Binding target block "${input}" must use <block-slug> or <namespace/block-slug> format.`,
233699
+ namespaceMismatch: (input, actualNamespace, expectedNamespace) => `Binding target block "${input}" uses namespace "${actualNamespace}". Expected "${expectedNamespace}".`
233700
+ });
233484
233701
  return {
233485
233702
  attributeName: assertValidBindingAttributeName(attributeName ?? ""),
233486
- blockSlug: resolveBindingTargetBlockSlug(blockName ?? "", namespace)
233703
+ blockSlug: targetBlock.blockSlug
233487
233704
  };
233488
233705
  }
233489
233706
  function formatBindingAttributeTypeMember(attributeName) {
@@ -233497,26 +233714,20 @@ function formatBindingAttributeTypeMember(attributeName) {
233497
233714
  `);
233498
233715
  }
233499
233716
  function getInterfaceDeclaration(source, interfaceName) {
233500
- const sourceFile = import_typescript2.default.createSourceFile("types.ts", source, import_typescript2.default.ScriptTarget.Latest, true, import_typescript2.default.ScriptKind.TS);
233717
+ const sourceFile = import_typescript3.default.createSourceFile("types.ts", source, import_typescript3.default.ScriptTarget.Latest, true, import_typescript3.default.ScriptKind.TS);
233501
233718
  let declaration;
233502
233719
  const visit2 = (node) => {
233503
- if (import_typescript2.default.isInterfaceDeclaration(node) && node.name.text === interfaceName) {
233720
+ if (import_typescript3.default.isInterfaceDeclaration(node) && node.name.text === interfaceName) {
233504
233721
  declaration = node;
233505
233722
  return true;
233506
233723
  }
233507
- return import_typescript2.default.forEachChild(node, (child) => visit2(child) ? true : undefined) ?? false;
233724
+ return import_typescript3.default.forEachChild(node, (child) => visit2(child) ? true : undefined) ?? false;
233508
233725
  };
233509
233726
  visit2(sourceFile);
233510
233727
  return declaration ? { declaration, sourceFile } : undefined;
233511
233728
  }
233512
- function getPropertyNameText2(name2) {
233513
- if (import_typescript2.default.isIdentifier(name2) || import_typescript2.default.isStringLiteral(name2) || import_typescript2.default.isNumericLiteral(name2)) {
233514
- return name2.text;
233515
- }
233516
- return;
233517
- }
233518
233729
  function interfaceHasAttributeMember(declaration, attributeName) {
233519
- return declaration.members.some((member) => import_typescript2.default.isPropertySignature(member) && member.name !== undefined && getPropertyNameText2(member.name) === attributeName);
233730
+ return declaration.members.some((member) => import_typescript3.default.isPropertySignature(member) && member.name !== undefined && getPropertyNameText(member.name) === attributeName);
233520
233731
  }
233521
233732
  function insertBindingAttributeTypeMember(source, declaration, attributeName) {
233522
233733
  let closeBracePosition = declaration.end - 1;
@@ -233541,7 +233752,7 @@ async function ensureBindingTargetBlockAttributeType(projectDir, block, target)
233541
233752
  if (!block.attributeTypeName) {
233542
233753
  throw new Error(`Workspace block "${block.slug}" must include attributeTypeName in scripts/block-config.ts before it can receive binding-source targets.`);
233543
233754
  }
233544
- const typesPath = path55.join(projectDir, block.typesFile);
233755
+ const typesPath = path56.join(projectDir, block.typesFile);
233545
233756
  const source = await fsp21.readFile(typesPath, "utf8");
233546
233757
  const targetInterface = getInterfaceDeclaration(source, block.attributeTypeName);
233547
233758
  if (!targetInterface) {
@@ -233553,10 +233764,10 @@ async function ensureBindingTargetBlockAttributeType(projectDir, block, target)
233553
233764
  await fsp21.writeFile(typesPath, nextSource, "utf8");
233554
233765
  }
233555
233766
  await syncBlockMetadata2({
233556
- blockJsonFile: path55.join("src", "blocks", block.slug, "block.json"),
233557
- jsonSchemaFile: path55.join("src", "blocks", block.slug, "typia.schema.json"),
233558
- manifestFile: path55.join("src", "blocks", block.slug, "typia.manifest.json"),
233559
- openApiFile: path55.join("src", "blocks", block.slug, "typia.openapi.json"),
233767
+ blockJsonFile: path56.join("src", "blocks", block.slug, "block.json"),
233768
+ jsonSchemaFile: path56.join("src", "blocks", block.slug, "typia.schema.json"),
233769
+ manifestFile: path56.join("src", "blocks", block.slug, "typia.manifest.json"),
233770
+ openApiFile: path56.join("src", "blocks", block.slug, "typia.openapi.json"),
233560
233771
  projectRoot: projectDir,
233561
233772
  sourceTypeName: block.attributeTypeName,
233562
233773
  typesFile: block.typesFile
@@ -233795,7 +234006,7 @@ ${patternFunctions}
233795
234006
  }
233796
234007
  }
233797
234008
  if (!nextSource.includes(patternCategoryFunctionName) || !nextSource.includes(patternRegistrationFunctionName)) {
233798
- throw new Error(`Unable to inject pattern bootstrap functions into ${path55.basename(bootstrapPath)}.`);
234009
+ throw new Error(`Unable to inject pattern bootstrap functions into ${path56.basename(bootstrapPath)}.`);
233799
234010
  }
233800
234011
  if (!nextSource.includes(patternCategoryHook)) {
233801
234012
  nextSource = `${nextSource.trimEnd()}
@@ -233927,7 +234138,7 @@ function ${enqueueFunctionName}() {
233927
234138
  if (missingReferences.length > 0) {
233928
234139
  const replacedSource = replacePhpFunctionDefinition(nextSource, enqueueFunctionName, enqueueFunction);
233929
234140
  if (!replacedSource) {
233930
- throw new Error(`Unable to repair ${path55.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
234141
+ throw new Error(`Unable to repair ${path56.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
233931
234142
  }
233932
234143
  nextSource = replacedSource;
233933
234144
  }
@@ -233939,7 +234150,7 @@ function ${enqueueFunctionName}() {
233939
234150
  });
233940
234151
  }
233941
234152
  async function ensureEditorPluginBuildScriptAnchors(workspace) {
233942
- const buildScriptPath = path55.join(workspace.projectDir, "scripts", "build-workspace.mjs");
234153
+ const buildScriptPath = path56.join(workspace.projectDir, "scripts", "build-workspace.mjs");
233943
234154
  await patchFile(buildScriptPath, (source) => {
233944
234155
  if (/['"]src\/editor-plugins\/index\.(?:ts|js)['"]/u.test(source)) {
233945
234156
  return source;
@@ -233952,13 +234163,13 @@ async function ensureEditorPluginBuildScriptAnchors(workspace) {
233952
234163
  'src/editor-plugins/index.js',
233953
234164
  ]`);
233954
234165
  if (nextSource === source) {
233955
- throw new Error(`Unable to update ${path55.relative(workspace.projectDir, buildScriptPath)} for editor plugin shared entries.`);
234166
+ throw new Error(`Unable to update ${path56.relative(workspace.projectDir, buildScriptPath)} for editor plugin shared entries.`);
233956
234167
  }
233957
234168
  return nextSource;
233958
234169
  });
233959
234170
  }
233960
234171
  async function ensureEditorPluginWebpackAnchors(workspace) {
233961
- const webpackConfigPath = path55.join(workspace.projectDir, "webpack.config.js");
234172
+ const webpackConfigPath = path56.join(workspace.projectDir, "webpack.config.js");
233962
234173
  await patchFile(webpackConfigPath, (source) => {
233963
234174
  if (/['"]editor-plugins\/index['"]/u.test(source)) {
233964
234175
  return source;
@@ -233986,43 +234197,56 @@ async function ensureEditorPluginWebpackAnchors(workspace) {
233986
234197
  }`;
233987
234198
  const nextSource = source.replace(legacySharedEntriesBlockPattern, nextSharedEntriesBlock);
233988
234199
  if (nextSource === source) {
233989
- throw new Error(`Unable to update ${path55.relative(workspace.projectDir, webpackConfigPath)} for editor plugin shared entries.`);
234200
+ throw new Error(`Unable to update ${path56.relative(workspace.projectDir, webpackConfigPath)} for editor plugin shared entries.`);
233990
234201
  }
233991
234202
  return nextSource;
233992
234203
  });
233993
234204
  }
233994
- function resolveBindingSourceRegistryPath(projectDir) {
233995
- const bindingsDir = path55.join(projectDir, "src", "bindings");
233996
- return [path55.join(bindingsDir, "index.ts"), path55.join(bindingsDir, "index.js")].find((candidatePath) => fs39.existsSync(candidatePath)) ?? path55.join(bindingsDir, "index.ts");
234205
+ async function resolveBindingSourceRegistryPath(projectDir) {
234206
+ const bindingsDir = path56.join(projectDir, "src", "bindings");
234207
+ for (const candidatePath of [
234208
+ path56.join(bindingsDir, "index.ts"),
234209
+ path56.join(bindingsDir, "index.js")
234210
+ ]) {
234211
+ if (await pathExists(candidatePath)) {
234212
+ return candidatePath;
234213
+ }
234214
+ }
234215
+ return path56.join(bindingsDir, "index.ts");
233997
234216
  }
233998
234217
  async function writeBindingSourceRegistry(projectDir, bindingSourceSlug) {
233999
- const bindingsDir = path55.join(projectDir, "src", "bindings");
234000
- const bindingsIndexPath = resolveBindingSourceRegistryPath(projectDir);
234218
+ const bindingsDir = path56.join(projectDir, "src", "bindings");
234219
+ const bindingsIndexPath = await resolveBindingSourceRegistryPath(projectDir);
234001
234220
  await fsp21.mkdir(bindingsDir, { recursive: true });
234002
- const existingBindingSourceSlugs = fs39.readdirSync(bindingsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
234221
+ const existingBindingSourceSlugs = (await fsp21.readdir(bindingsDir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
234003
234222
  const nextBindingSourceSlugs = Array.from(new Set([...existingBindingSourceSlugs, bindingSourceSlug])).sort();
234004
234223
  await fsp21.writeFile(bindingsIndexPath, buildBindingSourceIndexSource(nextBindingSourceSlugs), "utf8");
234005
234224
  }
234006
- function resolveEditorPluginRegistryPath(projectDir) {
234007
- const editorPluginsDir = path55.join(projectDir, "src", "editor-plugins");
234008
- return [
234009
- path55.join(editorPluginsDir, "index.ts"),
234010
- path55.join(editorPluginsDir, "index.js")
234011
- ].find((candidatePath) => fs39.existsSync(candidatePath)) ?? path55.join(editorPluginsDir, "index.ts");
234225
+ async function resolveEditorPluginRegistryPath(projectDir) {
234226
+ const editorPluginsDir = path56.join(projectDir, "src", "editor-plugins");
234227
+ for (const candidatePath of [
234228
+ path56.join(editorPluginsDir, "index.ts"),
234229
+ path56.join(editorPluginsDir, "index.js")
234230
+ ]) {
234231
+ if (await pathExists(candidatePath)) {
234232
+ return candidatePath;
234233
+ }
234234
+ }
234235
+ return path56.join(editorPluginsDir, "index.ts");
234012
234236
  }
234013
- function readEditorPluginRegistrySlugs(registryPath) {
234014
- if (!fs39.existsSync(registryPath)) {
234237
+ async function readEditorPluginRegistrySlugs(registryPath) {
234238
+ const source = await readOptionalUtf8File(registryPath);
234239
+ if (source === null) {
234015
234240
  return [];
234016
234241
  }
234017
- const source = fs39.readFileSync(registryPath, "utf8");
234018
234242
  return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
234019
234243
  }
234020
234244
  async function writeEditorPluginRegistry(projectDir, editorPluginSlug) {
234021
- const editorPluginsDir = path55.join(projectDir, "src", "editor-plugins");
234022
- const registryPath = resolveEditorPluginRegistryPath(projectDir);
234245
+ const editorPluginsDir = path56.join(projectDir, "src", "editor-plugins");
234246
+ const registryPath = await resolveEditorPluginRegistryPath(projectDir);
234023
234247
  await fsp21.mkdir(editorPluginsDir, { recursive: true });
234024
- const existingEditorPluginSlugs = readWorkspaceInventory(projectDir).editorPlugins.map((entry) => entry.slug);
234025
- const existingRegistrySlugs = readEditorPluginRegistrySlugs(registryPath);
234248
+ const existingEditorPluginSlugs = (await readWorkspaceInventoryAsync(projectDir)).editorPlugins.map((entry) => entry.slug);
234249
+ const existingRegistrySlugs = await readEditorPluginRegistrySlugs(registryPath);
234026
234250
  const nextEditorPluginSlugs = Array.from(new Set([...existingEditorPluginSlugs, ...existingRegistrySlugs, editorPluginSlug])).sort();
234027
234251
  await fsp21.writeFile(registryPath, buildEditorPluginRegistrySource(nextEditorPluginSlugs), "utf8");
234028
234252
  }
@@ -234034,19 +234258,19 @@ async function runAddEditorPluginCommand({
234034
234258
  const workspace = resolveWorkspaceProject(cwd);
234035
234259
  const editorPluginSlug = assertValidGeneratedSlug("Editor plugin name", normalizeBlockSlug(editorPluginName), "wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>]");
234036
234260
  const resolvedSlot = assertValidEditorPluginSlot(slot);
234037
- const inventory = readWorkspaceInventory(workspace.projectDir);
234261
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
234038
234262
  assertEditorPluginDoesNotExist(workspace.projectDir, editorPluginSlug, inventory);
234039
- const blockConfigPath = path55.join(workspace.projectDir, "scripts", "block-config.ts");
234263
+ const blockConfigPath = path56.join(workspace.projectDir, "scripts", "block-config.ts");
234040
234264
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
234041
- const buildScriptPath = path55.join(workspace.projectDir, "scripts", "build-workspace.mjs");
234042
- const editorPluginsIndexPath = resolveEditorPluginRegistryPath(workspace.projectDir);
234043
- const webpackConfigPath = path55.join(workspace.projectDir, "webpack.config.js");
234044
- const editorPluginDir = path55.join(workspace.projectDir, "src", "editor-plugins", editorPluginSlug);
234045
- const entryFilePath = path55.join(editorPluginDir, "index.tsx");
234046
- const surfaceFilePath = path55.join(editorPluginDir, "Surface.tsx");
234047
- const dataFilePath = path55.join(editorPluginDir, "data.ts");
234048
- const typesFilePath = path55.join(editorPluginDir, "types.ts");
234049
- const styleFilePath = path55.join(editorPluginDir, "style.scss");
234265
+ const buildScriptPath = path56.join(workspace.projectDir, "scripts", "build-workspace.mjs");
234266
+ const editorPluginsIndexPath = await resolveEditorPluginRegistryPath(workspace.projectDir);
234267
+ const webpackConfigPath = path56.join(workspace.projectDir, "webpack.config.js");
234268
+ const editorPluginDir = path56.join(workspace.projectDir, "src", "editor-plugins", editorPluginSlug);
234269
+ const entryFilePath = path56.join(editorPluginDir, "index.tsx");
234270
+ const surfaceFilePath = path56.join(editorPluginDir, "Surface.tsx");
234271
+ const dataFilePath = path56.join(editorPluginDir, "data.ts");
234272
+ const typesFilePath = path56.join(editorPluginDir, "types.ts");
234273
+ const styleFilePath = path56.join(editorPluginDir, "style.scss");
234050
234274
  const mutationSnapshot = {
234051
234275
  fileSources: await snapshotWorkspaceFiles([
234052
234276
  blockConfigPath,
@@ -234090,18 +234314,18 @@ async function runAddPatternCommand({
234090
234314
  }) {
234091
234315
  const workspace = resolveWorkspaceProject(cwd);
234092
234316
  const patternSlug = assertValidGeneratedSlug("Pattern name", normalizeBlockSlug(patternName), "wp-typia add pattern <name>");
234093
- const inventory = readWorkspaceInventory(workspace.projectDir);
234317
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
234094
234318
  assertPatternDoesNotExist(workspace.projectDir, patternSlug, inventory);
234095
- const blockConfigPath = path55.join(workspace.projectDir, "scripts", "block-config.ts");
234319
+ const blockConfigPath = path56.join(workspace.projectDir, "scripts", "block-config.ts");
234096
234320
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
234097
- const patternFilePath = path55.join(workspace.projectDir, "src", "patterns", `${patternSlug}.php`);
234321
+ const patternFilePath = path56.join(workspace.projectDir, "src", "patterns", `${patternSlug}.php`);
234098
234322
  const mutationSnapshot = {
234099
234323
  fileSources: await snapshotWorkspaceFiles([blockConfigPath, bootstrapPath]),
234100
234324
  snapshotDirs: [],
234101
234325
  targetPaths: [patternFilePath]
234102
234326
  };
234103
234327
  try {
234104
- await fsp21.mkdir(path55.dirname(patternFilePath), { recursive: true });
234328
+ await fsp21.mkdir(path56.dirname(patternFilePath), { recursive: true });
234105
234329
  await ensurePatternBootstrapAnchors(workspace);
234106
234330
  await fsp21.writeFile(patternFilePath, buildPatternSource(patternSlug, workspace.workspace.namespace, workspace.workspace.textDomain), "utf8");
234107
234331
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
@@ -234124,25 +234348,25 @@ async function runAddBindingSourceCommand({
234124
234348
  }) {
234125
234349
  const workspace = resolveWorkspaceProject(cwd);
234126
234350
  const bindingSourceSlug = assertValidGeneratedSlug("Binding source name", normalizeBlockSlug(bindingSourceName), "wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>]");
234127
- const inventory = readWorkspaceInventory(workspace.projectDir);
234351
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
234128
234352
  assertBindingSourceDoesNotExist(workspace.projectDir, bindingSourceSlug, inventory);
234129
234353
  const target = resolveBindingTarget({
234130
234354
  attributeName,
234131
234355
  blockName
234132
234356
  }, workspace.workspace.namespace);
234133
234357
  const targetBlock = target ? resolveWorkspaceBlock(inventory, target.blockSlug) : undefined;
234134
- const blockConfigPath = path55.join(workspace.projectDir, "scripts", "block-config.ts");
234358
+ const blockConfigPath = path56.join(workspace.projectDir, "scripts", "block-config.ts");
234135
234359
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
234136
- const bindingsIndexPath = resolveBindingSourceRegistryPath(workspace.projectDir);
234137
- const bindingSourceDir = path55.join(workspace.projectDir, "src", "bindings", bindingSourceSlug);
234138
- const serverFilePath = path55.join(bindingSourceDir, "server.php");
234139
- const editorFilePath = path55.join(bindingSourceDir, "editor.ts");
234140
- const blockJsonPath = target ? path55.join(workspace.projectDir, "src", "blocks", target.blockSlug, "block.json") : undefined;
234360
+ const bindingsIndexPath = await resolveBindingSourceRegistryPath(workspace.projectDir);
234361
+ const bindingSourceDir = path56.join(workspace.projectDir, "src", "bindings", bindingSourceSlug);
234362
+ const serverFilePath = path56.join(bindingSourceDir, "server.php");
234363
+ const editorFilePath = path56.join(bindingSourceDir, "editor.ts");
234364
+ const blockJsonPath = target ? path56.join(workspace.projectDir, "src", "blocks", target.blockSlug, "block.json") : undefined;
234141
234365
  const targetGeneratedMetadataPaths = target ? [
234142
- path55.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.manifest.json"),
234143
- path55.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.openapi.json"),
234144
- path55.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.schema.json"),
234145
- path55.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia-validator.php")
234366
+ path56.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.manifest.json"),
234367
+ path56.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.openapi.json"),
234368
+ path56.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia.schema.json"),
234369
+ path56.join(workspace.projectDir, "src", "blocks", target.blockSlug, "typia-validator.php")
234146
234370
  ] : [];
234147
234371
  const mutationSnapshot = {
234148
234372
  fileSources: await snapshotWorkspaceFiles([
@@ -234150,7 +234374,7 @@ async function runAddBindingSourceCommand({
234150
234374
  bootstrapPath,
234151
234375
  bindingsIndexPath,
234152
234376
  ...blockJsonPath ? [blockJsonPath] : [],
234153
- ...targetBlock ? [path55.join(workspace.projectDir, targetBlock.typesFile)] : [],
234377
+ ...targetBlock ? [path56.join(workspace.projectDir, targetBlock.typesFile)] : [],
234154
234378
  ...targetGeneratedMetadataPaths
234155
234379
  ]),
234156
234380
  snapshotDirs: [],
@@ -234178,20 +234402,23 @@ async function runAddBindingSourceCommand({
234178
234402
  throw error48;
234179
234403
  }
234180
234404
  }
234181
- var import_typescript2, PATTERN_BOOTSTRAP_CATEGORY = "register_block_pattern_category", BINDING_SOURCE_SERVER_GLOB = "/src/bindings/*/server.php", BINDING_SOURCE_EDITOR_SCRIPT = "build/bindings/index.js", BINDING_SOURCE_EDITOR_ASSET = "build/bindings/index.asset.php", EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", EDITOR_PLUGIN_EDITOR_STYLE_RTL = "build/editor-plugins/style-index-rtl.css", BINDING_ATTRIBUTE_NAME_PATTERN;
234405
+ var import_typescript3, PATTERN_BOOTSTRAP_CATEGORY = "register_block_pattern_category", BINDING_SOURCE_SERVER_GLOB = "/src/bindings/*/server.php", BINDING_SOURCE_EDITOR_SCRIPT = "build/bindings/index.js", BINDING_SOURCE_EDITOR_ASSET = "build/bindings/index.asset.php", EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", EDITOR_PLUGIN_EDITOR_STYLE_RTL = "build/editor-plugins/style-index-rtl.css", BINDING_ATTRIBUTE_NAME_PATTERN;
234182
234406
  var init_cli_add_workspace_assets = __esm(() => {
234183
234407
  init_workspace_project();
234184
234408
  init_workspace_inventory();
234185
234409
  init_string_case();
234186
234410
  init_cli_add_shared();
234187
234411
  init_cli_add_workspace_mutation();
234412
+ init_block_targets();
234413
+ init_fs_async();
234188
234414
  init_cli_validation();
234189
- import_typescript2 = __toESM(require_typescript(), 1);
234415
+ init_ts_property_names();
234416
+ import_typescript3 = __toESM(require_typescript(), 1);
234190
234417
  BINDING_ATTRIBUTE_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
234191
234418
  });
234192
234419
 
234193
234420
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-rest-anchors.ts
234194
- import path56 from "path";
234421
+ import path57 from "path";
234195
234422
  async function ensureRestResourceBootstrapAnchors(workspace) {
234196
234423
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
234197
234424
  await patchFile(bootstrapPath, (source) => {
@@ -234210,7 +234437,7 @@ function ${registerFunctionName}() {
234210
234437
  nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
234211
234438
  } else if (!nextSource.includes(REST_RESOURCE_SERVER_GLOB)) {
234212
234439
  throw new Error([
234213
- `Unable to patch ${path56.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
234440
+ `Unable to patch ${path57.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
234214
234441
  `The existing ${registerFunctionName}() definition does not include ${REST_RESOURCE_SERVER_GLOB}.`,
234215
234442
  "Restore the generated bootstrap shape or wire the REST resource loader manually before retrying."
234216
234443
  ].join(" "));
@@ -234224,7 +234451,7 @@ function ${registerFunctionName}() {
234224
234451
  function assertSyncRestAnchor(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath) {
234225
234452
  if (!nextSource.includes(target) && !hasAnchor) {
234226
234453
  throw new Error([
234227
- `ensureRestResourceSyncScriptAnchors could not patch ${path56.basename(syncRestScriptPath)}.`,
234454
+ `ensureRestResourceSyncScriptAnchors could not patch ${path57.basename(syncRestScriptPath)}.`,
234228
234455
  `Missing expected ${anchorDescription} anchor in scripts/sync-rest-contracts.ts.`,
234229
234456
  "Restore the generated template or add the REST_RESOURCES wiring manually before retrying."
234230
234457
  ].join(" "));
@@ -234239,7 +234466,7 @@ function replaceRequiredSyncRestSource(nextSource, target, anchor, replacement,
234239
234466
  return nextSource.replace(anchor, replacement);
234240
234467
  }
234241
234468
  async function ensureRestResourceSyncScriptAnchors(workspace) {
234242
- const syncRestScriptPath = path56.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
234469
+ const syncRestScriptPath = path57.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
234243
234470
  await patchFile(syncRestScriptPath, (source) => {
234244
234471
  let nextSource = source;
234245
234472
  const importAnchor = "import { BLOCKS, type WorkspaceBlockConfig } from './block-config';";
@@ -234362,7 +234589,7 @@ var init_cli_add_workspace_rest_anchors = __esm(() => {
234362
234589
  });
234363
234590
 
234364
234591
  // ../wp-typia-project-tools/src/runtime/rest-resource-artifacts.ts
234365
- import path57 from "path";
234592
+ import path58 from "path";
234366
234593
  import {
234367
234594
  defineEndpointManifest as defineEndpointManifest2,
234368
234595
  syncEndpointClient as syncEndpointClient2,
@@ -234498,8 +234725,8 @@ async function syncRestResourceArtifacts({
234498
234725
  const manifest = buildRestResourceEndpointManifest(variables, methods);
234499
234726
  for (const [baseName, contract] of Object.entries(manifest.contracts)) {
234500
234727
  await syncTypeSchemas2({
234501
- jsonSchemaFile: path57.join(outputDir, "api-schemas", `${baseName}.schema.json`),
234502
- openApiFile: path57.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
234728
+ jsonSchemaFile: path58.join(outputDir, "api-schemas", `${baseName}.schema.json`),
234729
+ openApiFile: path58.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
234503
234730
  projectRoot: projectDir,
234504
234731
  sourceTypeName: contract.sourceTypeName,
234505
234732
  typesFile
@@ -234507,7 +234734,7 @@ async function syncRestResourceArtifacts({
234507
234734
  }
234508
234735
  await syncRestOpenApi2({
234509
234736
  manifest,
234510
- openApiFile: path57.join(outputDir, "api.openapi.json"),
234737
+ openApiFile: path58.join(outputDir, "api.openapi.json"),
234511
234738
  projectRoot: projectDir,
234512
234739
  typesFile
234513
234740
  });
@@ -234910,7 +235137,7 @@ var init_cli_add_workspace_rest_source_emitters = __esm(() => {
234910
235137
 
234911
235138
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-rest.ts
234912
235139
  import { promises as fsp22 } from "fs";
234913
- import path58 from "path";
235140
+ import path59 from "path";
234914
235141
  function buildRestResourceRouteRegistrations(restResourceSlug, methods, functions) {
234915
235142
  const collectionRoutes = [];
234916
235143
  const itemRoutes = [];
@@ -235338,17 +235565,17 @@ async function runAddRestResourceCommand({
235338
235565
  const restResourceSlug = assertValidGeneratedSlug("REST resource name", normalizeBlockSlug(restResourceName), "wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>]");
235339
235566
  const resolvedMethods = assertValidRestResourceMethods(methods);
235340
235567
  const resolvedNamespace = resolveRestResourceNamespace(workspace.workspace.namespace, namespace);
235341
- const inventory = readWorkspaceInventory(workspace.projectDir);
235568
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
235342
235569
  assertRestResourceDoesNotExist(workspace.projectDir, restResourceSlug, inventory);
235343
- const blockConfigPath = path58.join(workspace.projectDir, "scripts", "block-config.ts");
235570
+ const blockConfigPath = path59.join(workspace.projectDir, "scripts", "block-config.ts");
235344
235571
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
235345
- const syncRestScriptPath = path58.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
235346
- const restResourceDir = path58.join(workspace.projectDir, "src", "rest", restResourceSlug);
235347
- const typesFilePath = path58.join(restResourceDir, "api-types.ts");
235348
- const validatorsFilePath = path58.join(restResourceDir, "api-validators.ts");
235349
- const apiFilePath = path58.join(restResourceDir, "api.ts");
235350
- const dataFilePath = path58.join(restResourceDir, "data.ts");
235351
- const phpFilePath = path58.join(workspace.projectDir, "inc", "rest", `${restResourceSlug}.php`);
235572
+ const syncRestScriptPath = path59.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
235573
+ const restResourceDir = path59.join(workspace.projectDir, "src", "rest", restResourceSlug);
235574
+ const typesFilePath = path59.join(restResourceDir, "api-types.ts");
235575
+ const validatorsFilePath = path59.join(restResourceDir, "api-validators.ts");
235576
+ const apiFilePath = path59.join(restResourceDir, "api.ts");
235577
+ const dataFilePath = path59.join(restResourceDir, "data.ts");
235578
+ const phpFilePath = path59.join(workspace.projectDir, "inc", "rest", `${restResourceSlug}.php`);
235352
235579
  const mutationSnapshot = {
235353
235580
  fileSources: await snapshotWorkspaceFiles([
235354
235581
  blockConfigPath,
@@ -235360,7 +235587,7 @@ async function runAddRestResourceCommand({
235360
235587
  };
235361
235588
  try {
235362
235589
  await fsp22.mkdir(restResourceDir, { recursive: true });
235363
- await fsp22.mkdir(path58.dirname(phpFilePath), { recursive: true });
235590
+ await fsp22.mkdir(path59.dirname(phpFilePath), { recursive: true });
235364
235591
  await ensureRestResourceBootstrapAnchors(workspace);
235365
235592
  await ensureRestResourceSyncScriptAnchors(workspace);
235366
235593
  await fsp22.writeFile(typesFilePath, buildRestResourceTypesSource(restResourceSlug, resolvedMethods), "utf8");
@@ -235885,9 +236112,8 @@ var init_cli_add_workspace_ability_templates = __esm(() => {
235885
236112
  });
235886
236113
 
235887
236114
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ability-scaffold.ts
235888
- import fs40 from "fs";
235889
236115
  import { promises as fsp23 } from "fs";
235890
- import path59 from "path";
236116
+ import path60 from "path";
235891
236117
  import { syncTypeSchemas as syncTypeSchemas3 } from "@wp-typia/block-runtime/metadata-core";
235892
236118
  function resolveManagedDependencyVersion(existingVersion, requiredVersion) {
235893
236119
  if (!existingVersion) {
@@ -235900,26 +236126,34 @@ function resolveManagedDependencyVersion(existingVersion, requiredVersion) {
235900
236126
  }
235901
236127
  return import_semver2.default.gte(existingMinimum, requiredMinimum) ? existingVersion : requiredVersion;
235902
236128
  }
235903
- function resolveAbilityRegistryPath(projectDir) {
235904
- const abilitiesDir = path59.join(projectDir, "src", "abilities");
235905
- return [path59.join(abilitiesDir, "index.ts"), path59.join(abilitiesDir, "index.js")].find((candidatePath) => fs40.existsSync(candidatePath)) ?? path59.join(abilitiesDir, "index.ts");
236129
+ async function resolveAbilityRegistryPath(projectDir) {
236130
+ const abilitiesDir = path60.join(projectDir, "src", "abilities");
236131
+ for (const candidatePath of [
236132
+ path60.join(abilitiesDir, "index.ts"),
236133
+ path60.join(abilitiesDir, "index.js")
236134
+ ]) {
236135
+ if (await pathExists(candidatePath)) {
236136
+ return candidatePath;
236137
+ }
236138
+ }
236139
+ return path60.join(abilitiesDir, "index.ts");
235906
236140
  }
235907
- function readAbilityRegistrySlugs(registryPath) {
235908
- if (!fs40.existsSync(registryPath)) {
236141
+ async function readAbilityRegistrySlugs(registryPath) {
236142
+ const source = await readOptionalUtf8File(registryPath);
236143
+ if (source === null) {
235909
236144
  return [];
235910
236145
  }
235911
- const source = fs40.readFileSync(registryPath, "utf8");
235912
- return Array.from(source.matchAll(/^\s*export\s+\*\s+from\s+['"]\.\/([^/'"]+)\/client['"];?\s*$/gmu)).map((match3) => match3[1]);
236146
+ return Array.from(source.matchAll(/^\s*export\s+\*\s+from\s+['"]\.\/([^/'"]+)\/client(?:\.[cm]?[jt]sx?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
235913
236147
  }
235914
236148
  async function writeAbilityRegistry(projectDir, abilitySlug) {
235915
- const abilitiesDir = path59.join(projectDir, "src", "abilities");
235916
- const registryPath = resolveAbilityRegistryPath(projectDir);
236149
+ const abilitiesDir = path60.join(projectDir, "src", "abilities");
236150
+ const registryPath = await resolveAbilityRegistryPath(projectDir);
235917
236151
  await fsp23.mkdir(abilitiesDir, { recursive: true });
235918
- const existingAbilitySlugs = readWorkspaceInventory(projectDir).abilities.map((entry) => entry.slug);
235919
- const existingRegistrySlugs = readAbilityRegistrySlugs(registryPath);
236152
+ const existingAbilitySlugs = (await readWorkspaceInventoryAsync(projectDir)).abilities.map((entry) => entry.slug);
236153
+ const existingRegistrySlugs = await readAbilityRegistrySlugs(registryPath);
235920
236154
  const nextAbilitySlugs = Array.from(new Set([...existingAbilitySlugs, ...existingRegistrySlugs, abilitySlug])).sort();
235921
236155
  const generatedSection = buildAbilityRegistrySource(nextAbilitySlugs);
235922
- const existingSource = fs40.existsSync(registryPath) ? fs40.readFileSync(registryPath, "utf8") : "";
236156
+ const existingSource = await readOptionalUtf8File(registryPath) ?? "";
235923
236157
  const generatedSectionPattern = new RegExp(`${escapeRegex2(ABILITY_REGISTRY_START_MARKER)}[\\s\\S]*?${escapeRegex2(ABILITY_REGISTRY_END_MARKER)}\\n?`, "u");
235924
236158
  const nextSource = existingSource ? generatedSectionPattern.test(existingSource) ? existingSource.replace(generatedSectionPattern, generatedSection) : `${existingSource.trimEnd()}
235925
236159
 
@@ -236006,7 +236240,7 @@ function ${enqueueFunctionName}() {
236006
236240
  if (!hasPhpFunctionCall(functionSource, "wp_enqueue_script_module")) {
236007
236241
  const replacedSource = replacePhpFunctionDefinition(nextSource, enqueueFunctionName, enqueueFunction, { trimReplacementStart: true });
236008
236242
  if (!replacedSource) {
236009
- throw new Error(`Unable to repair ${path59.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
236243
+ throw new Error(`Unable to repair ${path60.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
236010
236244
  }
236011
236245
  nextSource = replacedSource;
236012
236246
  }
@@ -236024,7 +236258,7 @@ function ${enqueueFunctionName}() {
236024
236258
  });
236025
236259
  }
236026
236260
  async function ensureAbilityPackageScripts(workspace) {
236027
- const packageJsonPath = path59.join(workspace.projectDir, "package.json");
236261
+ const packageJsonPath = path60.join(workspace.projectDir, "package.json");
236028
236262
  const packageJson = JSON.parse(await fsp23.readFile(packageJsonPath, "utf8"));
236029
236263
  const nextScripts = {
236030
236264
  ...packageJson.scripts ?? {},
@@ -236044,7 +236278,7 @@ async function ensureAbilityPackageScripts(workspace) {
236044
236278
  `, "utf8");
236045
236279
  }
236046
236280
  async function ensureAbilitySyncProjectAnchors(workspace) {
236047
- const syncProjectScriptPath = path59.join(workspace.projectDir, "scripts", "sync-project.ts");
236281
+ const syncProjectScriptPath = path60.join(workspace.projectDir, "scripts", "sync-project.ts");
236048
236282
  await patchFile(syncProjectScriptPath, (source) => {
236049
236283
  let nextSource = source;
236050
236284
  const syncRestConst = "const syncRestScriptPath = path.join( 'scripts', 'sync-rest-contracts.ts' );";
@@ -236059,7 +236293,7 @@ async function ensureAbilitySyncProjectAnchors(workspace) {
236059
236293
  if (!nextSource.includes(syncAbilitiesConst)) {
236060
236294
  if (!nextSource.includes(syncRestConst)) {
236061
236295
  throw new Error([
236062
- `ensureAbilitySyncProjectAnchors could not patch ${path59.basename(syncProjectScriptPath)}.`,
236296
+ `ensureAbilitySyncProjectAnchors could not patch ${path60.basename(syncProjectScriptPath)}.`,
236063
236297
  "Missing the expected sync-rest script constant in scripts/sync-project.ts.",
236064
236298
  "Restore the generated template or wire sync-abilities manually before retrying."
236065
236299
  ].join(" "));
@@ -236070,7 +236304,7 @@ ${syncAbilitiesConst}`);
236070
236304
  if (!nextSource.includes("runSyncScript( syncAbilitiesScriptPath, options );")) {
236071
236305
  if (!syncRestBlockPattern.test(nextSource)) {
236072
236306
  throw new Error([
236073
- `ensureAbilitySyncProjectAnchors could not patch ${path59.basename(syncProjectScriptPath)}.`,
236307
+ `ensureAbilitySyncProjectAnchors could not patch ${path60.basename(syncProjectScriptPath)}.`,
236074
236308
  "Missing the expected sync-rest invocation block in scripts/sync-project.ts.",
236075
236309
  "Restore the generated template or wire sync-abilities manually before retrying."
236076
236310
  ].join(" "));
@@ -236083,7 +236317,7 @@ ${syncAbilitiesBlock}`);
236083
236317
  });
236084
236318
  }
236085
236319
  async function ensureAbilityBuildScriptAnchors(workspace) {
236086
- const buildScriptPath = path59.join(workspace.projectDir, "scripts", "build-workspace.mjs");
236320
+ const buildScriptPath = path60.join(workspace.projectDir, "scripts", "build-workspace.mjs");
236087
236321
  await patchFile(buildScriptPath, (source) => {
236088
236322
  let nextSource = source;
236089
236323
  if (/['"]src\/abilities\/index\.(?:ts|js)['"]/u.test(nextSource)) {
@@ -236093,7 +236327,7 @@ async function ensureAbilityBuildScriptAnchors(workspace) {
236093
236327
  const match3 = nextSource.match(sharedEntriesPattern);
236094
236328
  if (!match3 || !/['"]src\/bindings\/index\.(?:ts|js)['"]/u.test(match3[2]) || !/['"]src\/editor-plugins\/index\.(?:tsx|ts|js)['"]/u.test(match3[2])) {
236095
236329
  throw new Error([
236096
- `ensureAbilityBuildScriptAnchors could not patch ${path59.basename(buildScriptPath)}.`,
236330
+ `ensureAbilityBuildScriptAnchors could not patch ${path60.basename(buildScriptPath)}.`,
236097
236331
  "Missing the expected shared editor entries array in scripts/build-workspace.mjs.",
236098
236332
  "Restore the generated template or wire abilities/index manually before retrying."
236099
236333
  ].join(" "));
@@ -236118,7 +236352,7 @@ ${itemIndent}${entry},`).join("") + trailingWhitespace;
236118
236352
  });
236119
236353
  }
236120
236354
  async function ensureAbilityWebpackAnchors(workspace) {
236121
- const webpackConfigPath = path59.join(workspace.projectDir, "webpack.config.js");
236355
+ const webpackConfigPath = path60.join(workspace.projectDir, "webpack.config.js");
236122
236356
  await patchFile(webpackConfigPath, (source) => {
236123
236357
  if (/['"]abilities\/index['"]/u.test(source)) {
236124
236358
  return source;
@@ -236148,7 +236382,7 @@ async function ensureAbilityWebpackAnchors(workspace) {
236148
236382
  const match3 = source.match(sharedEntriesPattern);
236149
236383
  if (!match3 || !match3[1].includes("bindings/index") || !match3[1].includes("editor-plugins/index")) {
236150
236384
  throw new Error([
236151
- `ensureAbilityWebpackAnchors could not patch ${path59.basename(webpackConfigPath)}.`,
236385
+ `ensureAbilityWebpackAnchors could not patch ${path60.basename(webpackConfigPath)}.`,
236152
236386
  "Missing the expected shared editor entries block in webpack.config.js.",
236153
236387
  "Restore the generated template or wire abilities/index manually before retrying."
236154
236388
  ].join(" "));
@@ -236181,20 +236415,20 @@ async function scaffoldAbilityWorkspace({
236181
236415
  workspace
236182
236416
  }) {
236183
236417
  const compatibilityWarnings = [];
236184
- const blockConfigPath = path59.join(workspace.projectDir, "scripts", "block-config.ts");
236418
+ const blockConfigPath = path60.join(workspace.projectDir, "scripts", "block-config.ts");
236185
236419
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
236186
- const buildScriptPath = path59.join(workspace.projectDir, "scripts", "build-workspace.mjs");
236187
- const packageJsonPath = path59.join(workspace.projectDir, "package.json");
236188
- const syncAbilitiesScriptPath = path59.join(workspace.projectDir, "scripts", "sync-abilities.ts");
236189
- const syncProjectScriptPath = path59.join(workspace.projectDir, "scripts", "sync-project.ts");
236190
- const webpackConfigPath = path59.join(workspace.projectDir, "webpack.config.js");
236191
- const abilitiesIndexPath = resolveAbilityRegistryPath(workspace.projectDir);
236192
- const abilityDir = path59.join(workspace.projectDir, "src", "abilities", abilitySlug);
236193
- const configFilePath = path59.join(abilityDir, "ability.config.json");
236194
- const typesFilePath = path59.join(abilityDir, "types.ts");
236195
- const dataFilePath = path59.join(abilityDir, "data.ts");
236196
- const clientFilePath = path59.join(abilityDir, "client.ts");
236197
- const phpFilePath = path59.join(workspace.projectDir, "inc", "abilities", `${abilitySlug}.php`);
236420
+ const buildScriptPath = path60.join(workspace.projectDir, "scripts", "build-workspace.mjs");
236421
+ const packageJsonPath = path60.join(workspace.projectDir, "package.json");
236422
+ const syncAbilitiesScriptPath = path60.join(workspace.projectDir, "scripts", "sync-abilities.ts");
236423
+ const syncProjectScriptPath = path60.join(workspace.projectDir, "scripts", "sync-project.ts");
236424
+ const webpackConfigPath = path60.join(workspace.projectDir, "webpack.config.js");
236425
+ const abilitiesIndexPath = await resolveAbilityRegistryPath(workspace.projectDir);
236426
+ const abilityDir = path60.join(workspace.projectDir, "src", "abilities", abilitySlug);
236427
+ const configFilePath = path60.join(abilityDir, "ability.config.json");
236428
+ const typesFilePath = path60.join(abilityDir, "types.ts");
236429
+ const dataFilePath = path60.join(abilityDir, "data.ts");
236430
+ const clientFilePath = path60.join(abilityDir, "client.ts");
236431
+ const phpFilePath = path60.join(workspace.projectDir, "inc", "abilities", `${abilitySlug}.php`);
236198
236432
  await executeWorkspaceMutationPlan({
236199
236433
  filePaths: [
236200
236434
  blockConfigPath,
@@ -236209,7 +236443,7 @@ async function scaffoldAbilityWorkspace({
236209
236443
  targetPaths: [abilityDir, phpFilePath, syncAbilitiesScriptPath],
236210
236444
  run: async () => {
236211
236445
  await fsp23.mkdir(abilityDir, { recursive: true });
236212
- await fsp23.mkdir(path59.dirname(phpFilePath), { recursive: true });
236446
+ await fsp23.mkdir(path60.dirname(phpFilePath), { recursive: true });
236213
236447
  await ensureAbilityBootstrapAnchors(workspace);
236214
236448
  await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy, {
236215
236449
  onWarning: (warning) => {
@@ -236254,6 +236488,7 @@ async function scaffoldAbilityWorkspace({
236254
236488
  var import_semver2;
236255
236489
  var init_cli_add_workspace_ability_scaffold = __esm(() => {
236256
236490
  init_workspace_inventory();
236491
+ init_fs_async();
236257
236492
  init_cli_add_workspace_ability_templates();
236258
236493
  init_cli_add_shared();
236259
236494
  init_cli_add_workspace_mutation();
@@ -236270,7 +236505,7 @@ async function runAddAbilityCommand({
236270
236505
  }) {
236271
236506
  const workspace = resolveWorkspaceProject(cwd);
236272
236507
  const abilitySlug = assertValidGeneratedSlug("Ability name", normalizeBlockSlug(abilityName), "wp-typia add ability <name>");
236273
- const inventory = readWorkspaceInventory(workspace.projectDir);
236508
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
236274
236509
  assertAbilityDoesNotExist(workspace.projectDir, abilitySlug, inventory);
236275
236510
  const compatibilityPolicy = resolveScaffoldCompatibilityPolicy(REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY);
236276
236511
  const scaffoldResult = await scaffoldAbilityWorkspace({
@@ -236321,7 +236556,7 @@ var init_ai_artifacts = __esm(() => {
236321
236556
 
236322
236557
  // ../wp-typia-project-tools/src/runtime/ai-feature-artifacts.ts
236323
236558
  import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
236324
- import path60 from "path";
236559
+ import path61 from "path";
236325
236560
  import {
236326
236561
  defineEndpointManifest as defineEndpointManifest3,
236327
236562
  syncEndpointClient as syncEndpointClient3,
@@ -236334,7 +236569,7 @@ function normalizeGeneratedArtifactContent(content) {
236334
236569
  }
236335
236570
  async function reconcileGeneratedArtifact(options) {
236336
236571
  if (!options.check) {
236337
- await mkdir3(path60.dirname(options.filePath), {
236572
+ await mkdir3(path61.dirname(options.filePath), {
236338
236573
  recursive: true
236339
236574
  });
236340
236575
  await writeFile5(options.filePath, options.content, "utf8");
@@ -236406,8 +236641,8 @@ async function syncAiFeatureRestArtifacts({
236406
236641
  const manifest = buildAiFeatureEndpointManifest(variables);
236407
236642
  for (const [baseName, contract] of Object.entries(manifest.contracts)) {
236408
236643
  await syncTypeSchemas4({
236409
- jsonSchemaFile: path60.join(outputDir, "api-schemas", `${baseName}.schema.json`),
236410
- openApiFile: path60.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
236644
+ jsonSchemaFile: path61.join(outputDir, "api-schemas", `${baseName}.schema.json`),
236645
+ openApiFile: path61.join(outputDir, "api-schemas", `${baseName}.openapi.json`),
236411
236646
  projectRoot: projectDir,
236412
236647
  sourceTypeName: contract.sourceTypeName,
236413
236648
  typesFile
@@ -236415,7 +236650,7 @@ async function syncAiFeatureRestArtifacts({
236415
236650
  }
236416
236651
  await syncRestOpenApi3({
236417
236652
  manifest,
236418
- openApiFile: path60.join(outputDir, "api.openapi.json"),
236653
+ openApiFile: path61.join(outputDir, "api.openapi.json"),
236419
236654
  projectRoot: projectDir,
236420
236655
  typesFile
236421
236656
  }, executionOptions);
@@ -236433,19 +236668,19 @@ async function syncAiFeatureSchemaArtifact({
236433
236668
  outputDir,
236434
236669
  projectDir
236435
236670
  }) {
236436
- const sourceSchemaPath = path60.join(projectDir, outputDir, "api-schemas", "feature-result.schema.json");
236671
+ const sourceSchemaPath = path61.join(projectDir, outputDir, "api-schemas", "feature-result.schema.json");
236437
236672
  const responseSchema = assertJsonObject(JSON.parse(await readFile5(sourceSchemaPath, "utf8")), sourceSchemaPath);
236438
236673
  const aiSchema = projectWordPressAiSchema(responseSchema);
236439
236674
  await reconcileGeneratedArtifact({
236440
236675
  check: check2,
236441
236676
  content: `${JSON.stringify(aiSchema, null, 2)}
236442
236677
  `,
236443
- filePath: path60.join(projectDir, aiSchemaFile),
236678
+ filePath: path61.join(projectDir, aiSchemaFile),
236444
236679
  label: "AI feature schema"
236445
236680
  });
236446
236681
  return {
236447
236682
  aiSchema,
236448
- aiSchemaPath: path60.join(projectDir, aiSchemaFile),
236683
+ aiSchemaPath: path61.join(projectDir, aiSchemaFile),
236449
236684
  check: check2,
236450
236685
  sourceSchemaPath
236451
236686
  };
@@ -236896,7 +237131,7 @@ var init_cli_add_workspace_ai_source_emitters = __esm(() => {
236896
237131
 
236897
237132
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai-anchors.ts
236898
237133
  import { promises as fsp24 } from "fs";
236899
- import path61 from "path";
237134
+ import path62 from "path";
236900
237135
  async function ensureAiFeatureBootstrapAnchors(workspace) {
236901
237136
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
236902
237137
  await patchFile(bootstrapPath, (source) => {
@@ -236915,7 +237150,7 @@ function ${registerFunctionName}() {
236915
237150
  nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
236916
237151
  } else if (!nextSource.includes(AI_FEATURE_SERVER_GLOB)) {
236917
237152
  throw new Error([
236918
- `Unable to patch ${path61.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
237153
+ `Unable to patch ${path62.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
236919
237154
  `The existing ${registerFunctionName}() definition does not include ${AI_FEATURE_SERVER_GLOB}.`,
236920
237155
  "Restore the generated bootstrap shape or wire the AI feature loader manually before retrying."
236921
237156
  ].join(" "));
@@ -236927,7 +237162,7 @@ function ${registerFunctionName}() {
236927
237162
  });
236928
237163
  }
236929
237164
  async function ensureAiFeaturePackageScripts(workspace) {
236930
- const packageJsonPath = path61.join(workspace.projectDir, "package.json");
237165
+ const packageJsonPath = path62.join(workspace.projectDir, "package.json");
236931
237166
  const packageJson = JSON.parse(await fsp24.readFile(packageJsonPath, "utf8"));
236932
237167
  const nextScripts = {
236933
237168
  ...packageJson.scripts ?? {},
@@ -236955,7 +237190,7 @@ async function ensureAiFeaturePackageScripts(workspace) {
236955
237190
  };
236956
237191
  }
236957
237192
  async function ensureAiFeatureSyncProjectAnchors(workspace) {
236958
- const syncProjectScriptPath = path61.join(workspace.projectDir, "scripts", "sync-project.ts");
237193
+ const syncProjectScriptPath = path62.join(workspace.projectDir, "scripts", "sync-project.ts");
236959
237194
  await patchFile(syncProjectScriptPath, (source) => {
236960
237195
  let nextSource = source;
236961
237196
  const syncRestConst = "const syncRestScriptPath = path.join( 'scripts', 'sync-rest-contracts.ts' );";
@@ -236970,7 +237205,7 @@ async function ensureAiFeatureSyncProjectAnchors(workspace) {
236970
237205
  if (!nextSource.includes(syncAiConst)) {
236971
237206
  if (!nextSource.includes(syncRestConst)) {
236972
237207
  throw new Error([
236973
- `ensureAiFeatureSyncProjectAnchors could not patch ${path61.basename(syncProjectScriptPath)}.`,
237208
+ `ensureAiFeatureSyncProjectAnchors could not patch ${path62.basename(syncProjectScriptPath)}.`,
236974
237209
  "Missing the expected sync-rest script constant in scripts/sync-project.ts.",
236975
237210
  "Restore the generated template or wire sync-ai manually before retrying."
236976
237211
  ].join(" "));
@@ -236981,7 +237216,7 @@ ${syncAiConst}`);
236981
237216
  if (!nextSource.includes("runSyncScript( syncAiScriptPath, options );")) {
236982
237217
  if (!syncRestBlockPattern.test(nextSource)) {
236983
237218
  throw new Error([
236984
- `ensureAiFeatureSyncProjectAnchors could not patch ${path61.basename(syncProjectScriptPath)}.`,
237219
+ `ensureAiFeatureSyncProjectAnchors could not patch ${path62.basename(syncProjectScriptPath)}.`,
236985
237220
  "Missing the expected sync-rest invocation block in scripts/sync-project.ts.",
236986
237221
  "Restore the generated template or wire sync-ai manually before retrying."
236987
237222
  ].join(" "));
@@ -236996,7 +237231,7 @@ ${syncAiBlock}`);
236996
237231
  function assertSyncRestAnchor2(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath) {
236997
237232
  if (!nextSource.includes(target) && !hasAnchor) {
236998
237233
  throw new Error([
236999
- `ensureAiFeatureSyncRestAnchors could not patch ${path61.basename(syncRestScriptPath)}.`,
237234
+ `ensureAiFeatureSyncRestAnchors could not patch ${path62.basename(syncRestScriptPath)}.`,
237000
237235
  `Missing expected ${anchorDescription} anchor in scripts/sync-rest-contracts.ts.`,
237001
237236
  "Restore the generated template or add the AI feature wiring manually before retrying."
237002
237237
  ].join(" "));
@@ -237011,7 +237246,7 @@ function replaceRequiredSyncRestSource2(nextSource, target, anchor, replacement,
237011
237246
  return nextSource.replace(anchor, replacement);
237012
237247
  }
237013
237248
  async function ensureAiFeatureSyncRestAnchors(workspace) {
237014
- const syncRestScriptPath = path61.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
237249
+ const syncRestScriptPath = path62.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
237015
237250
  await patchFile(syncRestScriptPath, (source) => {
237016
237251
  let nextSource = source;
237017
237252
  const importAnchor = [
@@ -237754,7 +237989,7 @@ var init_cli_add_workspace_ai_templates = __esm(() => {
237754
237989
 
237755
237990
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai-scaffold.ts
237756
237991
  import { promises as fsp25 } from "fs";
237757
- import path62 from "path";
237992
+ import path63 from "path";
237758
237993
  async function scaffoldAiFeatureWorkspace({
237759
237994
  aiFeatureSlug,
237760
237995
  compatibilityPolicy,
@@ -237762,18 +237997,18 @@ async function scaffoldAiFeatureWorkspace({
237762
237997
  workspace
237763
237998
  }) {
237764
237999
  const compatibilityWarnings = [];
237765
- const blockConfigPath = path62.join(workspace.projectDir, "scripts", "block-config.ts");
238000
+ const blockConfigPath = path63.join(workspace.projectDir, "scripts", "block-config.ts");
237766
238001
  const bootstrapPath = getWorkspaceBootstrapPath(workspace);
237767
- const packageJsonPath = path62.join(workspace.projectDir, "package.json");
237768
- const syncAiScriptPath = path62.join(workspace.projectDir, "scripts", "sync-ai-features.ts");
237769
- const syncProjectScriptPath = path62.join(workspace.projectDir, "scripts", "sync-project.ts");
237770
- const syncRestScriptPath = path62.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
237771
- const aiFeatureDir = path62.join(workspace.projectDir, "src", "ai-features", aiFeatureSlug);
237772
- const typesFilePath = path62.join(aiFeatureDir, "api-types.ts");
237773
- const validatorsFilePath = path62.join(aiFeatureDir, "api-validators.ts");
237774
- const apiFilePath = path62.join(aiFeatureDir, "api.ts");
237775
- const dataFilePath = path62.join(aiFeatureDir, "data.ts");
237776
- const phpFilePath = path62.join(workspace.projectDir, "inc", "ai-features", `${aiFeatureSlug}.php`);
238002
+ const packageJsonPath = path63.join(workspace.projectDir, "package.json");
238003
+ const syncAiScriptPath = path63.join(workspace.projectDir, "scripts", "sync-ai-features.ts");
238004
+ const syncProjectScriptPath = path63.join(workspace.projectDir, "scripts", "sync-project.ts");
238005
+ const syncRestScriptPath = path63.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
238006
+ const aiFeatureDir = path63.join(workspace.projectDir, "src", "ai-features", aiFeatureSlug);
238007
+ const typesFilePath = path63.join(aiFeatureDir, "api-types.ts");
238008
+ const validatorsFilePath = path63.join(aiFeatureDir, "api-validators.ts");
238009
+ const apiFilePath = path63.join(aiFeatureDir, "api.ts");
238010
+ const dataFilePath = path63.join(aiFeatureDir, "data.ts");
238011
+ const phpFilePath = path63.join(workspace.projectDir, "inc", "ai-features", `${aiFeatureSlug}.php`);
237777
238012
  return executeWorkspaceMutationPlan({
237778
238013
  filePaths: [
237779
238014
  blockConfigPath,
@@ -237786,7 +238021,7 @@ async function scaffoldAiFeatureWorkspace({
237786
238021
  targetPaths: [aiFeatureDir, phpFilePath, syncAiScriptPath],
237787
238022
  run: async () => {
237788
238023
  await fsp25.mkdir(aiFeatureDir, { recursive: true });
237789
- await fsp25.mkdir(path62.dirname(phpFilePath), { recursive: true });
238024
+ await fsp25.mkdir(path63.dirname(phpFilePath), { recursive: true });
237790
238025
  await ensureAiFeatureBootstrapAnchors(workspace);
237791
238026
  await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy, {
237792
238027
  onWarning: (warning) => {
@@ -237805,7 +238040,7 @@ async function scaffoldAiFeatureWorkspace({
237805
238040
  const pascalCase = toPascalCase(aiFeatureSlug);
237806
238041
  await syncAiFeatureRestArtifacts({
237807
238042
  clientFile: `src/ai-features/${aiFeatureSlug}/api-client.ts`,
237808
- outputDir: path62.join("src", "ai-features", aiFeatureSlug),
238043
+ outputDir: path63.join("src", "ai-features", aiFeatureSlug),
237809
238044
  projectDir: workspace.projectDir,
237810
238045
  typesFile: `src/ai-features/${aiFeatureSlug}/api-types.ts`,
237811
238046
  validatorsFile: `src/ai-features/${aiFeatureSlug}/api-validators.ts`,
@@ -237818,7 +238053,7 @@ async function scaffoldAiFeatureWorkspace({
237818
238053
  });
237819
238054
  await syncAiFeatureSchemaArtifact({
237820
238055
  aiSchemaFile: `src/ai-features/${aiFeatureSlug}/ai-schemas/feature-result.ai.schema.json`,
237821
- outputDir: path62.join("src", "ai-features", aiFeatureSlug),
238056
+ outputDir: path63.join("src", "ai-features", aiFeatureSlug),
237822
238057
  projectDir: workspace.projectDir
237823
238058
  });
237824
238059
  await appendWorkspaceInventoryEntries(workspace.projectDir, {
@@ -237861,7 +238096,7 @@ async function runAddAiFeatureCommand({
237861
238096
  const aiFeatureSlug = assertValidGeneratedSlug("AI feature name", normalizeBlockSlug(aiFeatureName), "wp-typia add ai-feature <name> [--namespace <vendor/v1>]");
237862
238097
  const resolvedNamespace = resolveRestResourceNamespace(workspace.workspace.namespace, namespace);
237863
238098
  const compatibilityPolicy = resolveScaffoldCompatibilityPolicy(OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY);
237864
- const inventory = readWorkspaceInventory(workspace.projectDir);
238099
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
237865
238100
  assertAiFeatureDoesNotExist(workspace.projectDir, aiFeatureSlug, inventory);
237866
238101
  const scaffoldResult = await scaffoldAiFeatureWorkspace({
237867
238102
  aiFeatureSlug,
@@ -237886,7 +238121,7 @@ var init_cli_add_workspace_ai = __esm(() => {
237886
238121
 
237887
238122
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace.ts
237888
238123
  import { promises as fsp26 } from "fs";
237889
- import path63 from "path";
238124
+ import path64 from "path";
237890
238125
  function isIdentifierBoundary(source, index) {
237891
238126
  if (index < 0 || index >= source.length) {
237892
238127
  return true;
@@ -238196,7 +238431,7 @@ ${VARIATIONS_CALL_LINE}
238196
238431
  }
238197
238432
  }
238198
238433
  if (!hasExecutablePattern(nextSource, VARIATIONS_CALL_PATTERN)) {
238199
- throw new Error(`Unable to inject ${VARIATIONS_CALL_LINE} into ${path63.basename(blockIndexPath)}.`);
238434
+ throw new Error(`Unable to inject ${VARIATIONS_CALL_LINE} into ${path64.basename(blockIndexPath)}.`);
238200
238435
  }
238201
238436
  return nextSource;
238202
238437
  });
@@ -238226,7 +238461,7 @@ ${BLOCK_STYLES_CALL_LINE}
238226
238461
  }
238227
238462
  }
238228
238463
  if (!hasExecutablePattern(nextSource, BLOCK_STYLES_CALL_PATTERN)) {
238229
- throw new Error(`Unable to inject ${BLOCK_STYLES_CALL_LINE} into ${path63.basename(blockIndexPath)}.`);
238464
+ throw new Error(`Unable to inject ${BLOCK_STYLES_CALL_LINE} into ${path64.basename(blockIndexPath)}.`);
238230
238465
  }
238231
238466
  return nextSource;
238232
238467
  });
@@ -238243,7 +238478,7 @@ ${nextSource}`;
238243
238478
  SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN
238244
238479
  ]);
238245
238480
  if (!callRange) {
238246
- throw new Error(`Unable to inject ${BLOCK_TRANSFORMS_CALL_LINE} into ${path63.basename(blockIndexPath)} because it does not expose a scaffold registration settings object.`);
238481
+ throw new Error(`Unable to inject ${BLOCK_TRANSFORMS_CALL_LINE} into ${path64.basename(blockIndexPath)} because it does not expose a scaffold registration settings object.`);
238247
238482
  }
238248
238483
  nextSource = [
238249
238484
  nextSource.slice(0, callRange.start),
@@ -238256,58 +238491,29 @@ ${nextSource}`;
238256
238491
  });
238257
238492
  }
238258
238493
  async function writeVariationRegistry(projectDir, blockSlug, variationSlug) {
238259
- const variationsDir = path63.join(projectDir, "src", "blocks", blockSlug, "variations");
238260
- const variationsIndexPath = path63.join(variationsDir, "index.ts");
238494
+ const variationsDir = path64.join(projectDir, "src", "blocks", blockSlug, "variations");
238495
+ const variationsIndexPath = path64.join(variationsDir, "index.ts");
238261
238496
  await fsp26.mkdir(variationsDir, { recursive: true });
238262
238497
  const existingVariationSlugs = (await fsp26.readdir(variationsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
238263
238498
  const nextVariationSlugs = Array.from(new Set([...existingVariationSlugs, variationSlug])).sort();
238264
238499
  await fsp26.writeFile(variationsIndexPath, buildVariationIndexSource(nextVariationSlugs), "utf8");
238265
238500
  }
238266
238501
  async function writeBlockStyleRegistry(projectDir, blockSlug, styleSlug) {
238267
- const stylesDir = path63.join(projectDir, "src", "blocks", blockSlug, "styles");
238268
- const stylesIndexPath = path63.join(stylesDir, "index.ts");
238502
+ const stylesDir = path64.join(projectDir, "src", "blocks", blockSlug, "styles");
238503
+ const stylesIndexPath = path64.join(stylesDir, "index.ts");
238269
238504
  await fsp26.mkdir(stylesDir, { recursive: true });
238270
238505
  const existingStyleSlugs = (await fsp26.readdir(stylesDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
238271
238506
  const nextStyleSlugs = Array.from(new Set([...existingStyleSlugs, styleSlug])).sort();
238272
238507
  await fsp26.writeFile(stylesIndexPath, buildBlockStyleIndexSource(nextStyleSlugs), "utf8");
238273
238508
  }
238274
238509
  async function writeBlockTransformRegistry(projectDir, blockSlug, transformSlug) {
238275
- const transformsDir = path63.join(projectDir, "src", "blocks", blockSlug, "transforms");
238276
- const transformsIndexPath = path63.join(transformsDir, "index.ts");
238510
+ const transformsDir = path64.join(projectDir, "src", "blocks", blockSlug, "transforms");
238511
+ const transformsIndexPath = path64.join(transformsDir, "index.ts");
238277
238512
  await fsp26.mkdir(transformsDir, { recursive: true });
238278
238513
  const existingTransformSlugs = (await fsp26.readdir(transformsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
238279
238514
  const nextTransformSlugs = Array.from(new Set([...existingTransformSlugs, transformSlug])).sort();
238280
238515
  await fsp26.writeFile(transformsIndexPath, buildBlockTransformIndexSource(nextTransformSlugs), "utf8");
238281
238516
  }
238282
- function assertFullBlockName(blockName, flagName) {
238283
- const trimmed = blockName.trim();
238284
- if (!trimmed) {
238285
- throw new Error(`\`${flagName}\` requires a block name.`);
238286
- }
238287
- if (!FULL_BLOCK_NAME_PATTERN.test(trimmed)) {
238288
- throw new Error(`\`${flagName}\` must use <namespace/block-slug> format.`);
238289
- }
238290
- return trimmed;
238291
- }
238292
- function resolveWorkspaceTargetBlockName(blockName, namespace, flagName) {
238293
- const trimmed = blockName.trim();
238294
- if (!trimmed) {
238295
- throw new Error(`\`${flagName}\` requires <block-slug|namespace/block-slug>.`);
238296
- }
238297
- const blockNameSegments = trimmed.split("/");
238298
- if (blockNameSegments.length > 2 || blockNameSegments.some((segment) => segment.trim() === "")) {
238299
- throw new Error(`\`${flagName}\` must use <block-slug|namespace/block-slug> format.`);
238300
- }
238301
- const [maybeNamespace, maybeSlug] = blockNameSegments.length === 2 ? blockNameSegments : [undefined, blockNameSegments[0]];
238302
- if (maybeNamespace && maybeNamespace !== namespace) {
238303
- throw new Error(`\`${flagName}\` references namespace "${maybeNamespace}". Expected "${namespace}".`);
238304
- }
238305
- const blockSlug = normalizeBlockSlug(maybeSlug ?? "");
238306
- return {
238307
- blockName: `${namespace}/${blockSlug}`,
238308
- blockSlug
238309
- };
238310
- }
238311
238517
  async function runAddVariationCommand({
238312
238518
  blockName,
238313
238519
  cwd = process.cwd(),
@@ -238316,14 +238522,14 @@ async function runAddVariationCommand({
238316
238522
  const workspace = resolveWorkspaceProject(cwd);
238317
238523
  const blockSlug = normalizeBlockSlug(blockName);
238318
238524
  const variationSlug = assertValidGeneratedSlug("Variation name", normalizeBlockSlug(variationName), "wp-typia add variation <name> --block <block-slug>");
238319
- const inventory = readWorkspaceInventory(workspace.projectDir);
238525
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
238320
238526
  resolveWorkspaceBlock(inventory, blockSlug);
238321
238527
  assertVariationDoesNotExist(workspace.projectDir, blockSlug, variationSlug, inventory);
238322
- const blockConfigPath = path63.join(workspace.projectDir, "scripts", "block-config.ts");
238323
- const blockIndexPath = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
238324
- const variationsDir = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
238325
- const variationFilePath = path63.join(variationsDir, `${variationSlug}.ts`);
238326
- const variationsIndexPath = path63.join(variationsDir, "index.ts");
238528
+ const blockConfigPath = path64.join(workspace.projectDir, "scripts", "block-config.ts");
238529
+ const blockIndexPath = path64.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
238530
+ const variationsDir = path64.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
238531
+ const variationFilePath = path64.join(variationsDir, `${variationSlug}.ts`);
238532
+ const variationsIndexPath = path64.join(variationsDir, "index.ts");
238327
238533
  const shouldRemoveVariationsDirOnRollback = !await pathExists(variationsDir);
238328
238534
  const mutationSnapshot = {
238329
238535
  fileSources: await snapshotWorkspaceFiles([
@@ -238363,14 +238569,14 @@ async function runAddBlockStyleCommand({
238363
238569
  const workspace = resolveWorkspaceProject(cwd);
238364
238570
  const blockSlug = normalizeBlockSlug(blockName);
238365
238571
  const styleSlug = assertValidGeneratedSlug("Style name", normalizeBlockSlug(styleName), "wp-typia add style <name> --block <block-slug>");
238366
- const inventory = readWorkspaceInventory(workspace.projectDir);
238572
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
238367
238573
  resolveWorkspaceBlock(inventory, blockSlug);
238368
238574
  assertBlockStyleDoesNotExist(workspace.projectDir, blockSlug, styleSlug, inventory);
238369
- const blockConfigPath = path63.join(workspace.projectDir, "scripts", "block-config.ts");
238370
- const blockIndexPath = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
238371
- const stylesDir = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
238372
- const styleFilePath = path63.join(stylesDir, `${styleSlug}.ts`);
238373
- const stylesIndexPath = path63.join(stylesDir, "index.ts");
238575
+ const blockConfigPath = path64.join(workspace.projectDir, "scripts", "block-config.ts");
238576
+ const blockIndexPath = path64.join(workspace.projectDir, "src", "blocks", blockSlug, "index.tsx");
238577
+ const stylesDir = path64.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
238578
+ const styleFilePath = path64.join(stylesDir, `${styleSlug}.ts`);
238579
+ const stylesIndexPath = path64.join(stylesDir, "index.ts");
238374
238580
  const shouldRemoveStylesDirOnRollback = !await pathExists(stylesDir);
238375
238581
  const mutationSnapshot = {
238376
238582
  fileSources: await snapshotWorkspaceFiles([
@@ -238412,14 +238618,14 @@ async function runAddBlockTransformCommand({
238412
238618
  const transformSlug = assertValidGeneratedSlug("Transform name", normalizeBlockSlug(transformName), "wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>");
238413
238619
  const resolvedFromBlockName = assertFullBlockName(fromBlockName, "--from");
238414
238620
  const target = resolveWorkspaceTargetBlockName(toBlockName, workspace.workspace.namespace, "--to");
238415
- const inventory = readWorkspaceInventory(workspace.projectDir);
238621
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
238416
238622
  resolveWorkspaceBlock(inventory, target.blockSlug);
238417
238623
  assertBlockTransformDoesNotExist(workspace.projectDir, target.blockSlug, transformSlug, inventory);
238418
- const blockConfigPath = path63.join(workspace.projectDir, "scripts", "block-config.ts");
238419
- const blockIndexPath = path63.join(workspace.projectDir, "src", "blocks", target.blockSlug, "index.tsx");
238420
- const transformsDir = path63.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
238421
- const transformFilePath = path63.join(transformsDir, `${transformSlug}.ts`);
238422
- const transformsIndexPath = path63.join(transformsDir, "index.ts");
238624
+ const blockConfigPath = path64.join(workspace.projectDir, "scripts", "block-config.ts");
238625
+ const blockIndexPath = path64.join(workspace.projectDir, "src", "blocks", target.blockSlug, "index.tsx");
238626
+ const transformsDir = path64.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
238627
+ const transformFilePath = path64.join(transformsDir, `${transformSlug}.ts`);
238628
+ const transformsIndexPath = path64.join(transformsDir, "index.ts");
238423
238629
  const shouldRemoveTransformsDirOnRollback = !await pathExists(transformsDir);
238424
238630
  const mutationSnapshot = {
238425
238631
  fileSources: await snapshotWorkspaceFiles([
@@ -238472,7 +238678,7 @@ async function runAddHookedBlockCommand({
238472
238678
  }) {
238473
238679
  const workspace = resolveWorkspaceProject(cwd);
238474
238680
  const blockSlug = normalizeBlockSlug(blockName);
238475
- const inventory = readWorkspaceInventory(workspace.projectDir);
238681
+ const inventory = await readWorkspaceInventoryAsync(workspace.projectDir);
238476
238682
  resolveWorkspaceBlock(inventory, blockSlug);
238477
238683
  const resolvedAnchorBlockName = assertValidHookAnchor(anchorBlockName);
238478
238684
  const resolvedPosition = assertValidHookedBlockPosition(position);
@@ -238481,7 +238687,7 @@ async function runAddHookedBlockCommand({
238481
238687
  throw new Error("`wp-typia add hooked-block` cannot hook a block relative to its own block name.");
238482
238688
  }
238483
238689
  const { blockJson, blockJsonPath } = await readWorkspaceBlockJson(workspace.projectDir, blockSlug);
238484
- const blockJsonRelativePath = path63.relative(workspace.projectDir, blockJsonPath);
238690
+ const blockJsonRelativePath = path64.relative(workspace.projectDir, blockJsonPath);
238485
238691
  const blockHooks = getMutableBlockHooks(blockJson, blockJsonRelativePath);
238486
238692
  if (Object.prototype.hasOwnProperty.call(blockHooks, resolvedAnchorBlockName)) {
238487
238693
  throw new Error(`${blockJsonRelativePath} already defines a blockHooks entry for "${resolvedAnchorBlockName}".`);
@@ -238505,9 +238711,10 @@ async function runAddHookedBlockCommand({
238505
238711
  throw error48;
238506
238712
  }
238507
238713
  }
238508
- var VARIATIONS_IMPORT_LINE = "import { registerWorkspaceVariations } from './variations';", VARIATIONS_IMPORT_PATTERN, VARIATIONS_CALL_LINE = "registerWorkspaceVariations();", VARIATIONS_CALL_PATTERN, BLOCK_STYLES_IMPORT_LINE = "import { registerWorkspaceBlockStyles } from './styles';", BLOCK_STYLES_IMPORT_PATTERN, BLOCK_STYLES_CALL_LINE = "registerWorkspaceBlockStyles();", BLOCK_STYLES_CALL_PATTERN, BLOCK_TRANSFORMS_IMPORT_LINE = "import { applyWorkspaceBlockTransforms } from './transforms';", BLOCK_TRANSFORMS_IMPORT_PATTERN, BLOCK_TRANSFORMS_CALL_LINE = "applyWorkspaceBlockTransforms(registration.settings);", BLOCK_TRANSFORMS_CALL_PATTERN, SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN, FULL_BLOCK_NAME_PATTERN;
238714
+ var VARIATIONS_IMPORT_LINE = "import { registerWorkspaceVariations } from './variations';", VARIATIONS_IMPORT_PATTERN, VARIATIONS_CALL_LINE = "registerWorkspaceVariations();", VARIATIONS_CALL_PATTERN, BLOCK_STYLES_IMPORT_LINE = "import { registerWorkspaceBlockStyles } from './styles';", BLOCK_STYLES_IMPORT_PATTERN, BLOCK_STYLES_CALL_LINE = "registerWorkspaceBlockStyles();", BLOCK_STYLES_CALL_PATTERN, BLOCK_TRANSFORMS_IMPORT_LINE = "import { applyWorkspaceBlockTransforms } from './transforms';", BLOCK_TRANSFORMS_IMPORT_PATTERN, BLOCK_TRANSFORMS_CALL_LINE = "applyWorkspaceBlockTransforms(registration.settings);", BLOCK_TRANSFORMS_CALL_PATTERN, SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN;
238509
238715
  var init_cli_add_workspace = __esm(() => {
238510
238716
  init_fs_async();
238717
+ init_block_targets();
238511
238718
  init_workspace_project();
238512
238719
  init_workspace_inventory();
238513
238720
  init_string_case();
@@ -238524,7 +238731,6 @@ var init_cli_add_workspace = __esm(() => {
238524
238731
  BLOCK_TRANSFORMS_IMPORT_PATTERN = /^\s*import\s*\{\s*applyWorkspaceBlockTransforms\s*\}\s*from\s*["']\.\/transforms["']\s*;?\s*$/mu;
238525
238732
  BLOCK_TRANSFORMS_CALL_PATTERN = /applyWorkspaceBlockTransforms\s*\(\s*registration\s*\.\s*settings\s*\)\s*;?/u;
238526
238733
  SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN = /registerScaffoldBlockType\s*\(\s*registration\s*\.\s*name\s*,\s*registration\s*\.\s*settings\s*\)\s*;?/u;
238527
- FULL_BLOCK_NAME_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
238528
238734
  });
238529
238735
 
238530
238736
  // ../wp-typia-project-tools/src/runtime/cli-add.ts
@@ -238560,9 +238766,9 @@ var init_cli_add = __esm(() => {
238560
238766
  // ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
238561
238767
  import { execFileSync as execFileSync3 } from "child_process";
238562
238768
  import { access, constants as fsConstants, rm as rm2, writeFile as writeFile6 } from "fs/promises";
238563
- import fs41 from "fs";
238769
+ import fs36 from "fs";
238564
238770
  import os5 from "os";
238565
- import path64 from "path";
238771
+ import path65 from "path";
238566
238772
  function readCommandVersion(command, args = ["--version"]) {
238567
238773
  try {
238568
238774
  return execFileSync3(command, args, {
@@ -238586,7 +238792,7 @@ async function checkWritableDirectory(directory) {
238586
238792
  }
238587
238793
  }
238588
238794
  async function checkTempDirectory() {
238589
- const tempFile = path64.join(os5.tmpdir(), `wp-typia-${Date.now()}.tmp`);
238795
+ const tempFile = path65.join(os5.tmpdir(), `wp-typia-${Date.now()}.tmp`);
238590
238796
  try {
238591
238797
  await writeFile6(tempFile, "ok", "utf8");
238592
238798
  await rm2(tempFile, { force: true });
@@ -238602,8 +238808,8 @@ function getTemplateDoctorChecks() {
238602
238808
  const checks3 = [];
238603
238809
  for (const template of listTemplates()) {
238604
238810
  if (!isBuiltInTemplateId(template.id)) {
238605
- const templateDirExists = fs41.existsSync(template.templateDir);
238606
- const hasAssets2 = templateDirExists && fs41.existsSync(path64.join(template.templateDir, "package.json.mustache"));
238811
+ const templateDirExists = fs36.existsSync(template.templateDir);
238812
+ const hasAssets2 = templateDirExists && fs36.existsSync(path65.join(template.templateDir, "package.json.mustache"));
238607
238813
  checks3.push({
238608
238814
  status: !templateDirExists || hasAssets2 ? "pass" : "fail",
238609
238815
  label: `Template ${template.id}`,
@@ -238626,9 +238832,9 @@ function getTemplateDoctorChecks() {
238626
238832
  persistencePolicy: "public"
238627
238833
  })
238628
238834
  ])) : getBuiltInTemplateLayerDirs(builtInTemplateId);
238629
- const missingRequiredLayer = layerDirs.some((layerDir) => !fs41.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
238630
- const existingLayerDirs = layerDirs.filter((layerDir) => fs41.existsSync(layerDir));
238631
- const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs41.existsSync(path64.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs41.existsSync(path64.join(layerDir, "src")));
238835
+ const missingRequiredLayer = layerDirs.some((layerDir) => !fs36.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
238836
+ const existingLayerDirs = layerDirs.filter((layerDir) => fs36.existsSync(layerDir));
238837
+ const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs36.existsSync(path65.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs36.existsSync(path65.join(layerDir, "src")));
238632
238838
  checks3.push({
238633
238839
  status: hasAssets ? "pass" : "fail",
238634
238840
  label: `Template ${template.id}`,
@@ -238658,8 +238864,8 @@ var init_cli_doctor_environment = __esm(() => {
238658
238864
  });
238659
238865
 
238660
238866
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-shared.ts
238661
- import fs42 from "fs";
238662
- import path65 from "path";
238867
+ import fs37 from "fs";
238868
+ import path66 from "path";
238663
238869
  function createDoctorCheck2(label, status, detail, code) {
238664
238870
  return code ? { code, detail, label, status } : { detail, label, status };
238665
238871
  }
@@ -238670,10 +238876,10 @@ function getWorkspaceBootstrapRelativePath(packageName) {
238670
238876
  return `${packageName.split("/").pop() ?? packageName}.php`;
238671
238877
  }
238672
238878
  function resolveWorkspaceBootstrapPath(projectDir, packageName) {
238673
- return path65.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
238879
+ return path66.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
238674
238880
  }
238675
238881
  function checkExistingFiles(projectDir, label, filePaths) {
238676
- const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs42.existsSync(path65.join(projectDir, filePath)));
238882
+ const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs37.existsSync(path66.join(projectDir, filePath)));
238677
238883
  return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
238678
238884
  }
238679
238885
  var WORKSPACE_BINDING_SERVER_GLOB = "/src/bindings/*/server.php", WORKSPACE_BINDING_EDITOR_SCRIPT = "build/bindings/index.js", WORKSPACE_BINDING_EDITOR_ASSET = "build/bindings/index.asset.php", WORKSPACE_REST_RESOURCE_GLOB = "/inc/rest/*.php", WORKSPACE_ABILITY_GLOB = "/inc/abilities/*.php", WORKSPACE_ABILITY_EDITOR_SCRIPT = "build/abilities/index.js", WORKSPACE_ABILITY_EDITOR_ASSET = "build/abilities/index.asset.php", WORKSPACE_AI_FEATURE_GLOB = "/inc/ai-features/*.php", WORKSPACE_ADMIN_VIEW_GLOB = "/inc/admin-views/*.php", WORKSPACE_ADMIN_VIEW_SCRIPT = "build/admin-views/index.js", WORKSPACE_ADMIN_VIEW_ASSET = "build/admin-views/index.asset.php", WORKSPACE_ADMIN_VIEW_STYLE = "build/admin-views/style-index.css", WORKSPACE_EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", WORKSPACE_EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", WORKSPACE_EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", WORKSPACE_GENERATED_BLOCK_ARTIFACTS, WORKSPACE_FULL_BLOCK_NAME_PATTERN;
@@ -238689,15 +238895,15 @@ var init_cli_doctor_workspace_shared = __esm(() => {
238689
238895
  });
238690
238896
 
238691
238897
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
238692
- import fs43 from "fs";
238693
- import path66 from "path";
238898
+ import fs38 from "fs";
238899
+ import path67 from "path";
238694
238900
  import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata2 } from "@wp-typia/block-runtime/blocks";
238695
238901
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
238696
238902
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
238697
- if (!fs43.existsSync(bootstrapPath)) {
238698
- return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path66.basename(bootstrapPath)}`);
238903
+ if (!fs38.existsSync(bootstrapPath)) {
238904
+ return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path67.basename(bootstrapPath)}`);
238699
238905
  }
238700
- const source = fs43.readFileSync(bootstrapPath, "utf8");
238906
+ const source = fs38.readFileSync(bootstrapPath, "utf8");
238701
238907
  const hasServerGlob = source.includes(WORKSPACE_BINDING_SERVER_GLOB);
238702
238908
  const hasEditorEnqueueHook = source.includes("enqueue_block_editor_assets");
238703
238909
  const hasEditorScript = source.includes(WORKSPACE_BINDING_EDITOR_SCRIPT);
@@ -238705,12 +238911,12 @@ function checkWorkspaceBindingBootstrap(projectDir, packageName) {
238705
238911
  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");
238706
238912
  }
238707
238913
  function checkWorkspaceBindingSourcesIndex(projectDir, bindingSources) {
238708
- const indexRelativePath = [path66.join("src", "bindings", "index.ts"), path66.join("src", "bindings", "index.js")].find((relativePath) => fs43.existsSync(path66.join(projectDir, relativePath)));
238914
+ const indexRelativePath = [path67.join("src", "bindings", "index.ts"), path67.join("src", "bindings", "index.js")].find((relativePath) => fs38.existsSync(path67.join(projectDir, relativePath)));
238709
238915
  if (!indexRelativePath) {
238710
238916
  return createDoctorCheck2("Binding sources index", "fail", "Missing src/bindings/index.ts or src/bindings/index.js");
238711
238917
  }
238712
- const indexPath = path66.join(projectDir, indexRelativePath);
238713
- const source = fs43.readFileSync(indexPath, "utf8");
238918
+ const indexPath = path67.join(projectDir, indexRelativePath);
238919
+ const source = fs38.readFileSync(indexPath, "utf8");
238714
238920
  const missingImports = bindingSources.filter((bindingSource) => !source.includes(`./${bindingSource.slug}/editor`));
238715
238921
  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(", ")}`);
238716
238922
  }
@@ -238726,11 +238932,11 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238726
238932
  if (!registeredBlockSlugs.has(bindingSource.block)) {
238727
238933
  return createDoctorCheck2(`Binding target ${bindingSource.slug}`, "fail", `Binding target references unknown block "${bindingSource.block}".`);
238728
238934
  }
238729
- const blockJsonRelativePath = path66.join("src", "blocks", bindingSource.block, "block.json");
238730
- const blockJsonPath = path66.join(projectDir, blockJsonRelativePath);
238935
+ const blockJsonRelativePath = path67.join("src", "blocks", bindingSource.block, "block.json");
238936
+ const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
238731
238937
  const issues = [];
238732
238938
  try {
238733
- const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs43.readFileSync(blockJsonPath, "utf8")));
238939
+ const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs38.readFileSync(blockJsonPath, "utf8")));
238734
238940
  const attributes = blockJson.attributes;
238735
238941
  if (!attributes || typeof attributes !== "object" || Array.isArray(attributes)) {
238736
238942
  issues.push(`${blockJsonRelativePath} must define an attributes object`);
@@ -238743,9 +238949,9 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238743
238949
  } catch (error48) {
238744
238950
  issues.push(error48 instanceof Error ? `Unable to read ${blockJsonRelativePath}: ${error48.message}` : `Unable to read ${blockJsonRelativePath}.`);
238745
238951
  }
238746
- const serverPath = path66.join(projectDir, bindingSource.serverFile);
238747
- if (fs43.existsSync(serverPath)) {
238748
- const serverSource = fs43.readFileSync(serverPath, "utf8");
238952
+ const serverPath = path67.join(projectDir, bindingSource.serverFile);
238953
+ if (fs38.existsSync(serverPath)) {
238954
+ const serverSource = fs38.readFileSync(serverPath, "utf8");
238749
238955
  const supportedAttributesFilter = `block_bindings_supported_attributes_${workspace.workspace.namespace}/${bindingSource.block}`;
238750
238956
  if (!serverSource.includes(supportedAttributesFilter)) {
238751
238957
  issues.push(`${bindingSource.serverFile} must register ${supportedAttributesFilter}`);
@@ -238756,9 +238962,9 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
238756
238962
  } else {
238757
238963
  issues.push(`Missing ${bindingSource.serverFile}`);
238758
238964
  }
238759
- const editorPath = path66.join(projectDir, bindingSource.editorFile);
238760
- if (fs43.existsSync(editorPath)) {
238761
- const editorSource = fs43.readFileSync(editorPath, "utf8");
238965
+ const editorPath = path67.join(projectDir, bindingSource.editorFile);
238966
+ if (fs38.existsSync(editorPath)) {
238967
+ const editorSource = fs38.readFileSync(editorPath, "utf8");
238762
238968
  const blockName = `${workspace.workspace.namespace}/${bindingSource.block}`;
238763
238969
  const bindingSourceTargetMatch = editorSource.match(/export\s+const\s+BINDING_SOURCE_TARGET\s*=\s*\{([\s\S]*?)\}\s+as\s+const\s*;/u);
238764
238970
  if (!bindingSourceTargetMatch) {
@@ -238803,11 +239009,11 @@ var init_cli_doctor_workspace_bindings = __esm(() => {
238803
239009
  });
238804
239010
 
238805
239011
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-blocks.ts
238806
- import fs44 from "fs";
238807
- import path67 from "path";
239012
+ import fs39 from "fs";
239013
+ import path68 from "path";
238808
239014
  import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata3 } from "@wp-typia/block-runtime/blocks";
238809
239015
  function normalizePathSeparators(relativePath) {
238810
- return relativePath.split(path67.sep).join("/");
239016
+ return relativePath.split(path68.sep).join("/");
238811
239017
  }
238812
239018
  function hasRegisteredBlockAsset(value2) {
238813
239019
  if (typeof value2 === "string") {
@@ -238819,16 +239025,16 @@ function hasRegisteredBlockAsset(value2) {
238819
239025
  return false;
238820
239026
  }
238821
239027
  function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
238822
- const blockJsonRelativePath = path67.join("src", "blocks", blockSlug, "block.json");
238823
- const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
238824
- if (!fs44.existsSync(blockJsonPath)) {
239028
+ const blockJsonRelativePath = path68.join("src", "blocks", blockSlug, "block.json");
239029
+ const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239030
+ if (!fs39.existsSync(blockJsonPath)) {
238825
239031
  return {
238826
239032
  blockJsonRelativePath,
238827
239033
  error: `Missing ${blockJsonRelativePath}`
238828
239034
  };
238829
239035
  }
238830
239036
  try {
238831
- const document2 = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
239037
+ const document2 = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
238832
239038
  return {
238833
239039
  blockJsonRelativePath,
238834
239040
  document: document2
@@ -238845,8 +239051,8 @@ function isWorkspaceBlockEditorSource(relativePath) {
238845
239051
  return false;
238846
239052
  }
238847
239053
  const normalizedRelativePath = normalizePathSeparators(relativePath);
238848
- const normalizedDirName = path67.posix.dirname(normalizedRelativePath);
238849
- const normalizedBaseName = path67.posix.basename(normalizedRelativePath, path67.posix.extname(normalizedRelativePath));
239054
+ const normalizedDirName = path68.posix.dirname(normalizedRelativePath);
239055
+ const normalizedBaseName = path68.posix.basename(normalizedRelativePath, path68.posix.extname(normalizedRelativePath));
238850
239056
  if (WORKSPACE_BLOCK_EDITOR_SOURCE_BASENAMES.has(normalizedBaseName)) {
238851
239057
  return true;
238852
239058
  }
@@ -238854,12 +239060,12 @@ function isWorkspaceBlockEditorSource(relativePath) {
238854
239060
  return pathSegments.some((segment) => WORKSPACE_BLOCK_EDITOR_SOURCE_DIRECTORIES.has(segment));
238855
239061
  }
238856
239062
  function isWorkspaceBlockSaveSource(relativePath) {
238857
- const normalizedBaseName = path67.basename(relativePath, path67.extname(relativePath));
239063
+ const normalizedBaseName = path68.basename(relativePath, path68.extname(relativePath));
238858
239064
  return normalizedBaseName === "save";
238859
239065
  }
238860
239066
  function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
238861
- const blockDir = path67.join(projectDir, "src", "blocks", blockSlug);
238862
- if (!fs44.existsSync(blockDir)) {
239067
+ const blockDir = path68.join(projectDir, "src", "blocks", blockSlug);
239068
+ if (!fs39.existsSync(blockDir)) {
238863
239069
  return [];
238864
239070
  }
238865
239071
  const collected = [];
@@ -238869,8 +239075,8 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
238869
239075
  if (!currentDir) {
238870
239076
  continue;
238871
239077
  }
238872
- for (const entry of fs44.readdirSync(currentDir, { withFileTypes: true })) {
238873
- const absolutePath = path67.join(currentDir, entry.name);
239078
+ for (const entry of fs39.readdirSync(currentDir, { withFileTypes: true })) {
239079
+ const absolutePath = path68.join(currentDir, entry.name);
238874
239080
  if (entry.isDirectory()) {
238875
239081
  queue.push(absolutePath);
238876
239082
  continue;
@@ -238878,13 +239084,13 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
238878
239084
  if (!entry.isFile()) {
238879
239085
  continue;
238880
239086
  }
238881
- const relativePath = path67.relative(projectDir, absolutePath);
239087
+ const relativePath = path68.relative(projectDir, absolutePath);
238882
239088
  if (!isWorkspaceBlockEditorSource(relativePath)) {
238883
239089
  continue;
238884
239090
  }
238885
239091
  collected.push({
238886
239092
  relativePath: normalizePathSeparators(relativePath),
238887
- source: fs44.readFileSync(absolutePath, "utf8")
239093
+ source: fs39.readFileSync(absolutePath, "utf8")
238888
239094
  });
238889
239095
  }
238890
239096
  }
@@ -238943,24 +239149,24 @@ function findWorkspaceBlockGlobalDomAccesses(editorSources) {
238943
239149
  });
238944
239150
  }
238945
239151
  function getWorkspaceBlockRequiredFiles(block) {
238946
- const blockDir = path67.join("src", "blocks", block.slug);
239152
+ const blockDir = path68.join("src", "blocks", block.slug);
238947
239153
  return Array.from(new Set([
238948
239154
  block.typesFile,
238949
239155
  block.apiTypesFile,
238950
239156
  block.openApiFile,
238951
- path67.join(blockDir, "index.tsx"),
238952
- ...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path67.join(blockDir, fileName))
239157
+ path68.join(blockDir, "index.tsx"),
239158
+ ...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path68.join(blockDir, fileName))
238953
239159
  ].filter((filePath) => typeof filePath === "string")));
238954
239160
  }
238955
239161
  function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
238956
- const blockJsonRelativePath = path67.join("src", "blocks", block.slug, "block.json");
238957
- const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
238958
- if (!fs44.existsSync(blockJsonPath)) {
239162
+ const blockJsonRelativePath = path68.join("src", "blocks", block.slug, "block.json");
239163
+ const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239164
+ if (!fs39.existsSync(blockJsonPath)) {
238959
239165
  return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
238960
239166
  }
238961
239167
  let blockJson;
238962
239168
  try {
238963
- blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
239169
+ blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
238964
239170
  } catch (error48) {
238965
239171
  return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
238966
239172
  }
@@ -238975,14 +239181,14 @@ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
238975
239181
  return createDoctorCheck2(`Block metadata ${block.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `block.json matches ${expectedName} and ${workspace.workspace.textDomain}` : issues.join("; "));
238976
239182
  }
238977
239183
  function checkWorkspaceBlockHooks(projectDir, blockSlug) {
238978
- const blockJsonRelativePath = path67.join("src", "blocks", blockSlug, "block.json");
238979
- const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
238980
- if (!fs44.existsSync(blockJsonPath)) {
239184
+ const blockJsonRelativePath = path68.join("src", "blocks", blockSlug, "block.json");
239185
+ const blockJsonPath = path68.join(projectDir, blockJsonRelativePath);
239186
+ if (!fs39.existsSync(blockJsonPath)) {
238981
239187
  return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
238982
239188
  }
238983
239189
  let blockJson;
238984
239190
  try {
238985
- blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
239191
+ blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs39.readFileSync(blockJsonPath, "utf8")));
238986
239192
  } catch (error48) {
238987
239193
  return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
238988
239194
  }
@@ -238998,12 +239204,12 @@ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
238998
239204
  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(", ")}`);
238999
239205
  }
239000
239206
  function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
239001
- const entryRelativePath = path67.join("src", "blocks", blockSlug, "index.tsx");
239002
- const entryPath = path67.join(projectDir, entryRelativePath);
239003
- if (!fs44.existsSync(entryPath)) {
239207
+ const entryRelativePath = path68.join("src", "blocks", blockSlug, "index.tsx");
239208
+ const entryPath = path68.join(projectDir, entryRelativePath);
239209
+ if (!fs39.existsSync(entryPath)) {
239004
239210
  return createDoctorCheck2(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
239005
239211
  }
239006
- const source = fs44.readFileSync(entryPath, "utf8");
239212
+ const source = fs39.readFileSync(entryPath, "utf8");
239007
239213
  const hasCollectionImport = WORKSPACE_COLLECTION_IMPORT_PATTERN.test(source);
239008
239214
  return createDoctorCheck2(`Block collection ${blockSlug}`, hasCollectionImport ? "pass" : "fail", hasCollectionImport ? "Shared block collection import is present" : `Missing a shared collection import like ${WORKSPACE_COLLECTION_IMPORT_LINE}`);
239009
239215
  }
@@ -239016,8 +239222,8 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
239016
239222
  }
239017
239223
  const blockJson = metadataResult.document;
239018
239224
  const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion) ? blockJson.apiVersion : null;
239019
- const blockDir = path67.join(projectDir, "src", "blocks", blockSlug);
239020
- const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs44.existsSync(path67.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path67.join("src", "blocks", blockSlug, fileName)));
239225
+ const blockDir = path68.join(projectDir, "src", "blocks", blockSlug);
239226
+ const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs39.existsSync(path68.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path68.join("src", "blocks", blockSlug, fileName)));
239021
239227
  const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) || hasRegisteredBlockAsset(blockJson.editorStyle);
239022
239228
  const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
239023
239229
  const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
@@ -239035,40 +239241,40 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
239035
239241
  }
239036
239242
  function checkWorkspacePatternBootstrap(projectDir, packageName) {
239037
239243
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239038
- if (!fs44.existsSync(bootstrapPath)) {
239039
- return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path67.basename(bootstrapPath)}`);
239244
+ if (!fs39.existsSync(bootstrapPath)) {
239245
+ return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239040
239246
  }
239041
- const source = fs44.readFileSync(bootstrapPath, "utf8");
239247
+ const source = fs39.readFileSync(bootstrapPath, "utf8");
239042
239248
  const hasCategoryAnchor = source.includes("register_block_pattern_category");
239043
239249
  const hasPatternGlob = source.includes("/src/patterns/*.php");
239044
239250
  return createDoctorCheck2("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob ? "Pattern category and loader hooks are present" : "Missing pattern category registration or src/patterns loader hook");
239045
239251
  }
239046
239252
  function checkVariationEntrypoint(projectDir, blockSlug) {
239047
- const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239048
- if (!fs44.existsSync(entryPath)) {
239049
- return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
239253
+ const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239254
+ if (!fs39.existsSync(entryPath)) {
239255
+ return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239050
239256
  }
239051
- const source = fs44.readFileSync(entryPath, "utf8");
239257
+ const source = fs39.readFileSync(entryPath, "utf8");
239052
239258
  const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
239053
239259
  const hasCall = hasExecutablePattern(source, WORKSPACE_VARIATIONS_CALL_PATTERN);
239054
239260
  return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Variations registration hook is present" : "Missing ./variations import or registerWorkspaceVariations() call");
239055
239261
  }
239056
239262
  function checkBlockStyleEntrypoint(projectDir, blockSlug) {
239057
- const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239058
- if (!fs44.existsSync(entryPath)) {
239059
- return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
239263
+ const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239264
+ if (!fs39.existsSync(entryPath)) {
239265
+ return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239060
239266
  }
239061
- const source = fs44.readFileSync(entryPath, "utf8");
239267
+ const source = fs39.readFileSync(entryPath, "utf8");
239062
239268
  const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
239063
239269
  const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_STYLES_CALL_PATTERN);
239064
239270
  return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block style registration hook is present" : "Missing ./styles import or registerWorkspaceBlockStyles() call");
239065
239271
  }
239066
239272
  function checkBlockTransformEntrypoint(projectDir, blockSlug) {
239067
- const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239068
- if (!fs44.existsSync(entryPath)) {
239069
- return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
239273
+ const entryPath = path68.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
239274
+ if (!fs39.existsSync(entryPath)) {
239275
+ return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path68.relative(projectDir, entryPath)}`);
239070
239276
  }
239071
- const source = fs44.readFileSync(entryPath, "utf8");
239277
+ const source = fs39.readFileSync(entryPath, "utf8");
239072
239278
  const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
239073
239279
  const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN);
239074
239280
  return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block transform registration hook is present" : "Missing ./transforms import or applyWorkspaceBlockTransforms(registration.settings) call");
@@ -239117,7 +239323,7 @@ function getWorkspaceBlockDoctorChecks(workspace, inventory) {
239117
239323
  }
239118
239324
  for (const blockSlug of blockStyleTargetBlocks) {
239119
239325
  checks3.push(checkExistingFiles(workspace.projectDir, `Block style registry ${blockSlug}`, [
239120
- path67.join("src", "blocks", blockSlug, "styles", "index.ts")
239326
+ path68.join("src", "blocks", blockSlug, "styles", "index.ts")
239121
239327
  ]));
239122
239328
  checks3.push(checkBlockStyleEntrypoint(workspace.projectDir, blockSlug));
239123
239329
  }
@@ -239133,11 +239339,11 @@ function getWorkspaceBlockDoctorChecks(workspace, inventory) {
239133
239339
  }
239134
239340
  for (const blockSlug of blockTransformTargetBlocks) {
239135
239341
  checks3.push(checkExistingFiles(workspace.projectDir, `Block transform registry ${blockSlug}`, [
239136
- path67.join("src", "blocks", blockSlug, "transforms", "index.ts")
239342
+ path68.join("src", "blocks", blockSlug, "transforms", "index.ts")
239137
239343
  ]));
239138
239344
  checks3.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
239139
239345
  }
239140
- const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs44.existsSync(path67.join(workspace.projectDir, "src", "patterns"));
239346
+ const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs39.existsSync(path68.join(workspace.projectDir, "src", "patterns"));
239141
239347
  if (shouldCheckPatternBootstrap) {
239142
239348
  checks3.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
239143
239349
  }
@@ -239188,8 +239394,8 @@ var init_cli_doctor_workspace_blocks = __esm(() => {
239188
239394
  });
239189
239395
 
239190
239396
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features.ts
239191
- import fs45 from "fs";
239192
- import path68 from "path";
239397
+ import fs40 from "fs";
239398
+ import path69 from "path";
239193
239399
  function getWorkspaceRestResourceRequiredFiles(restResource) {
239194
239400
  const schemaNames = new Set;
239195
239401
  if (restResource.methods.includes("list")) {
@@ -239215,7 +239421,7 @@ function getWorkspaceRestResourceRequiredFiles(restResource) {
239215
239421
  }
239216
239422
  return Array.from(new Set([
239217
239423
  restResource.apiFile,
239218
- ...Array.from(schemaNames, (schemaName) => path68.join(path68.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
239424
+ ...Array.from(schemaNames, (schemaName) => path69.join(path69.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
239219
239425
  restResource.clientFile,
239220
239426
  restResource.dataFile,
239221
239427
  restResource.openApiFile,
@@ -239231,10 +239437,10 @@ function checkWorkspaceRestResourceConfig(restResource) {
239231
239437
  }
239232
239438
  function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
239233
239439
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239234
- if (!fs45.existsSync(bootstrapPath)) {
239235
- return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239440
+ if (!fs40.existsSync(bootstrapPath)) {
239441
+ return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239236
239442
  }
239237
- const source = fs45.readFileSync(bootstrapPath, "utf8");
239443
+ const source = fs40.readFileSync(bootstrapPath, "utf8");
239238
239444
  const registerFunctionName = `${phpPrefix}_register_rest_resources`;
239239
239445
  const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
239240
239446
  const hasServerGlob = source.includes(WORKSPACE_REST_RESOURCE_GLOB);
@@ -239253,12 +239459,12 @@ function getWorkspaceAbilityRequiredFiles(ability) {
239253
239459
  ]));
239254
239460
  }
239255
239461
  function checkWorkspaceAbilityConfig(projectDir, ability) {
239256
- const configPath = path68.join(projectDir, ability.configFile);
239257
- if (!fs45.existsSync(configPath)) {
239462
+ const configPath = path69.join(projectDir, ability.configFile);
239463
+ if (!fs40.existsSync(configPath)) {
239258
239464
  return createDoctorCheck2(`Ability config ${ability.slug}`, "fail", `Missing ${ability.configFile}`);
239259
239465
  }
239260
239466
  try {
239261
- const config2 = JSON.parse(fs45.readFileSync(configPath, "utf8"));
239467
+ const config2 = JSON.parse(fs40.readFileSync(configPath, "utf8"));
239262
239468
  const abilityId = typeof config2.abilityId === "string" ? config2.abilityId.trim() : "";
239263
239469
  const categorySlug = typeof config2.category?.slug === "string" ? config2.category.slug.trim() : "";
239264
239470
  const hasValidAbilityId = /^[a-z0-9-]+\/[a-z0-9-]+$/u.test(abilityId);
@@ -239270,10 +239476,10 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
239270
239476
  }
239271
239477
  function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
239272
239478
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239273
- if (!fs45.existsSync(bootstrapPath)) {
239274
- return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239479
+ if (!fs40.existsSync(bootstrapPath)) {
239480
+ return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239275
239481
  }
239276
- const source = fs45.readFileSync(bootstrapPath, "utf8");
239482
+ const source = fs40.readFileSync(bootstrapPath, "utf8");
239277
239483
  const loadFunctionName = `${phpPrefix}_load_workflow_abilities`;
239278
239484
  const enqueueFunctionName = `${phpPrefix}_enqueue_workflow_abilities`;
239279
239485
  const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
@@ -239290,14 +239496,14 @@ function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
239290
239496
  }
239291
239497
  function checkWorkspaceAbilityIndex(projectDir, abilities) {
239292
239498
  const indexRelativePath = [
239293
- path68.join("src", "abilities", "index.ts"),
239294
- path68.join("src", "abilities", "index.js")
239295
- ].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
239499
+ path69.join("src", "abilities", "index.ts"),
239500
+ path69.join("src", "abilities", "index.js")
239501
+ ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239296
239502
  if (!indexRelativePath) {
239297
239503
  return createDoctorCheck2("Abilities index", "fail", "Missing src/abilities/index.ts or src/abilities/index.js");
239298
239504
  }
239299
- const indexPath = path68.join(projectDir, indexRelativePath);
239300
- const source = fs45.readFileSync(indexPath, "utf8");
239505
+ const indexPath = path69.join(projectDir, indexRelativePath);
239506
+ const source = fs40.readFileSync(indexPath, "utf8");
239301
239507
  const missingExports = abilities.filter((ability) => {
239302
239508
  const exportPattern = new RegExp(`^\\s*export\\s+(?:\\*\\s+from|\\{[^}]+\\}\\s+from)\\s+['"\`]\\./${escapeRegex2(ability.slug)}\\/client['"\`]`, "mu");
239303
239509
  return !exportPattern.test(source);
@@ -239308,9 +239514,9 @@ function getWorkspaceAiFeatureRequiredFiles(aiFeature) {
239308
239514
  return Array.from(new Set([
239309
239515
  aiFeature.aiSchemaFile,
239310
239516
  aiFeature.apiFile,
239311
- path68.join(path68.dirname(aiFeature.typesFile), "api-schemas", "feature-request.schema.json"),
239312
- path68.join(path68.dirname(aiFeature.typesFile), "api-schemas", "feature-response.schema.json"),
239313
- path68.join(path68.dirname(aiFeature.typesFile), "api-schemas", "feature-result.schema.json"),
239517
+ path69.join(path69.dirname(aiFeature.typesFile), "api-schemas", "feature-request.schema.json"),
239518
+ path69.join(path69.dirname(aiFeature.typesFile), "api-schemas", "feature-response.schema.json"),
239519
+ path69.join(path69.dirname(aiFeature.typesFile), "api-schemas", "feature-result.schema.json"),
239314
239520
  aiFeature.clientFile,
239315
239521
  aiFeature.dataFile,
239316
239522
  aiFeature.openApiFile,
@@ -239325,10 +239531,10 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
239325
239531
  }
239326
239532
  function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
239327
239533
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239328
- if (!fs45.existsSync(bootstrapPath)) {
239329
- return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239534
+ if (!fs40.existsSync(bootstrapPath)) {
239535
+ return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239330
239536
  }
239331
- const source = fs45.readFileSync(bootstrapPath, "utf8");
239537
+ const source = fs40.readFileSync(bootstrapPath, "utf8");
239332
239538
  const registerFunctionName = `${phpPrefix}_register_ai_features`;
239333
239539
  const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
239334
239540
  const hasServerGlob = source.includes(WORKSPACE_AI_FEATURE_GLOB);
@@ -239336,14 +239542,14 @@ function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
239336
239542
  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");
239337
239543
  }
239338
239544
  function getWorkspaceEditorPluginRequiredFiles(editorPlugin) {
239339
- const editorPluginDir = path68.join("src", "editor-plugins", editorPlugin.slug);
239340
- const surfaceFile = editorPlugin.slot === "PluginSidebar" ? path68.join(editorPluginDir, "Sidebar.tsx") : path68.join(editorPluginDir, "Surface.tsx");
239545
+ const editorPluginDir = path69.join("src", "editor-plugins", editorPlugin.slug);
239546
+ const surfaceFile = editorPlugin.slot === "PluginSidebar" ? path69.join(editorPluginDir, "Sidebar.tsx") : path69.join(editorPluginDir, "Surface.tsx");
239341
239547
  return Array.from(new Set([
239342
239548
  editorPlugin.file,
239343
239549
  surfaceFile,
239344
- path68.join(editorPluginDir, "data.ts"),
239345
- path68.join(editorPluginDir, "types.ts"),
239346
- path68.join(editorPluginDir, "style.scss")
239550
+ path69.join(editorPluginDir, "data.ts"),
239551
+ path69.join(editorPluginDir, "types.ts"),
239552
+ path69.join(editorPluginDir, "style.scss")
239347
239553
  ]));
239348
239554
  }
239349
239555
  function checkWorkspaceEditorPluginConfig(editorPlugin) {
@@ -239353,10 +239559,10 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
239353
239559
  }
239354
239560
  function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
239355
239561
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239356
- if (!fs45.existsSync(bootstrapPath)) {
239357
- return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239562
+ if (!fs40.existsSync(bootstrapPath)) {
239563
+ return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239358
239564
  }
239359
- const source = fs45.readFileSync(bootstrapPath, "utf8");
239565
+ const source = fs40.readFileSync(bootstrapPath, "utf8");
239360
239566
  const enqueueFunctionName = `${phpPrefix}_enqueue_editor_plugins_editor`;
239361
239567
  const enqueueHook = `add_action( 'enqueue_block_editor_assets', '${enqueueFunctionName}' );`;
239362
239568
  const hasEditorEnqueueHook = source.includes(enqueueHook);
@@ -239367,14 +239573,14 @@ function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix)
239367
239573
  }
239368
239574
  function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
239369
239575
  const indexRelativePath = [
239370
- path68.join("src", "editor-plugins", "index.ts"),
239371
- path68.join("src", "editor-plugins", "index.js")
239372
- ].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
239576
+ path69.join("src", "editor-plugins", "index.ts"),
239577
+ path69.join("src", "editor-plugins", "index.js")
239578
+ ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239373
239579
  if (!indexRelativePath) {
239374
239580
  return createDoctorCheck2("Editor plugins index", "fail", "Missing src/editor-plugins/index.ts or src/editor-plugins/index.js");
239375
239581
  }
239376
- const indexPath = path68.join(projectDir, indexRelativePath);
239377
- const source = fs45.readFileSync(indexPath, "utf8");
239582
+ const indexPath = path69.join(projectDir, indexRelativePath);
239583
+ const source = fs40.readFileSync(indexPath, "utf8");
239378
239584
  const missingImports = editorPlugins.filter((editorPlugin) => {
239379
239585
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(editorPlugin.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
239380
239586
  return !importPattern.test(source);
@@ -239382,15 +239588,15 @@ function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
239382
239588
  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(", ")}`);
239383
239589
  }
239384
239590
  function getWorkspaceAdminViewRequiredFiles(adminView) {
239385
- const adminViewDir = path68.join("src", "admin-views", adminView.slug);
239591
+ const adminViewDir = path69.join("src", "admin-views", adminView.slug);
239386
239592
  return Array.from(new Set([
239387
239593
  adminView.file,
239388
239594
  adminView.phpFile,
239389
- path68.join(adminViewDir, "Screen.tsx"),
239390
- path68.join(adminViewDir, "config.ts"),
239391
- path68.join(adminViewDir, "data.ts"),
239392
- path68.join(adminViewDir, "style.scss"),
239393
- path68.join(adminViewDir, "types.ts")
239595
+ path69.join(adminViewDir, "Screen.tsx"),
239596
+ path69.join(adminViewDir, "config.ts"),
239597
+ path69.join(adminViewDir, "data.ts"),
239598
+ path69.join(adminViewDir, "style.scss"),
239599
+ path69.join(adminViewDir, "types.ts")
239394
239600
  ]));
239395
239601
  }
239396
239602
  function checkWorkspaceAdminViewConfig(adminView, inventory) {
@@ -239407,10 +239613,10 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
239407
239613
  }
239408
239614
  function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
239409
239615
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
239410
- if (!fs45.existsSync(bootstrapPath)) {
239411
- return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
239616
+ if (!fs40.existsSync(bootstrapPath)) {
239617
+ return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path69.basename(bootstrapPath)}`);
239412
239618
  }
239413
- const source = fs45.readFileSync(bootstrapPath, "utf8");
239619
+ const source = fs40.readFileSync(bootstrapPath, "utf8");
239414
239620
  const loadFunctionName = `${phpPrefix}_load_admin_views`;
239415
239621
  const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
239416
239622
  const hasLoaderHook = source.includes(loadHook);
@@ -239419,14 +239625,14 @@ function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
239419
239625
  }
239420
239626
  function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
239421
239627
  const indexRelativePath = [
239422
- path68.join("src", "admin-views", "index.ts"),
239423
- path68.join("src", "admin-views", "index.js")
239424
- ].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
239628
+ path69.join("src", "admin-views", "index.ts"),
239629
+ path69.join("src", "admin-views", "index.js")
239630
+ ].find((relativePath) => fs40.existsSync(path69.join(projectDir, relativePath)));
239425
239631
  if (!indexRelativePath) {
239426
239632
  return createDoctorCheck2("Admin views index", "fail", "Missing src/admin-views/index.ts or src/admin-views/index.js");
239427
239633
  }
239428
- const indexPath = path68.join(projectDir, indexRelativePath);
239429
- const source = fs45.readFileSync(indexPath, "utf8");
239634
+ const indexPath = path69.join(projectDir, indexRelativePath);
239635
+ const source = fs40.readFileSync(indexPath, "utf8");
239430
239636
  const missingImports = adminViews.filter((adminView) => {
239431
239637
  const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(adminView.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
239432
239638
  return !importPattern.test(source);
@@ -239434,11 +239640,11 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
239434
239640
  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(", ")}`);
239435
239641
  }
239436
239642
  function checkWorkspaceAdminViewPhp(projectDir, adminView) {
239437
- const phpPath = path68.join(projectDir, adminView.phpFile);
239438
- if (!fs45.existsSync(phpPath)) {
239643
+ const phpPath = path69.join(projectDir, adminView.phpFile);
239644
+ if (!fs40.existsSync(phpPath)) {
239439
239645
  return createDoctorCheck2(`Admin view PHP ${adminView.slug}`, "fail", `Missing ${adminView.phpFile}`);
239440
239646
  }
239441
- const source = fs45.readFileSync(phpPath, "utf8");
239647
+ const source = fs40.readFileSync(phpPath, "utf8");
239442
239648
  const hasAdminMenu = source.includes("add_submenu_page");
239443
239649
  const hasAdminEnqueue = source.includes("admin_enqueue_scripts");
239444
239650
  const hasScript = source.includes(WORKSPACE_ADMIN_VIEW_SCRIPT);
@@ -239496,8 +239702,8 @@ var init_cli_doctor_workspace_features = __esm(() => {
239496
239702
  });
239497
239703
 
239498
239704
  // ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-package.ts
239499
- import fs46 from "fs";
239500
- import path69 from "path";
239705
+ import fs41 from "fs";
239706
+ import path70 from "path";
239501
239707
  function getWorkspacePackageMetadataCheck(workspace, packageJson) {
239502
239708
  const issues = [];
239503
239709
  const packageName = packageJson.name;
@@ -239521,15 +239727,15 @@ function getWorkspacePackageMetadataCheck(workspace, packageJson) {
239521
239727
  if (wpTypia?.phpPrefix !== workspace.workspace.phpPrefix) {
239522
239728
  issues.push(`wpTypia.phpPrefix must equal "${workspace.workspace.phpPrefix}"`);
239523
239729
  }
239524
- if (!fs46.existsSync(path69.join(workspace.projectDir, bootstrapRelativePath))) {
239730
+ if (!fs41.existsSync(path70.join(workspace.projectDir, bootstrapRelativePath))) {
239525
239731
  issues.push(`Missing bootstrap file ${bootstrapRelativePath}`);
239526
239732
  }
239527
239733
  return createDoctorCheck2("Workspace package metadata", issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `package.json metadata aligns with ${workspace.packageName} and ${bootstrapRelativePath}` : issues.join("; "));
239528
239734
  }
239529
239735
  function getMigrationWorkspaceHintCheck(workspace, packageJson) {
239530
239736
  const hasMigrationScript = typeof packageJson.scripts?.["migration:doctor"] === "string";
239531
- const migrationConfigRelativePath = path69.join("src", "migrations", "config.ts");
239532
- const hasMigrationConfig = fs46.existsSync(path69.join(workspace.projectDir, migrationConfigRelativePath));
239737
+ const migrationConfigRelativePath = path70.join("src", "migrations", "config.ts");
239738
+ const hasMigrationConfig = fs41.existsSync(path70.join(workspace.projectDir, migrationConfigRelativePath));
239533
239739
  if (!hasMigrationScript && !hasMigrationConfig) {
239534
239740
  return null;
239535
239741
  }
@@ -239651,14 +239857,14 @@ var init_cli_doctor = __esm(() => {
239651
239857
  });
239652
239858
 
239653
239859
  // ../wp-typia-project-tools/src/runtime/cli-init-package-json.ts
239654
- import fs47 from "fs";
239655
- import path70 from "path";
239860
+ import fs42 from "fs";
239861
+ import path71 from "path";
239656
239862
  function readProjectPackageJson(projectDir) {
239657
- const packageJsonPath = path70.join(projectDir, "package.json");
239658
- if (!fs47.existsSync(packageJsonPath)) {
239863
+ const packageJsonPath = path71.join(projectDir, "package.json");
239864
+ if (!fs42.existsSync(packageJsonPath)) {
239659
239865
  return null;
239660
239866
  }
239661
- const source = fs47.readFileSync(packageJsonPath, "utf8");
239867
+ const source = fs42.readFileSync(packageJsonPath, "utf8");
239662
239868
  try {
239663
239869
  return JSON.parse(source);
239664
239870
  } catch (error48) {
@@ -239670,13 +239876,13 @@ function inferInitPackageManager(projectDir, packageJson) {
239670
239876
  if (packageJson?.packageManager) {
239671
239877
  return parseWorkspacePackageManagerId(packageJson.packageManager);
239672
239878
  }
239673
- if (fs47.existsSync(path70.join(projectDir, "bun.lock")) || fs47.existsSync(path70.join(projectDir, "bun.lockb"))) {
239879
+ if (fs42.existsSync(path71.join(projectDir, "bun.lock")) || fs42.existsSync(path71.join(projectDir, "bun.lockb"))) {
239674
239880
  return "bun";
239675
239881
  }
239676
- if (fs47.existsSync(path70.join(projectDir, "pnpm-lock.yaml"))) {
239882
+ if (fs42.existsSync(path71.join(projectDir, "pnpm-lock.yaml"))) {
239677
239883
  return "pnpm";
239678
239884
  }
239679
- if (fs47.existsSync(path70.join(projectDir, "yarn.lock")) || fs47.existsSync(path70.join(projectDir, ".yarnrc.yml"))) {
239885
+ if (fs42.existsSync(path71.join(projectDir, "yarn.lock")) || fs42.existsSync(path71.join(projectDir, ".yarnrc.yml"))) {
239680
239886
  return "yarn";
239681
239887
  }
239682
239888
  return "npm";
@@ -239763,10 +239969,10 @@ function hasExistingWpTypiaProjectSurface(projectDir, packageJson) {
239763
239969
  const scripts = packageJson?.scripts ?? {};
239764
239970
  const hasSyncSurface = typeof scripts.sync === "string" || typeof scripts["sync-types"] === "string";
239765
239971
  const hasHelperFiles = [
239766
- path70.join("scripts", "block-config.ts"),
239767
- path70.join("scripts", "sync-project.ts"),
239768
- path70.join("scripts", "sync-types-to-block-json.ts")
239769
- ].every((relativePath) => fs47.existsSync(path70.join(projectDir, relativePath)));
239972
+ path71.join("scripts", "block-config.ts"),
239973
+ path71.join("scripts", "sync-project.ts"),
239974
+ path71.join("scripts", "sync-types-to-block-json.ts")
239975
+ ].every((relativePath) => fs42.existsSync(path71.join(projectDir, relativePath)));
239770
239976
  const hasRuntimeDeps = typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-runtime") === "string" && typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-types") === "string";
239771
239977
  return hasSyncSurface && hasHelperFiles && hasRuntimeDeps;
239772
239978
  }
@@ -239906,27 +240112,27 @@ var init_cli_init_plan_presentation = __esm(() => {
239906
240112
  var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirror the migration bootstrap detector: `src/block.json` + `src/types.ts` + `src/save.tsx`, legacy root `block.json` + `src/types.ts` + `src/save.tsx`, or multi-block `src/blocks/*/block.json` workspaces.", RETROFIT_APPLY_PREVIEW_NOTE = "If you rerun with `wp-typia init --apply`, package.json and generated helper files are snapshotted and rolled back automatically if a write fails.", RETROFIT_ROLLBACK_NOTE = "Apply mode writes package.json and generated helper files with rollback-on-failure protection.";
239907
240113
 
239908
240114
  // ../wp-typia-project-tools/src/runtime/cli-init-plan.ts
239909
- import fs48 from "fs";
239910
- import path71 from "path";
240115
+ import fs43 from "fs";
240116
+ import path72 from "path";
239911
240117
  import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
239912
240118
  function normalizeRelativePath2(value2) {
239913
240119
  return value2.replace(/\\/gu, "/");
239914
240120
  }
239915
240121
  function buildGeneratedArtifactPaths(blockJsonFile, manifestFile) {
239916
- const manifestDir = path71.dirname(manifestFile);
240122
+ const manifestDir = path72.dirname(manifestFile);
239917
240123
  const artifactPaths = [
239918
240124
  blockJsonFile,
239919
240125
  manifestFile,
239920
- path71.join(manifestDir, "typia.schema.json"),
239921
- path71.join(manifestDir, "typia-validator.php"),
239922
- path71.join(manifestDir, "typia.openapi.json")
240126
+ path72.join(manifestDir, "typia.schema.json"),
240127
+ path72.join(manifestDir, "typia-validator.php"),
240128
+ path72.join(manifestDir, "typia.openapi.json")
239923
240129
  ];
239924
240130
  return Array.from(new Set(artifactPaths.map((filePath) => normalizeRelativePath2(filePath))));
239925
240131
  }
239926
240132
  function collectNamedSourceTypeCandidates(typesSource) {
239927
- const sourceFile = import_typescript3.default.createSourceFile("types.ts", typesSource, import_typescript3.default.ScriptTarget.Latest, true, import_typescript3.default.ScriptKind.TS);
240133
+ const sourceFile = import_typescript4.default.createSourceFile("types.ts", typesSource, import_typescript4.default.ScriptTarget.Latest, true, import_typescript4.default.ScriptKind.TS);
239928
240134
  return sourceFile.statements.flatMap((statement) => {
239929
- if (import_typescript3.default.isInterfaceDeclaration(statement) || import_typescript3.default.isTypeAliasDeclaration(statement)) {
240135
+ if (import_typescript4.default.isInterfaceDeclaration(statement) || import_typescript4.default.isTypeAliasDeclaration(statement)) {
239930
240136
  return [statement.name.text];
239931
240137
  }
239932
240138
  return [];
@@ -239940,8 +240146,8 @@ function isObjectLikeSourceType(projectDir, typesFile, sourceTypeName) {
239940
240146
  return analyzedTypes[sourceTypeName]?.kind === "object";
239941
240147
  }
239942
240148
  function inferRetrofitAttributeTypeName(projectDir, block) {
239943
- const typesPath = path71.join(projectDir, block.typesFile);
239944
- const typesSource = fs48.readFileSync(typesPath, "utf8");
240149
+ const typesPath = path72.join(projectDir, block.typesFile);
240150
+ const typesSource = fs43.readFileSync(typesPath, "utf8");
239945
240151
  const blockNameSegments = block.blockName.split("/");
239946
240152
  const slug = blockNameSegments[blockNameSegments.length - 1] ?? block.key;
239947
240153
  const candidateNames = collectNamedSourceTypeCandidates(typesSource);
@@ -240033,17 +240239,17 @@ function buildPlannedFiles(projectDir, layoutKind) {
240033
240239
  }
240034
240240
  return [
240035
240241
  {
240036
- action: fs48.existsSync(path71.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
240242
+ action: fs43.existsSync(path72.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
240037
240243
  path: "scripts/block-config.ts",
240038
240244
  purpose: "Declare the current retrofit block targets so sync-types can regenerate metadata from the existing TypeScript source of truth."
240039
240245
  },
240040
240246
  {
240041
- action: fs48.existsSync(path71.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
240247
+ action: fs43.existsSync(path72.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
240042
240248
  path: "scripts/sync-types-to-block-json.ts",
240043
240249
  purpose: "Generate block.json and Typia metadata artifacts from the current TypeScript source of truth."
240044
240250
  },
240045
240251
  {
240046
- action: fs48.existsSync(path71.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
240252
+ action: fs43.existsSync(path72.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
240047
240253
  path: "scripts/sync-project.ts",
240048
240254
  purpose: "Provide one shared sync entrypoint that can grow into sync-rest or workspace-aware refresh steps later."
240049
240255
  }
@@ -240084,7 +240290,7 @@ function createRetrofitPlan(options) {
240084
240290
  };
240085
240291
  }
240086
240292
  function getInitPlan(projectDir, options = {}) {
240087
- const resolvedProjectDir = path71.resolve(projectDir);
240293
+ const resolvedProjectDir = path72.resolve(projectDir);
240088
240294
  const packageJson = readProjectPackageJson(resolvedProjectDir);
240089
240295
  const packageManager = resolveInitPackageManager(resolvedProjectDir, packageJson, options.packageManager);
240090
240296
  const workspace = tryResolveWorkspaceProject(resolvedProjectDir);
@@ -240120,7 +240326,7 @@ function getInitPlan(projectDir, options = {}) {
240120
240326
  status: "already-initialized"
240121
240327
  });
240122
240328
  }
240123
- const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : path71.basename(resolvedProjectDir);
240329
+ const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : path72.basename(resolvedProjectDir);
240124
240330
  const layout = buildInitLayoutDetails(resolvedProjectDir);
240125
240331
  const dependencyChanges = buildDependencyChanges(packageJson);
240126
240332
  const scriptChanges = buildScriptChanges(packageJson, packageManager);
@@ -240162,7 +240368,7 @@ function getInitPlan(projectDir, options = {}) {
240162
240368
  status
240163
240369
  });
240164
240370
  }
240165
- var import_typescript3;
240371
+ var import_typescript4;
240166
240372
  var init_cli_init_plan = __esm(() => {
240167
240373
  init_migration_project();
240168
240374
  init_package_managers();
@@ -240170,11 +240376,11 @@ var init_cli_init_plan = __esm(() => {
240170
240376
  init_cli_init_package_json();
240171
240377
  init_cli_init_plan_presentation();
240172
240378
  init_workspace_project();
240173
- import_typescript3 = __toESM(require_typescript(), 1);
240379
+ import_typescript4 = __toESM(require_typescript(), 1);
240174
240380
  });
240175
240381
 
240176
240382
  // ../wp-typia-project-tools/src/runtime/cli-init-templates.ts
240177
- import path72 from "path";
240383
+ import path73 from "path";
240178
240384
  function buildRetrofitBlockConfigEntry(target) {
240179
240385
  return [
240180
240386
  "\t{",
@@ -240392,9 +240598,9 @@ main().catch( ( error ) => {
240392
240598
  }
240393
240599
  function buildRetrofitHelperFiles(blockTargets) {
240394
240600
  return {
240395
- [path72.join("scripts", "block-config.ts")]: buildRetrofitBlockConfigSource(blockTargets),
240396
- [path72.join("scripts", "sync-project.ts")]: buildRetrofitSyncProjectScriptSource(),
240397
- [path72.join("scripts", "sync-types-to-block-json.ts")]: buildRetrofitSyncTypesScriptSource()
240601
+ [path73.join("scripts", "block-config.ts")]: buildRetrofitBlockConfigSource(blockTargets),
240602
+ [path73.join("scripts", "sync-project.ts")]: buildRetrofitSyncProjectScriptSource(),
240603
+ [path73.join("scripts", "sync-types-to-block-json.ts")]: buildRetrofitSyncTypesScriptSource()
240398
240604
  };
240399
240605
  }
240400
240606
  var init_cli_init_templates = __esm(() => {
@@ -240403,12 +240609,12 @@ var init_cli_init_templates = __esm(() => {
240403
240609
  });
240404
240610
 
240405
240611
  // ../wp-typia-project-tools/src/runtime/cli-init-apply.ts
240406
- import fs49 from "fs";
240612
+ import fs44 from "fs";
240407
240613
  import { promises as fsp27 } from "fs";
240408
- import path73 from "path";
240614
+ import path74 from "path";
240409
240615
  async function createRetrofitMutationSnapshot(projectDir, filePaths) {
240410
- const scriptsDir = path73.join(projectDir, "scripts");
240411
- const scriptsDirExisted = fs49.existsSync(scriptsDir);
240616
+ const scriptsDir = path74.join(projectDir, "scripts");
240617
+ const scriptsDirExisted = fs44.existsSync(scriptsDir);
240412
240618
  const fileSources = await snapshotWorkspaceFiles(filePaths);
240413
240619
  const targetPaths = fileSources.filter((entry) => entry.source === null).map((entry) => entry.filePath);
240414
240620
  if (!scriptsDirExisted) {
@@ -240422,11 +240628,11 @@ async function createRetrofitMutationSnapshot(projectDir, filePaths) {
240422
240628
  }
240423
240629
  async function writeRetrofitFiles(options) {
240424
240630
  const helperFiles = buildRetrofitHelperFiles(options.blockTargets);
240425
- const scriptsDir = path73.join(options.projectDir, "scripts");
240631
+ const scriptsDir = path74.join(options.projectDir, "scripts");
240426
240632
  await fsp27.mkdir(scriptsDir, { recursive: true });
240427
- await fsp27.writeFile(path73.join(options.projectDir, "package.json"), buildProjectPackageJsonSource(options.packageJson), "utf8");
240633
+ await fsp27.writeFile(path74.join(options.projectDir, "package.json"), buildProjectPackageJsonSource(options.packageJson), "utf8");
240428
240634
  for (const [relativePath, source] of Object.entries(helperFiles)) {
240429
- await fsp27.writeFile(path73.join(options.projectDir, relativePath), source, "utf8");
240635
+ await fsp27.writeFile(path74.join(options.projectDir, relativePath), source, "utf8");
240430
240636
  }
240431
240637
  }
240432
240638
  function buildApplyFailureError(error48) {
@@ -240460,8 +240666,8 @@ async function applyInitPlan(projectDir, options = {}) {
240460
240666
  });
240461
240667
  const helperFiles = buildRetrofitHelperFiles(previewPlan.blockTargets);
240462
240668
  const filePaths = [
240463
- path73.join(previewPlan.projectDir, "package.json"),
240464
- ...Object.keys(helperFiles).map((relativePath) => path73.join(previewPlan.projectDir, relativePath))
240669
+ path74.join(previewPlan.projectDir, "package.json"),
240670
+ ...Object.keys(helperFiles).map((relativePath) => path74.join(previewPlan.projectDir, relativePath))
240465
240671
  ];
240466
240672
  const mutationSnapshot = await createRetrofitMutationSnapshot(previewPlan.projectDir, filePaths);
240467
240673
  try {
@@ -240517,27 +240723,27 @@ __export(exports_cli_scaffold, {
240517
240723
  getOptionalOnboarding: () => getOptionalOnboarding,
240518
240724
  getNextSteps: () => getNextSteps
240519
240725
  });
240520
- import fs50 from "fs";
240726
+ import fs45 from "fs";
240521
240727
  import { promises as fsp28 } from "fs";
240522
- import path74 from "path";
240728
+ import path75 from "path";
240523
240729
  async function listRelativeProjectFiles(rootDir) {
240524
240730
  const relativeFiles = [];
240525
240731
  async function visit2(currentDir) {
240526
240732
  const entries = await fsp28.readdir(currentDir, { withFileTypes: true });
240527
240733
  for (const entry of entries) {
240528
- const absolutePath = path74.join(currentDir, entry.name);
240734
+ const absolutePath = path75.join(currentDir, entry.name);
240529
240735
  if (entry.isDirectory()) {
240530
240736
  await visit2(absolutePath);
240531
240737
  continue;
240532
240738
  }
240533
- relativeFiles.push(path74.relative(rootDir, absolutePath).replace(path74.sep === "\\" ? /\\/gu : /\//gu, "/"));
240739
+ relativeFiles.push(path75.relative(rootDir, absolutePath).replace(path75.sep === "\\" ? /\\/gu : /\//gu, "/"));
240534
240740
  }
240535
240741
  }
240536
240742
  await visit2(rootDir);
240537
240743
  return relativeFiles.sort((left, right) => left.localeCompare(right));
240538
240744
  }
240539
240745
  async function assertDryRunTargetDirectoryReady(projectDir, allowExistingDir) {
240540
- if (!fs50.existsSync(projectDir) || allowExistingDir) {
240746
+ if (!fs45.existsSync(projectDir) || allowExistingDir) {
240541
240747
  return;
240542
240748
  }
240543
240749
  const entries = await fsp28.readdir(projectDir);
@@ -240568,7 +240774,7 @@ async function buildScaffoldDryRunPlan({
240568
240774
  }) {
240569
240775
  await assertDryRunTargetDirectoryReady(projectDir, allowExistingDir);
240570
240776
  const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-scaffold-plan-");
240571
- const previewProjectDir = path74.join(tempRoot, "preview-project");
240777
+ const previewProjectDir = path75.join(tempRoot, "preview-project");
240572
240778
  try {
240573
240779
  const result = await scaffoldProject({
240574
240780
  allowExistingDir: false,
@@ -240608,14 +240814,14 @@ function validateCreateProjectInput(projectInput) {
240608
240814
  if (normalizedProjectInput.length === 0) {
240609
240815
  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).");
240610
240816
  }
240611
- const normalizedProjectPath = path74.normalize(normalizedProjectInput).replace(/[\\/]+$/u, "") || path74.normalize(normalizedProjectInput);
240817
+ const normalizedProjectPath = path75.normalize(normalizedProjectInput).replace(/[\\/]+$/u, "") || path75.normalize(normalizedProjectInput);
240612
240818
  if (normalizedProjectPath === "." || normalizedProjectPath === "..") {
240613
240819
  throw new Error("`wp-typia create` requires a new project directory. Use an explicit child directory instead of `.` or `..`.");
240614
240820
  }
240615
240821
  }
240616
240822
  function collectProjectDirectoryWarnings(projectDir) {
240617
240823
  const warnings = [];
240618
- const projectName = path74.basename(projectDir);
240824
+ const projectName = path75.basename(projectDir);
240619
240825
  if (/\s/u.test(projectName)) {
240620
240826
  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.`);
240621
240827
  }
@@ -240770,7 +240976,7 @@ function getNextSteps({
240770
240976
  noInstall,
240771
240977
  templateId
240772
240978
  }) {
240773
- const cdTarget = path74.isAbsolute(projectInput) ? projectDir : projectInput;
240979
+ const cdTarget = path75.isAbsolute(projectInput) ? projectDir : projectInput;
240774
240980
  const steps = [`cd ${quoteShellValue(cdTarget)}`];
240775
240981
  if (noInstall) {
240776
240982
  steps.push(formatInstallCommand(packageManager));
@@ -240918,8 +241124,8 @@ async function runScaffoldFlow({
240918
241124
  select: selectWithMigrationUi,
240919
241125
  yes
240920
241126
  });
240921
- const projectDir = path74.resolve(cwd, projectInput);
240922
- const projectName = path74.basename(projectDir);
241127
+ const projectDir = path75.resolve(cwd, projectInput);
241128
+ const projectName = path75.basename(projectDir);
240923
241129
  const answers = await collectScaffoldAnswers({
240924
241130
  dataStorageMode: resolvedDataStorage,
240925
241131
  namespace,
@@ -240982,7 +241188,7 @@ async function runScaffoldFlow({
240982
241188
  let availableScripts;
240983
241189
  if (!dryRun) {
240984
241190
  try {
240985
- const parsedPackageJson = JSON.parse(fs50.readFileSync(path74.join(projectDir, "package.json"), "utf8"));
241191
+ const parsedPackageJson = JSON.parse(fs45.readFileSync(path75.join(projectDir, "package.json"), "utf8"));
240986
241192
  const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
240987
241193
  availableScripts = Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
240988
241194
  } catch {
@@ -240995,7 +241201,7 @@ async function runScaffoldFlow({
240995
241201
  availableScripts,
240996
241202
  packageManager: resolvedPackageManager,
240997
241203
  templateId: resolvedTemplateId,
240998
- compoundPersistenceEnabled: resolvedResult.result.variables.compoundPersistenceEnabled === "true"
241204
+ compoundPersistenceEnabled: isCompoundPersistenceEnabled(resolvedResult.result.variables)
240999
241205
  }),
241000
241206
  plan: resolvedResult.plan,
241001
241207
  projectDir,
@@ -241029,6 +241235,7 @@ var init_cli_scaffold = __esm(() => {
241029
241235
  init_scaffold();
241030
241236
  init_alternate_render_targets();
241031
241237
  init_compound_inner_blocks();
241238
+ init_scaffold_template_variable_groups();
241032
241239
  init_package_managers();
241033
241240
  init_local_dev_presets();
241034
241241
  init_temp_roots();
@@ -294952,7 +295159,7 @@ async function simulateWorkspaceAddDryRun({
294952
295159
  // package.json
294953
295160
  var package_default2 = {
294954
295161
  name: "wp-typia",
294955
- version: "0.22.7",
295162
+ version: "0.22.8",
294956
295163
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
294957
295164
  packageManager: "bun@1.3.11",
294958
295165
  type: "module",
@@ -295022,7 +295229,7 @@ var package_default2 = {
295022
295229
  "@bunli/tui": "0.6.0",
295023
295230
  "@bunli/utils": "0.6.0",
295024
295231
  "@wp-typia/api-client": "^0.4.5",
295025
- "@wp-typia/project-tools": "0.22.7",
295232
+ "@wp-typia/project-tools": "0.22.8",
295026
295233
  "better-result": "^2.7.0",
295027
295234
  react: "^19.2.5",
295028
295235
  "react-dom": "^19.2.5",
@@ -295572,6 +295779,7 @@ var loadCliInitRuntime = () => Promise.resolve().then(() => (init_cli_init(), ex
295572
295779
  var loadCliPromptRuntime = () => Promise.resolve().then(() => (init_cli_prompt(), exports_cli_prompt));
295573
295780
  var loadCliScaffoldRuntime = () => Promise.resolve().then(() => (init_cli_scaffold(), exports_cli_scaffold));
295574
295781
  var loadCliTemplatesRuntime = () => Promise.resolve().then(() => (init_cli_templates(), exports_cli_templates));
295782
+ var loadCreateTemplateValidationRuntime = () => Promise.resolve().then(() => (init_create_template_validation(), exports_create_template_validation));
295575
295783
  var loadMigrationsRuntime = () => Promise.resolve().then(() => (init_migrations(), exports_migrations));
295576
295784
  async function wrapCliCommandError(command, error48) {
295577
295785
  const { createCliCommandError: createCliCommandError2 } = await loadCliDiagnosticsRuntime();
@@ -295685,20 +295893,24 @@ async function executeCreateCommand({
295685
295893
  prompt,
295686
295894
  warnLine = console.warn
295687
295895
  }) {
295688
- const [
295689
- { createReadlinePrompt: createReadlinePrompt2 },
295690
- { runScaffoldFlow: runScaffoldFlow2 },
295691
- { getTemplateSelectOptions: getTemplateSelectOptions2 }
295692
- ] = await Promise.all([
295693
- loadCliPromptRuntime(),
295694
- loadCliScaffoldRuntime(),
295695
- loadCliTemplatesRuntime()
295696
- ]);
295697
- const shouldPrompt = interactive ?? (!Boolean(flags2.yes) && isInteractiveTerminal());
295698
- const activePrompt = shouldPrompt ? prompt ?? createReadlinePrompt2() : undefined;
295699
- const shouldPromptForExternalLayerSelection = Boolean(activePrompt) && activePrompt !== prompt;
295700
- const effectiveYes = Boolean(flags2.yes) || Boolean(flags2["dry-run"]) && !Boolean(activePrompt);
295896
+ let activePrompt;
295701
295897
  try {
295898
+ const requestedTemplateId = readOptionalLooseStringFlag(flags2, "template");
295899
+ const resolvedTemplateId = requestedTemplateId ? (await loadCreateTemplateValidationRuntime()).validateExplicitCreateTemplateId(requestedTemplateId) : undefined;
295900
+ const [
295901
+ { createReadlinePrompt: createReadlinePrompt2 },
295902
+ { runScaffoldFlow: runScaffoldFlow2 },
295903
+ { getTemplateSelectOptions: getTemplateSelectOptions2 }
295904
+ ] = await Promise.all([
295905
+ loadCliPromptRuntime(),
295906
+ loadCliScaffoldRuntime(),
295907
+ loadCliTemplatesRuntime()
295908
+ ]);
295909
+ const shouldPrompt = interactive ?? (!Boolean(flags2.yes) && isInteractiveTerminal());
295910
+ activePrompt = shouldPrompt ? prompt ?? createReadlinePrompt2() : undefined;
295911
+ const scaffoldPrompt = activePrompt;
295912
+ const shouldPromptForExternalLayerSelection = Boolean(scaffoldPrompt) && scaffoldPrompt !== prompt;
295913
+ const effectiveYes = Boolean(flags2.yes) || Boolean(flags2["dry-run"]) && !Boolean(scaffoldPrompt);
295702
295914
  const flow = await runScaffoldFlow2({
295703
295915
  alternateRenderTargets: readOptionalLooseStringFlag(flags2, "alternate-render-targets"),
295704
295916
  cwd,
@@ -295707,7 +295919,7 @@ async function executeCreateCommand({
295707
295919
  externalLayerId: readOptionalLooseStringFlag(flags2, "external-layer-id"),
295708
295920
  externalLayerSource: readOptionalLooseStringFlag(flags2, "external-layer-source"),
295709
295921
  innerBlocksPreset: readOptionalLooseStringFlag(flags2, "inner-blocks-preset"),
295710
- isInteractive: Boolean(activePrompt),
295922
+ isInteractive: Boolean(scaffoldPrompt),
295711
295923
  namespace: readOptionalLooseStringFlag(flags2, "namespace"),
295712
295924
  noInstall: Boolean(flags2["no-install"]),
295713
295925
  packageManager: readOptionalLooseStringFlag(flags2, "package-manager"),
@@ -295724,17 +295936,17 @@ async function executeCreateCommand({
295724
295936
  printLine(formatCreateProgressLine(payload2));
295725
295937
  }
295726
295938
  },
295727
- promptText: activePrompt ? (message, defaultValue, validate) => activePrompt.text(message, defaultValue, validate) : undefined,
295939
+ promptText: scaffoldPrompt ? (message, defaultValue, validate) => scaffoldPrompt.text(message, defaultValue, validate) : undefined,
295728
295940
  queryPostType: readOptionalLooseStringFlag(flags2, "query-post-type"),
295729
- selectDataStorage: activePrompt ? () => activePrompt.select("Select a data storage mode", [...DATA_STORAGE_PROMPT_OPTIONS], 1) : undefined,
295730
- selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
295731
- selectPackageManager: activePrompt ? () => activePrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
295732
- selectPersistencePolicy: activePrompt ? () => activePrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
295733
- selectTemplate: activePrompt ? () => activePrompt.select("Select a template", getTemplateSelectOptions2(), 1) : undefined,
295734
- selectWithMigrationUi: activePrompt ? async () => await activePrompt.select("Enable migration UI support?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295735
- selectWithTestPreset: activePrompt ? async () => await activePrompt.select("Include the Playwright test preset?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295736
- selectWithWpEnv: activePrompt ? async () => await activePrompt.select("Include a local wp-env preset?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295737
- templateId: readOptionalLooseStringFlag(flags2, "template"),
295941
+ selectDataStorage: scaffoldPrompt ? () => scaffoldPrompt.select("Select a data storage mode", [...DATA_STORAGE_PROMPT_OPTIONS], 1) : undefined,
295942
+ selectExternalLayerId: shouldPromptForExternalLayerSelection && scaffoldPrompt ? (options) => scaffoldPrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
295943
+ selectPackageManager: scaffoldPrompt ? () => scaffoldPrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
295944
+ selectPersistencePolicy: scaffoldPrompt ? () => scaffoldPrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
295945
+ selectTemplate: scaffoldPrompt ? () => scaffoldPrompt.select("Select a template", getTemplateSelectOptions2(), 1) : undefined,
295946
+ selectWithMigrationUi: scaffoldPrompt ? async () => await scaffoldPrompt.select("Enable migration UI support?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295947
+ selectWithTestPreset: scaffoldPrompt ? async () => await scaffoldPrompt.select("Include the Playwright test preset?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295948
+ selectWithWpEnv: scaffoldPrompt ? async () => await scaffoldPrompt.select("Include a local wp-env preset?", [...BOOLEAN_PROMPT_OPTIONS], 2) === "yes" : undefined,
295949
+ templateId: resolvedTemplateId,
295738
295950
  textDomain: readOptionalLooseStringFlag(flags2, "text-domain"),
295739
295951
  variant: readOptionalLooseStringFlag(flags2, "variant"),
295740
295952
  withMigrationUi: flags2["with-migration-ui"],
@@ -296587,8 +296799,8 @@ var init_default = initCommand;
296587
296799
  init_cli_diagnostics();
296588
296800
 
296589
296801
  // src/mcp.ts
296590
- import fs51 from "fs/promises";
296591
- import path75 from "path";
296802
+ import fs46 from "fs/promises";
296803
+ import path76 from "path";
296592
296804
 
296593
296805
  // ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
296594
296806
  class SchemaConversionError extends TaggedError("SchemaConversionError")() {
@@ -297106,6 +297318,7 @@ function generateIndexFile(toolGroups) {
297106
297318
  `);
297107
297319
  }
297108
297320
  // src/mcp.ts
297321
+ init_cli_diagnostics();
297109
297322
  function isObject3(value2) {
297110
297323
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
297111
297324
  }
@@ -297115,10 +297328,21 @@ function isTool(value2) {
297115
297328
  function isToolGroup(value2) {
297116
297329
  return isObject3(value2) && typeof value2.namespace === "string" && Array.isArray(value2.tools) && value2.tools.every(isTool);
297117
297330
  }
297331
+ function getErrorMessage2(error48) {
297332
+ return error48 instanceof Error ? error48.message : String(error48);
297333
+ }
297334
+ function getErrorCauseOptions(error48) {
297335
+ return error48 instanceof Error ? { cause: error48 } : undefined;
297336
+ }
297118
297337
  async function readSchemaSource(cwd, source) {
297119
- const schemaPath = path75.resolve(cwd, source.path);
297120
- const raw = await fs51.readFile(schemaPath, "utf8");
297121
- const parsed = JSON.parse(raw);
297338
+ const schemaPath = path76.resolve(cwd, source.path);
297339
+ const raw = await fs46.readFile(schemaPath, "utf8");
297340
+ let parsed;
297341
+ try {
297342
+ parsed = JSON.parse(raw);
297343
+ } catch (error48) {
297344
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Schema source "${source.path}" must contain valid JSON. ${getErrorMessage2(error48)}`, getErrorCauseOptions(error48));
297345
+ }
297122
297346
  if (isToolGroup(parsed)) {
297123
297347
  return parsed;
297124
297348
  }
@@ -297128,19 +297352,19 @@ async function readSchemaSource(cwd, source) {
297128
297352
  tools: parsed
297129
297353
  };
297130
297354
  }
297131
- throw new Error(`Schema source "${source.path}" must contain either one MCPToolGroup object or an array of MCP tools.`);
297355
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Schema source "${source.path}" must contain either one MCPToolGroup object or an array of MCP tools.`);
297132
297356
  }
297133
297357
  async function loadMcpToolGroups(cwd, schemaSources) {
297134
297358
  return Promise.all(schemaSources.map((source) => readSchemaSource(cwd, source)));
297135
297359
  }
297136
- async function syncMcpSchemas(cwd, schemaSources, outputDir = path75.join(cwd, ".bunli", "mcp")) {
297360
+ async function syncMcpSchemas(cwd, schemaSources, outputDir = path76.join(cwd, ".bunli", "mcp")) {
297137
297361
  const groups = await loadMcpToolGroups(cwd, schemaSources);
297138
297362
  const result = await generateMCPTypes({
297139
297363
  outputDir,
297140
297364
  tools: groups
297141
297365
  });
297142
297366
  if (Result.isError(result)) {
297143
- throw result.error;
297367
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, getErrorMessage2(result.error), getErrorCauseOptions(result.error));
297144
297368
  }
297145
297369
  const registry2 = groups.map((group) => ({
297146
297370
  namespace: group.namespace,
@@ -297152,11 +297376,11 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path75.join(cwd, "
297152
297376
  namespace: group.namespace
297153
297377
  });
297154
297378
  if (Result.isError(convert)) {
297155
- throw convert.error;
297379
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, getErrorMessage2(convert.error), getErrorCauseOptions(convert.error));
297156
297380
  }
297157
297381
  }
297158
- await fs51.mkdir(outputDir, { recursive: true });
297159
- await fs51.writeFile(path75.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
297382
+ await fs46.mkdir(outputDir, { recursive: true });
297383
+ await fs46.writeFile(path76.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
297160
297384
  `, "utf8");
297161
297385
  return {
297162
297386
  commandCount: registry2.reduce((count, group) => count + group.tools.length, 0),
@@ -297475,4 +297699,4 @@ export {
297475
297699
  cli
297476
297700
  };
297477
297701
 
297478
- //# debugId=2EE58DC8E78CAD3164756E2164756E21
297702
+ //# debugId=44BBE95891EFC60564756E2164756E21