wp-typia 0.22.4 → 0.22.5

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.
@@ -211063,6 +211063,9 @@ function replacePhpFunctionDefinition(source, functionName, replacement, options
211063
211063
  import fs19 from "fs";
211064
211064
  import path26 from "path";
211065
211065
  import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
211066
+ function defineInventoryEntryParser(descriptor) {
211067
+ return descriptor;
211068
+ }
211066
211069
  function getPropertyNameText(name2) {
211067
211070
  if (import_typescript.default.isIdentifier(name2) || import_typescript.default.isStringLiteral(name2)) {
211068
211071
  return name2.text;
@@ -211142,240 +211145,95 @@ function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral,
211142
211145
  }
211143
211146
  throw new Error(`${entryName}[${elementIndex}] is missing required "${key2}" in scripts/block-config.ts.`);
211144
211147
  }
211145
- function parseBlockEntries(arrayLiteral) {
211146
- return arrayLiteral.elements.map((element, elementIndex) => {
211147
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211148
- throw new Error(`BLOCKS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211149
- }
211150
- return {
211151
- apiTypesFile: getOptionalStringProperty("BLOCKS", elementIndex, element, "apiTypesFile"),
211152
- attributeTypeName: getOptionalStringProperty("BLOCKS", elementIndex, element, "attributeTypeName"),
211153
- openApiFile: getOptionalStringProperty("BLOCKS", elementIndex, element, "openApiFile"),
211154
- slug: getRequiredStringProperty("BLOCKS", elementIndex, element, "slug"),
211155
- typesFile: getRequiredStringProperty("BLOCKS", elementIndex, element, "typesFile")
211156
- };
211157
- });
211158
- }
211159
- function parseVariationEntries(arrayLiteral) {
211148
+ function parseInventoryEntries(arrayLiteral, descriptor) {
211160
211149
  return arrayLiteral.elements.map((element, elementIndex) => {
211161
211150
  if (!import_typescript.default.isObjectLiteralExpression(element)) {
211162
- throw new Error(`VARIATIONS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211163
- }
211164
- return {
211165
- block: getRequiredStringProperty("VARIATIONS", elementIndex, element, "block"),
211166
- file: getRequiredStringProperty("VARIATIONS", elementIndex, element, "file"),
211167
- slug: getRequiredStringProperty("VARIATIONS", elementIndex, element, "slug")
211168
- };
211169
- });
211170
- }
211171
- function parseBlockStyleEntries(arrayLiteral) {
211172
- return arrayLiteral.elements.map((element, elementIndex) => {
211173
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211174
- throw new Error(`BLOCK_STYLES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211175
- }
211176
- return {
211177
- block: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "block"),
211178
- file: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "file"),
211179
- slug: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "slug")
211180
- };
211181
- });
211182
- }
211183
- function parseBlockTransformEntries(arrayLiteral) {
211184
- return arrayLiteral.elements.map((element, elementIndex) => {
211185
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211186
- throw new Error(`BLOCK_TRANSFORMS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211187
- }
211188
- return {
211189
- block: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "block"),
211190
- file: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "file"),
211191
- from: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "from"),
211192
- slug: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "slug"),
211193
- to: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "to")
211194
- };
211195
- });
211196
- }
211197
- function parsePatternEntries(arrayLiteral) {
211198
- return arrayLiteral.elements.map((element, elementIndex) => {
211199
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211200
- throw new Error(`PATTERNS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211201
- }
211202
- return {
211203
- file: getRequiredStringProperty("PATTERNS", elementIndex, element, "file"),
211204
- slug: getRequiredStringProperty("PATTERNS", elementIndex, element, "slug")
211205
- };
211206
- });
211207
- }
211208
- function parseBindingSourceEntries(arrayLiteral) {
211209
- return arrayLiteral.elements.map((element, elementIndex) => {
211210
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211211
- throw new Error(`BINDING_SOURCES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211212
- }
211213
- return {
211214
- attribute: getOptionalStringProperty("BINDING_SOURCES", elementIndex, element, "attribute"),
211215
- block: getOptionalStringProperty("BINDING_SOURCES", elementIndex, element, "block"),
211216
- editorFile: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "editorFile"),
211217
- serverFile: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "serverFile"),
211218
- slug: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "slug")
211219
- };
211220
- });
211221
- }
211222
- function parseRestResourceEntries(arrayLiteral) {
211223
- return arrayLiteral.elements.map((element, elementIndex) => {
211224
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211225
- throw new Error(`REST_RESOURCES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211226
- }
211227
- const methods = getRequiredStringArrayProperty("REST_RESOURCES", elementIndex, element, "methods");
211228
- const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
211229
- if (invalidMethods.length > 0) {
211230
- throw new Error(`REST_RESOURCES[${elementIndex}].methods includes unsupported values: ${invalidMethods.join(", ")}.`);
211231
- }
211232
- return {
211233
- apiFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "apiFile"),
211234
- clientFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "clientFile"),
211235
- dataFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "dataFile"),
211236
- methods,
211237
- namespace: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "namespace"),
211238
- openApiFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "openApiFile"),
211239
- phpFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "phpFile"),
211240
- slug: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "slug"),
211241
- typesFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "typesFile"),
211242
- validatorsFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "validatorsFile")
211243
- };
211244
- });
211245
- }
211246
- function parseAiFeatureEntries(arrayLiteral) {
211247
- return arrayLiteral.elements.map((element, elementIndex) => {
211248
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211249
- throw new Error(`AI_FEATURES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211151
+ throw new Error(`${descriptor.entryName}[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211152
+ }
211153
+ const entry = {};
211154
+ for (const field of descriptor.fields) {
211155
+ const kind = field.kind ?? "string";
211156
+ const value2 = kind === "stringArray" ? getRequiredStringArrayProperty(descriptor.entryName, elementIndex, element, field.key) : field.required ? getRequiredStringProperty(descriptor.entryName, elementIndex, element, field.key) : getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
211157
+ field.validate?.(value2, {
211158
+ elementIndex,
211159
+ entryName: descriptor.entryName,
211160
+ key: field.key
211161
+ });
211162
+ entry[field.key] = value2;
211250
211163
  }
211251
- return {
211252
- aiSchemaFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "aiSchemaFile"),
211253
- apiFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "apiFile"),
211254
- clientFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "clientFile"),
211255
- dataFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "dataFile"),
211256
- namespace: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "namespace"),
211257
- openApiFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "openApiFile"),
211258
- phpFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "phpFile"),
211259
- slug: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "slug"),
211260
- typesFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "typesFile"),
211261
- validatorsFile: getRequiredStringProperty("AI_FEATURES", elementIndex, element, "validatorsFile")
211262
- };
211164
+ return entry;
211263
211165
  });
211264
211166
  }
211265
- function parseAbilityEntries(arrayLiteral) {
211266
- return arrayLiteral.elements.map((element, elementIndex) => {
211267
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211268
- throw new Error(`ABILITIES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211269
- }
211167
+ function parseInventorySection(sourceFile, descriptor) {
211168
+ if (!descriptor.parse) {
211270
211169
  return {
211271
- clientFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "clientFile"),
211272
- configFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "configFile"),
211273
- dataFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "dataFile"),
211274
- inputSchemaFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "inputSchemaFile"),
211275
- inputTypeName: getRequiredStringProperty("ABILITIES", elementIndex, element, "inputTypeName"),
211276
- outputSchemaFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "outputSchemaFile"),
211277
- outputTypeName: getRequiredStringProperty("ABILITIES", elementIndex, element, "outputTypeName"),
211278
- phpFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "phpFile"),
211279
- slug: getRequiredStringProperty("ABILITIES", elementIndex, element, "slug"),
211280
- typesFile: getRequiredStringProperty("ABILITIES", elementIndex, element, "typesFile")
211170
+ entries: [],
211171
+ found: false
211281
211172
  };
211282
- });
211283
- }
211284
- function parseEditorPluginEntries(arrayLiteral) {
211285
- return arrayLiteral.elements.map((element, elementIndex) => {
211286
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211287
- throw new Error(`EDITOR_PLUGINS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211173
+ }
211174
+ const exportName = descriptor.parse.exportName ?? descriptor.value?.name;
211175
+ if (!exportName) {
211176
+ throw new Error("Inventory parser descriptor is missing an export name.");
211177
+ }
211178
+ const exportedArray = findExportedArrayLiteral(sourceFile, exportName);
211179
+ if (!exportedArray.found) {
211180
+ if (descriptor.parse.required) {
211181
+ throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
211288
211182
  }
211289
211183
  return {
211290
- file: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "file"),
211291
- slug: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "slug"),
211292
- slot: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "slot")
211184
+ entries: [],
211185
+ found: false
211293
211186
  };
211294
- });
211295
- }
211296
- function parseAdminViewEntries(arrayLiteral) {
211297
- return arrayLiteral.elements.map((element, elementIndex) => {
211298
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
211299
- throw new Error(`ADMIN_VIEWS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
211187
+ }
211188
+ if (!exportedArray.array) {
211189
+ if (descriptor.parse.required) {
211190
+ throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
211300
211191
  }
211301
- return {
211302
- file: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "file"),
211303
- phpFile: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "phpFile"),
211304
- slug: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "slug"),
211305
- source: getOptionalStringProperty("ADMIN_VIEWS", elementIndex, element, "source")
211306
- };
211307
- });
211192
+ throw new Error(`scripts/block-config.ts must export ${exportName} as an array literal.`);
211193
+ }
211194
+ return {
211195
+ entries: parseInventoryEntries(exportedArray.array, descriptor.parse.entry),
211196
+ found: true
211197
+ };
211308
211198
  }
211309
211199
  function parseWorkspaceInventorySource(source) {
211310
211200
  const sourceFile = import_typescript.default.createSourceFile("block-config.ts", source, import_typescript.default.ScriptTarget.Latest, true, import_typescript.default.ScriptKind.TS);
211311
- const blockArray = findExportedArrayLiteral(sourceFile, "BLOCKS");
211312
- if (!blockArray.found || !blockArray.array) {
211313
- throw new Error("scripts/block-config.ts must export a BLOCKS array.");
211314
- }
211315
- const variationArray = findExportedArrayLiteral(sourceFile, "VARIATIONS");
211316
- const blockStyleArray = findExportedArrayLiteral(sourceFile, "BLOCK_STYLES");
211317
- const blockTransformArray = findExportedArrayLiteral(sourceFile, "BLOCK_TRANSFORMS");
211318
- const patternArray = findExportedArrayLiteral(sourceFile, "PATTERNS");
211319
- const bindingSourceArray = findExportedArrayLiteral(sourceFile, "BINDING_SOURCES");
211320
- const restResourceArray = findExportedArrayLiteral(sourceFile, "REST_RESOURCES");
211321
- const abilityArray = findExportedArrayLiteral(sourceFile, "ABILITIES");
211322
- const aiFeatureArray = findExportedArrayLiteral(sourceFile, "AI_FEATURES");
211323
- const adminViewArray = findExportedArrayLiteral(sourceFile, "ADMIN_VIEWS");
211324
- const editorPluginArray = findExportedArrayLiteral(sourceFile, "EDITOR_PLUGINS");
211325
- if (variationArray.found && !variationArray.array) {
211326
- throw new Error("scripts/block-config.ts must export VARIATIONS as an array literal.");
211327
- }
211328
- if (blockStyleArray.found && !blockStyleArray.array) {
211329
- throw new Error("scripts/block-config.ts must export BLOCK_STYLES as an array literal.");
211330
- }
211331
- if (blockTransformArray.found && !blockTransformArray.array) {
211332
- throw new Error("scripts/block-config.ts must export BLOCK_TRANSFORMS as an array literal.");
211333
- }
211334
- if (patternArray.found && !patternArray.array) {
211335
- throw new Error("scripts/block-config.ts must export PATTERNS as an array literal.");
211336
- }
211337
- if (bindingSourceArray.found && !bindingSourceArray.array) {
211338
- throw new Error("scripts/block-config.ts must export BINDING_SOURCES as an array literal.");
211339
- }
211340
- if (restResourceArray.found && !restResourceArray.array) {
211341
- throw new Error("scripts/block-config.ts must export REST_RESOURCES as an array literal.");
211342
- }
211343
- if (abilityArray.found && !abilityArray.array) {
211344
- throw new Error("scripts/block-config.ts must export ABILITIES as an array literal.");
211345
- }
211346
- if (aiFeatureArray.found && !aiFeatureArray.array) {
211347
- throw new Error("scripts/block-config.ts must export AI_FEATURES as an array literal.");
211348
- }
211349
- if (adminViewArray.found && !adminViewArray.array) {
211350
- throw new Error("scripts/block-config.ts must export ADMIN_VIEWS as an array literal.");
211351
- }
211352
- if (editorPluginArray.found && !editorPluginArray.array) {
211353
- throw new Error("scripts/block-config.ts must export EDITOR_PLUGINS as an array literal.");
211354
- }
211355
- return {
211356
- abilities: abilityArray.array ? parseAbilityEntries(abilityArray.array) : [],
211357
- adminViews: adminViewArray.array ? parseAdminViewEntries(adminViewArray.array) : [],
211358
- aiFeatures: aiFeatureArray.array ? parseAiFeatureEntries(aiFeatureArray.array) : [],
211359
- bindingSources: bindingSourceArray.array ? parseBindingSourceEntries(bindingSourceArray.array) : [],
211360
- blockStyles: blockStyleArray.array ? parseBlockStyleEntries(blockStyleArray.array) : [],
211361
- blockTransforms: blockTransformArray.array ? parseBlockTransformEntries(blockTransformArray.array) : [],
211362
- blocks: parseBlockEntries(blockArray.array),
211363
- hasAbilitiesSection: abilityArray.found,
211364
- hasAdminViewsSection: adminViewArray.found,
211365
- hasAiFeaturesSection: aiFeatureArray.found,
211366
- hasBindingSourcesSection: bindingSourceArray.found,
211367
- hasBlockStylesSection: blockStyleArray.found,
211368
- hasBlockTransformsSection: blockTransformArray.found,
211369
- hasEditorPluginsSection: editorPluginArray.found,
211370
- hasPatternsSection: patternArray.found,
211371
- hasRestResourcesSection: restResourceArray.found,
211372
- hasVariationsSection: variationArray.found,
211373
- editorPlugins: editorPluginArray.array ? parseEditorPluginEntries(editorPluginArray.array) : [],
211374
- patterns: patternArray.array ? parsePatternEntries(patternArray.array) : [],
211375
- restResources: restResourceArray.array ? parseRestResourceEntries(restResourceArray.array) : [],
211201
+ const parsedInventory = {
211202
+ abilities: [],
211203
+ adminViews: [],
211204
+ aiFeatures: [],
211205
+ bindingSources: [],
211206
+ blockStyles: [],
211207
+ blockTransforms: [],
211208
+ blocks: parseInventorySection(sourceFile, BLOCK_INVENTORY_SECTION).entries,
211209
+ editorPlugins: [],
211210
+ hasAbilitiesSection: false,
211211
+ hasAdminViewsSection: false,
211212
+ hasAiFeaturesSection: false,
211213
+ hasBindingSourcesSection: false,
211214
+ hasBlockStylesSection: false,
211215
+ hasBlockTransformsSection: false,
211216
+ hasEditorPluginsSection: false,
211217
+ hasPatternsSection: false,
211218
+ hasRestResourcesSection: false,
211219
+ hasVariationsSection: false,
211220
+ patterns: [],
211221
+ restResources: [],
211376
211222
  source,
211377
- variations: variationArray.array ? parseVariationEntries(variationArray.array) : []
211223
+ variations: []
211378
211224
  };
211225
+ const mutableInventory = parsedInventory;
211226
+ for (const section of INVENTORY_SECTIONS) {
211227
+ if (!section.parse) {
211228
+ continue;
211229
+ }
211230
+ const parsedSection = parseInventorySection(sourceFile, section);
211231
+ mutableInventory[section.parse.entriesKey] = parsedSection.entries;
211232
+ if (section.parse.hasSectionKey) {
211233
+ mutableInventory[section.parse.hasSectionKey] = parsedSection.found;
211234
+ }
211235
+ }
211236
+ return parsedInventory;
211379
211237
  }
211380
211238
  function readWorkspaceInventory(projectDir) {
211381
211239
  const blockConfigPath = path26.join(projectDir, "scripts", "block-config.ts");
@@ -211654,7 +211512,7 @@ export interface WorkspaceEditorPluginConfig {
211654
211512
  export const EDITOR_PLUGINS: WorkspaceEditorPluginConfig[] = [
211655
211513
  // wp-typia add editor-plugin entries
211656
211514
  ];
211657
- `, INVENTORY_SECTIONS;
211515
+ `, BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS;
211658
211516
  var init_workspace_inventory = __esm(() => {
211659
211517
  init_cli_add_shared();
211660
211518
  import_typescript = __toESM(require_typescript(), 1);
@@ -211691,12 +211549,41 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211691
211549
  validatorsFile: string;
211692
211550
  }
211693
211551
  `;
211552
+ BLOCK_INVENTORY_SECTION = {
211553
+ parse: {
211554
+ entriesKey: "blocks",
211555
+ entry: defineInventoryEntryParser({
211556
+ entryName: "BLOCKS",
211557
+ fields: [
211558
+ { key: "apiTypesFile" },
211559
+ { key: "attributeTypeName" },
211560
+ { key: "openApiFile" },
211561
+ { key: "slug", required: true },
211562
+ { key: "typesFile", required: true }
211563
+ ]
211564
+ }),
211565
+ exportName: "BLOCKS",
211566
+ required: true
211567
+ }
211568
+ };
211694
211569
  INVENTORY_SECTIONS = [
211695
211570
  {
211696
211571
  interface: {
211697
211572
  name: "WorkspaceVariationConfig",
211698
211573
  section: VARIATIONS_INTERFACE_SECTION
211699
211574
  },
211575
+ parse: {
211576
+ entriesKey: "variations",
211577
+ entry: defineInventoryEntryParser({
211578
+ entryName: "VARIATIONS",
211579
+ fields: [
211580
+ { key: "block", required: true },
211581
+ { key: "file", required: true },
211582
+ { key: "slug", required: true }
211583
+ ]
211584
+ }),
211585
+ hasSectionKey: "hasVariationsSection"
211586
+ },
211700
211587
  value: {
211701
211588
  name: "VARIATIONS",
211702
211589
  section: VARIATIONS_CONST_SECTION
@@ -211707,6 +211594,18 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211707
211594
  name: "WorkspaceBlockStyleConfig",
211708
211595
  section: BLOCK_STYLES_INTERFACE_SECTION
211709
211596
  },
211597
+ parse: {
211598
+ entriesKey: "blockStyles",
211599
+ entry: defineInventoryEntryParser({
211600
+ entryName: "BLOCK_STYLES",
211601
+ fields: [
211602
+ { key: "block", required: true },
211603
+ { key: "file", required: true },
211604
+ { key: "slug", required: true }
211605
+ ]
211606
+ }),
211607
+ hasSectionKey: "hasBlockStylesSection"
211608
+ },
211710
211609
  value: {
211711
211610
  name: "BLOCK_STYLES",
211712
211611
  section: BLOCK_STYLES_CONST_SECTION
@@ -211717,6 +211616,20 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211717
211616
  name: "WorkspaceBlockTransformConfig",
211718
211617
  section: BLOCK_TRANSFORMS_INTERFACE_SECTION
211719
211618
  },
211619
+ parse: {
211620
+ entriesKey: "blockTransforms",
211621
+ entry: defineInventoryEntryParser({
211622
+ entryName: "BLOCK_TRANSFORMS",
211623
+ fields: [
211624
+ { key: "block", required: true },
211625
+ { key: "file", required: true },
211626
+ { key: "from", required: true },
211627
+ { key: "slug", required: true },
211628
+ { key: "to", required: true }
211629
+ ]
211630
+ }),
211631
+ hasSectionKey: "hasBlockTransformsSection"
211632
+ },
211720
211633
  value: {
211721
211634
  name: "BLOCK_TRANSFORMS",
211722
211635
  section: BLOCK_TRANSFORMS_CONST_SECTION
@@ -211727,6 +211640,17 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211727
211640
  name: "WorkspacePatternConfig",
211728
211641
  section: PATTERNS_INTERFACE_SECTION
211729
211642
  },
211643
+ parse: {
211644
+ entriesKey: "patterns",
211645
+ entry: defineInventoryEntryParser({
211646
+ entryName: "PATTERNS",
211647
+ fields: [
211648
+ { key: "file", required: true },
211649
+ { key: "slug", required: true }
211650
+ ]
211651
+ }),
211652
+ hasSectionKey: "hasPatternsSection"
211653
+ },
211730
211654
  value: {
211731
211655
  name: "PATTERNS",
211732
211656
  section: PATTERNS_CONST_SECTION
@@ -211737,6 +211661,20 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211737
211661
  name: "WorkspaceBindingSourceConfig",
211738
211662
  section: BINDING_SOURCES_INTERFACE_SECTION
211739
211663
  },
211664
+ parse: {
211665
+ entriesKey: "bindingSources",
211666
+ entry: defineInventoryEntryParser({
211667
+ entryName: "BINDING_SOURCES",
211668
+ fields: [
211669
+ { key: "attribute" },
211670
+ { key: "block" },
211671
+ { key: "editorFile", required: true },
211672
+ { key: "serverFile", required: true },
211673
+ { key: "slug", required: true }
211674
+ ]
211675
+ }),
211676
+ hasSectionKey: "hasBindingSourcesSection"
211677
+ },
211740
211678
  value: {
211741
211679
  name: "BINDING_SOURCES",
211742
211680
  section: BINDING_SOURCES_CONST_SECTION
@@ -211747,6 +211685,36 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211747
211685
  name: "WorkspaceRestResourceConfig",
211748
211686
  section: REST_RESOURCES_INTERFACE_SECTION
211749
211687
  },
211688
+ parse: {
211689
+ entriesKey: "restResources",
211690
+ entry: defineInventoryEntryParser({
211691
+ entryName: "REST_RESOURCES",
211692
+ fields: [
211693
+ { key: "apiFile", required: true },
211694
+ { key: "clientFile", required: true },
211695
+ { key: "dataFile", required: true },
211696
+ {
211697
+ key: "methods",
211698
+ kind: "stringArray",
211699
+ required: true,
211700
+ validate: (value2, context) => {
211701
+ const methods = Array.isArray(value2) ? value2 : [];
211702
+ const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
211703
+ if (invalidMethods.length > 0) {
211704
+ throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} includes unsupported values: ${invalidMethods.join(", ")}.`);
211705
+ }
211706
+ }
211707
+ },
211708
+ { key: "namespace", required: true },
211709
+ { key: "openApiFile", required: true },
211710
+ { key: "phpFile", required: true },
211711
+ { key: "slug", required: true },
211712
+ { key: "typesFile", required: true },
211713
+ { key: "validatorsFile", required: true }
211714
+ ]
211715
+ }),
211716
+ hasSectionKey: "hasRestResourcesSection"
211717
+ },
211750
211718
  value: {
211751
211719
  name: "REST_RESOURCES",
211752
211720
  section: REST_RESOURCES_CONST_SECTION
@@ -211757,6 +211725,25 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211757
211725
  name: "WorkspaceAbilityConfig",
211758
211726
  section: ABILITIES_INTERFACE_SECTION
211759
211727
  },
211728
+ parse: {
211729
+ entriesKey: "abilities",
211730
+ entry: defineInventoryEntryParser({
211731
+ entryName: "ABILITIES",
211732
+ fields: [
211733
+ { key: "clientFile", required: true },
211734
+ { key: "configFile", required: true },
211735
+ { key: "dataFile", required: true },
211736
+ { key: "inputSchemaFile", required: true },
211737
+ { key: "inputTypeName", required: true },
211738
+ { key: "outputSchemaFile", required: true },
211739
+ { key: "outputTypeName", required: true },
211740
+ { key: "phpFile", required: true },
211741
+ { key: "slug", required: true },
211742
+ { key: "typesFile", required: true }
211743
+ ]
211744
+ }),
211745
+ hasSectionKey: "hasAbilitiesSection"
211746
+ },
211760
211747
  value: {
211761
211748
  name: "ABILITIES",
211762
211749
  section: ABILITIES_CONST_SECTION
@@ -211767,6 +211754,25 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211767
211754
  name: "WorkspaceAiFeatureConfig",
211768
211755
  section: AI_FEATURES_INTERFACE_SECTION
211769
211756
  },
211757
+ parse: {
211758
+ entriesKey: "aiFeatures",
211759
+ entry: defineInventoryEntryParser({
211760
+ entryName: "AI_FEATURES",
211761
+ fields: [
211762
+ { key: "aiSchemaFile", required: true },
211763
+ { key: "apiFile", required: true },
211764
+ { key: "clientFile", required: true },
211765
+ { key: "dataFile", required: true },
211766
+ { key: "namespace", required: true },
211767
+ { key: "openApiFile", required: true },
211768
+ { key: "phpFile", required: true },
211769
+ { key: "slug", required: true },
211770
+ { key: "typesFile", required: true },
211771
+ { key: "validatorsFile", required: true }
211772
+ ]
211773
+ }),
211774
+ hasSectionKey: "hasAiFeaturesSection"
211775
+ },
211770
211776
  value: {
211771
211777
  name: "AI_FEATURES",
211772
211778
  section: AI_FEATURES_CONST_SECTION
@@ -211777,6 +211783,19 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211777
211783
  name: "WorkspaceAdminViewConfig",
211778
211784
  section: ADMIN_VIEWS_INTERFACE_SECTION
211779
211785
  },
211786
+ parse: {
211787
+ entriesKey: "adminViews",
211788
+ entry: defineInventoryEntryParser({
211789
+ entryName: "ADMIN_VIEWS",
211790
+ fields: [
211791
+ { key: "file", required: true },
211792
+ { key: "phpFile", required: true },
211793
+ { key: "slug", required: true },
211794
+ { key: "source" }
211795
+ ]
211796
+ }),
211797
+ hasSectionKey: "hasAdminViewsSection"
211798
+ },
211780
211799
  value: {
211781
211800
  name: "ADMIN_VIEWS",
211782
211801
  section: ADMIN_VIEWS_CONST_SECTION
@@ -211787,6 +211806,18 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
211787
211806
  name: "WorkspaceEditorPluginConfig",
211788
211807
  section: EDITOR_PLUGINS_INTERFACE_SECTION
211789
211808
  },
211809
+ parse: {
211810
+ entriesKey: "editorPlugins",
211811
+ entry: defineInventoryEntryParser({
211812
+ entryName: "EDITOR_PLUGINS",
211813
+ fields: [
211814
+ { key: "file", required: true },
211815
+ { key: "slug", required: true },
211816
+ { key: "slot", required: true }
211817
+ ]
211818
+ }),
211819
+ hasSectionKey: "hasEditorPluginsSection"
211820
+ },
211790
211821
  value: {
211791
211822
  name: "EDITOR_PLUGINS",
211792
211823
  section: EDITOR_PLUGINS_CONST_SECTION
@@ -233186,45 +233217,17 @@ function ${bindingEditorEnqueueFunctionName}() {
233186
233217
  );
233187
233218
  }
233188
233219
  `;
233189
- const insertionAnchors = [
233190
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
233191
- /\?>\s*$/u
233192
- ];
233193
- const insertPhpSnippet = (snippet) => {
233194
- for (const anchor of insertionAnchors) {
233195
- const candidate = nextSource.replace(anchor, (match3) => `${snippet}
233196
- ${match3}`);
233197
- if (candidate !== nextSource) {
233198
- nextSource = candidate;
233199
- return;
233200
- }
233201
- }
233202
- nextSource = `${nextSource.trimEnd()}
233203
- ${snippet}
233204
- `;
233205
- };
233206
- const appendPhpSnippet = (snippet) => {
233207
- const closingTagPattern = /\?>\s*$/u;
233208
- if (closingTagPattern.test(nextSource)) {
233209
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
233210
- ?>`);
233211
- return;
233212
- }
233213
- nextSource = `${nextSource.trimEnd()}
233214
- ${snippet}
233215
- `;
233216
- };
233217
233220
  if (!hasPhpFunctionDefinition(nextSource, bindingRegistrationFunctionName)) {
233218
- insertPhpSnippet(bindingRegistrationFunction);
233221
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, bindingRegistrationFunction);
233219
233222
  }
233220
233223
  if (!hasPhpFunctionDefinition(nextSource, bindingEditorEnqueueFunctionName)) {
233221
- insertPhpSnippet(bindingEditorEnqueueFunction);
233224
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, bindingEditorEnqueueFunction);
233222
233225
  }
233223
233226
  if (!nextSource.includes(bindingRegistrationHook)) {
233224
- appendPhpSnippet(bindingRegistrationHook);
233227
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, bindingRegistrationHook);
233225
233228
  }
233226
233229
  if (!nextSource.includes(bindingEditorEnqueueHook)) {
233227
- appendPhpSnippet(bindingEditorEnqueueHook);
233230
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, bindingEditorEnqueueHook);
233228
233231
  }
233229
233232
  return nextSource;
233230
233233
  });
@@ -233274,36 +233277,8 @@ function ${enqueueFunctionName}() {
233274
233277
  }
233275
233278
  }
233276
233279
  `;
233277
- const insertionAnchors = [
233278
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
233279
- /\?>\s*$/u
233280
- ];
233281
- const insertPhpSnippet = (snippet) => {
233282
- for (const anchor of insertionAnchors) {
233283
- const candidate = nextSource.replace(anchor, (match3) => `${snippet}
233284
- ${match3}`);
233285
- if (candidate !== nextSource) {
233286
- nextSource = candidate;
233287
- return;
233288
- }
233289
- }
233290
- nextSource = `${nextSource.trimEnd()}
233291
- ${snippet}
233292
- `;
233293
- };
233294
- const appendPhpSnippet = (snippet) => {
233295
- const closingTagPattern = /\?>\s*$/u;
233296
- if (closingTagPattern.test(nextSource)) {
233297
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
233298
- ?>`);
233299
- return;
233300
- }
233301
- nextSource = `${nextSource.trimEnd()}
233302
- ${snippet}
233303
- `;
233304
- };
233305
233280
  if (!hasPhpFunctionDefinition(nextSource, enqueueFunctionName)) {
233306
- insertPhpSnippet(enqueueFunction);
233281
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, enqueueFunction);
233307
233282
  } else {
233308
233283
  const requiredReferences = [
233309
233284
  EDITOR_PLUGIN_EDITOR_SCRIPT,
@@ -233324,7 +233299,7 @@ ${snippet}
233324
233299
  }
233325
233300
  }
233326
233301
  if (!nextSource.includes(enqueueHook)) {
233327
- appendPhpSnippet(enqueueHook);
233302
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, enqueueHook);
233328
233303
  }
233329
233304
  return nextSource;
233330
233305
  });
@@ -233574,6 +233549,7 @@ var init_cli_add_workspace_assets = __esm(() => {
233574
233549
  init_workspace_project();
233575
233550
  init_workspace_inventory();
233576
233551
  init_cli_add_shared();
233552
+ init_cli_add_workspace_mutation();
233577
233553
  init_cli_validation();
233578
233554
  import_typescript2 = __toESM(require_typescript(), 1);
233579
233555
  BINDING_ATTRIBUTE_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
@@ -233595,36 +233571,8 @@ function ${registerFunctionName}() {
233595
233571
  }
233596
233572
  }
233597
233573
  `;
233598
- const insertionAnchors = [
233599
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
233600
- /\?>\s*$/u
233601
- ];
233602
- const insertPhpSnippet = (snippet) => {
233603
- for (const anchor of insertionAnchors) {
233604
- const candidate = nextSource.replace(anchor, (match3) => `${snippet}
233605
- ${match3}`);
233606
- if (candidate !== nextSource) {
233607
- nextSource = candidate;
233608
- return;
233609
- }
233610
- }
233611
- nextSource = `${nextSource.trimEnd()}
233612
- ${snippet}
233613
- `;
233614
- };
233615
- const appendPhpSnippet = (snippet) => {
233616
- const closingTagPattern = /\?>\s*$/u;
233617
- if (closingTagPattern.test(nextSource)) {
233618
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
233619
- ?>`);
233620
- return;
233621
- }
233622
- nextSource = `${nextSource.trimEnd()}
233623
- ${snippet}
233624
- `;
233625
- };
233626
233574
  if (!hasPhpFunctionDefinition(nextSource, registerFunctionName)) {
233627
- insertPhpSnippet(registerFunction);
233575
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
233628
233576
  } else if (!nextSource.includes(REST_RESOURCE_SERVER_GLOB)) {
233629
233577
  throw new Error([
233630
233578
  `Unable to patch ${path56.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
@@ -233633,7 +233581,7 @@ ${snippet}
233633
233581
  ].join(" "));
233634
233582
  }
233635
233583
  if (!nextSource.includes(registerHook)) {
233636
- appendPhpSnippet(registerHook);
233584
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, registerHook);
233637
233585
  }
233638
233586
  return nextSource;
233639
233587
  });
@@ -233775,6 +233723,7 @@ async function ensureRestResourceSyncScriptAnchors(workspace) {
233775
233723
  var REST_RESOURCE_SERVER_GLOB = "/inc/rest/*.php";
233776
233724
  var init_cli_add_workspace_rest_anchors = __esm(() => {
233777
233725
  init_cli_add_shared();
233726
+ init_cli_add_workspace_mutation();
233778
233727
  });
233779
233728
 
233780
233729
  // ../wp-typia-project-tools/src/runtime/rest-resource-artifacts.ts
@@ -236305,36 +236254,8 @@ function ${registerFunctionName}() {
236305
236254
  }
236306
236255
  }
236307
236256
  `;
236308
- const insertionAnchors = [
236309
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
236310
- /\?>\s*$/u
236311
- ];
236312
- const insertPhpSnippet = (snippet) => {
236313
- for (const anchor of insertionAnchors) {
236314
- const candidate = nextSource.replace(anchor, (match3) => `${snippet}
236315
- ${match3}`);
236316
- if (candidate !== nextSource) {
236317
- nextSource = candidate;
236318
- return;
236319
- }
236320
- }
236321
- nextSource = `${nextSource.trimEnd()}
236322
- ${snippet}
236323
- `;
236324
- };
236325
- const appendPhpSnippet = (snippet) => {
236326
- const closingTagPattern = /\?>\s*$/u;
236327
- if (closingTagPattern.test(nextSource)) {
236328
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
236329
- ?>`);
236330
- return;
236331
- }
236332
- nextSource = `${nextSource.trimEnd()}
236333
- ${snippet}
236334
- `;
236335
- };
236336
236257
  if (!hasPhpFunctionDefinition(nextSource, registerFunctionName)) {
236337
- insertPhpSnippet(registerFunction);
236258
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
236338
236259
  } else if (!nextSource.includes(AI_FEATURE_SERVER_GLOB)) {
236339
236260
  throw new Error([
236340
236261
  `Unable to patch ${path61.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
@@ -236343,7 +236264,7 @@ ${snippet}
236343
236264
  ].join(" "));
236344
236265
  }
236345
236266
  if (!nextSource.includes(registerHook)) {
236346
- appendPhpSnippet(registerHook);
236267
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, registerHook);
236347
236268
  }
236348
236269
  return nextSource;
236349
236270
  });
@@ -236564,6 +236485,7 @@ var AI_FEATURE_SERVER_GLOB = "/inc/ai-features/*.php";
236564
236485
  var init_cli_add_workspace_ai_anchors = __esm(() => {
236565
236486
  init_package_versions();
236566
236487
  init_cli_add_shared();
236488
+ init_cli_add_workspace_mutation();
236567
236489
  });
236568
236490
 
236569
236491
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai-templates.ts
@@ -293288,7 +293210,7 @@ var SYNC_OPTION_METADATA = {
293288
293210
  };
293289
293211
  var DOCTOR_OPTION_METADATA = {
293290
293212
  format: {
293291
- description: "Use `json` for machine-readable doctor check output or `toon` for human-readable output.",
293213
+ description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
293292
293214
  type: "string"
293293
293215
  }
293294
293216
  };
@@ -293305,7 +293227,7 @@ var GLOBAL_OPTION_METADATA = {
293305
293227
  type: "string"
293306
293228
  },
293307
293229
  format: {
293308
- description: "Output format for supported commands (`json` or `toon`).",
293230
+ description: "Output format for supported commands (`json` or `text`).",
293309
293231
  type: "string"
293310
293232
  },
293311
293233
  id: {
@@ -293400,9 +293322,15 @@ init_cli_diagnostics();
293400
293322
 
293401
293323
  // src/cli-output-format.ts
293402
293324
  init_cli_diagnostics();
293403
- var SUPPORTED_CLI_OUTPUT_FORMATS = ["json", "toon"];
293325
+ var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
293326
+ var LEGACY_CLI_OUTPUT_FORMAT_ALIASES = ["toon"];
293327
+ var SUPPORTED_CLI_OUTPUT_FORMATS = [
293328
+ ...PUBLIC_CLI_OUTPUT_FORMATS,
293329
+ ...LEGACY_CLI_OUTPUT_FORMAT_ALIASES
293330
+ ];
293331
+ var SUPPORTED_CLI_OUTPUT_FORMAT_VALUES = SUPPORTED_CLI_OUTPUT_FORMATS;
293404
293332
  function isSupportedCliOutputFormat(value2) {
293405
- return SUPPORTED_CLI_OUTPUT_FORMATS.includes(value2);
293333
+ return typeof value2 === "string" && SUPPORTED_CLI_OUTPUT_FORMAT_VALUES.includes(value2);
293406
293334
  }
293407
293335
 
293408
293336
  // src/cli-diagnostic-output.ts
@@ -293411,7 +293339,10 @@ function writeStructuredCliJsonToStderr(payload) {
293411
293339
  `);
293412
293340
  }
293413
293341
  function prefersStructuredCliOutput(args) {
293414
- return args.formatExplicit && args.format === "json" && isSupportedCliOutputFormat(args.format) || Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
293342
+ if (args.formatExplicit) {
293343
+ return args.format === "json" && isSupportedCliOutputFormat(args.format);
293344
+ }
293345
+ return Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
293415
293346
  }
293416
293347
  function emitCliDiagnosticFailure(args, options) {
293417
293348
  const diagnostic = createCliCommandError(options);
@@ -294277,7 +294208,7 @@ async function simulateWorkspaceAddDryRun({
294277
294208
  // package.json
294278
294209
  var package_default2 = {
294279
294210
  name: "wp-typia",
294280
- version: "0.22.4",
294211
+ version: "0.22.5",
294281
294212
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
294282
294213
  packageManager: "bun@1.3.11",
294283
294214
  type: "module",
@@ -294347,7 +294278,7 @@ var package_default2 = {
294347
294278
  "@bunli/tui": "0.6.0",
294348
294279
  "@bunli/utils": "0.6.0",
294349
294280
  "@wp-typia/api-client": "^0.4.5",
294350
- "@wp-typia/project-tools": "0.22.4",
294281
+ "@wp-typia/project-tools": "0.22.5",
294351
294282
  "better-result": "^2.7.0",
294352
294283
  react: "^19.2.5",
294353
294284
  "react-dom": "^19.2.5",
@@ -296800,4 +296731,4 @@ export {
296800
296731
  cli
296801
296732
  };
296802
296733
 
296803
- //# debugId=E3AF932A91F52B7564756E2164756E21
296734
+ //# debugId=F49259A97ECCEE8864756E2164756E21