wp-typia 0.23.1 → 0.24.0

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.
@@ -4,6 +4,7 @@ var ADD_KIND_IDS = [
4
4
  "admin-view",
5
5
  "block",
6
6
  "integration-env",
7
+ "core-variation",
7
8
  "variation",
8
9
  "style",
9
10
  "transform",
@@ -20,4 +21,4 @@ var ADD_KIND_IDS = [
20
21
 
21
22
  export { ADD_KIND_IDS };
22
23
 
23
- //# debugId=C480D575E839E69A64756E2164756E21
24
+ //# debugId=39A9377B00AF01BA64756E2164756E21
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-hv2yedw2.js";
5
5
  import {
6
6
  ADD_KIND_IDS
7
- } from "./cli-43mx1vfb.js";
7
+ } from "./cli-bajwv85z.js";
8
8
  import {
9
9
  CLI_DIAGNOSTIC_CODES,
10
10
  createCliCommandError,
@@ -14,7 +14,7 @@ import {
14
14
  // package.json
15
15
  var package_default = {
16
16
  name: "wp-typia",
17
- version: "0.23.1",
17
+ version: "0.24.0",
18
18
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
19
19
  packageManager: "bun@1.3.11",
20
20
  type: "module",
@@ -84,7 +84,7 @@ var package_default = {
84
84
  "@bunli/tui": "0.6.0",
85
85
  "@bunli/utils": "0.6.0",
86
86
  "@wp-typia/api-client": "^0.4.5",
87
- "@wp-typia/project-tools": "0.23.1",
87
+ "@wp-typia/project-tools": "0.24.0",
88
88
  "better-result": "^2.7.0",
89
89
  react: "^19.2.5",
90
90
  "react-dom": "^19.2.5",
@@ -170,7 +170,7 @@ var ADD_OPTION_METADATA = {
170
170
  type: "string"
171
171
  },
172
172
  block: {
173
- description: "Target block slug for variation, style, and end-to-end binding-source workflows.",
173
+ description: "Target block slug/name for variation, core-variation, style, and end-to-end binding-source workflows.",
174
174
  type: "string"
175
175
  },
176
176
  "controller-class": {
@@ -202,6 +202,10 @@ var ADD_OPTION_METADATA = {
202
202
  description: "Source full block name (namespace/block) for transform workflows.",
203
203
  type: "string"
204
204
  },
205
+ "from-post-meta": {
206
+ description: "Alias for --post-meta when backing a binding-source scaffold from a typed post-meta contract.",
207
+ type: "string"
208
+ },
205
209
  "inner-blocks-preset": {
206
210
  description: "Compound-only InnerBlocks preset (freeform, ordered, horizontal, locked-structure).",
207
211
  type: "string"
@@ -220,6 +224,10 @@ var ADD_OPTION_METADATA = {
220
224
  description: "WordPress meta key for post-meta workflows; defaults to _<phpPrefix>_<name>.",
221
225
  type: "string"
222
226
  },
227
+ "meta-path": {
228
+ description: "Top-level post-meta field used as the default binding-source field when --post-meta or --from-post-meta is provided.",
229
+ type: "string"
230
+ },
223
231
  method: {
224
232
  description: "HTTP method for manual REST contract workflows (GET, POST, PUT, PATCH, or DELETE).",
225
233
  type: "string"
@@ -240,6 +248,10 @@ var ADD_OPTION_METADATA = {
240
248
  description: "WordPress post type key for post-meta workflows.",
241
249
  type: "string"
242
250
  },
251
+ "post-meta": {
252
+ description: "Typed post-meta contract slug used to back a binding-source scaffold.",
253
+ type: "string"
254
+ },
243
255
  "persistence-policy": {
244
256
  description: "Persistence write policy for persistence-capable templates.",
245
257
  type: "string"
@@ -269,6 +281,14 @@ var ADD_OPTION_METADATA = {
269
281
  description: "REST route pattern relative to the namespace; generated resources use it for item routes and manual/provider contracts may use it as an alias for --path.",
270
282
  type: "string"
271
283
  },
284
+ scope: {
285
+ description: "Pattern catalog scope for pattern workflows (full or section).",
286
+ type: "string"
287
+ },
288
+ "section-role": {
289
+ description: "Typed section role for section-scoped pattern catalog entries.",
290
+ type: "string"
291
+ },
272
292
  "secret-field": {
273
293
  description: "Write-only request body field for manual settings REST contracts; requires --manual and a request body, typically generated by POST, PUT, or PATCH.",
274
294
  type: "string"
@@ -305,6 +325,14 @@ var ADD_OPTION_METADATA = {
305
325
  description: "Optional built-in block family for the new block; interactive flows let you choose it when omitted and non-interactive runs default to basic.",
306
326
  type: "string"
307
327
  },
328
+ "thumbnail-url": {
329
+ description: "Optional thumbnail URL or relative path for typed pattern catalog entries.",
330
+ type: "string"
331
+ },
332
+ tags: {
333
+ description: "Comma-separated tags for typed pattern catalog entries.",
334
+ type: "string"
335
+ },
308
336
  type: {
309
337
  description: "Exported TypeScript type or interface name for standalone contract workflows.",
310
338
  type: "string"
@@ -975,10 +1003,19 @@ var WP_TYPIA_CONFIG_SOURCES = [
975
1003
  ".wp-typiarc",
976
1004
  ".wp-typiarc.json"
977
1005
  ];
1006
+ var wordpressVersionSchema = exports_external.string().regex(/^\d+\.\d+(?:\.\d+)?$/u, 'expected dotted numeric WordPress version such as "6.7" or "6.7.1"');
978
1007
  var wpTypiaSchemaSourceSchema = exports_external.object({
979
1008
  namespace: exports_external.string(),
980
1009
  path: exports_external.string()
981
1010
  }).strict();
1011
+ var wordpressCompatibilityConfigSchema = exports_external.object({
1012
+ minVersion: wordpressVersionSchema.optional(),
1013
+ testedVersions: exports_external.array(wordpressVersionSchema).optional()
1014
+ }).strict();
1015
+ var blockApiCompatibilityConfigSchema = exports_external.object({
1016
+ allowUnknownFutureKeys: exports_external.boolean().optional(),
1017
+ strict: exports_external.boolean().optional()
1018
+ }).strict();
982
1019
  var createConfigSchema = exports_external.object({
983
1020
  "alternate-render-targets": exports_external.string().optional(),
984
1021
  "inner-blocks-preset": exports_external.string().optional(),
@@ -1018,8 +1055,10 @@ var mcpConfigSchema = exports_external.object({
1018
1055
  }).strict();
1019
1056
  var wpTypiaUserConfigSchema = exports_external.object({
1020
1057
  add: addConfigSchema.optional(),
1058
+ compatibility: blockApiCompatibilityConfigSchema.optional(),
1021
1059
  create: createConfigSchema.optional(),
1022
- mcp: mcpConfigSchema.optional()
1060
+ mcp: mcpConfigSchema.optional(),
1061
+ wordpress: wordpressCompatibilityConfigSchema.optional()
1023
1062
  }).strict();
1024
1063
  function formatIssuePath(issuePath) {
1025
1064
  if (issuePath.length === 0) {
@@ -1130,4 +1169,4 @@ function createPlugin(input) {
1130
1169
  }
1131
1170
  export { createPlugin, package_default, collectPositionalIndexes, findFirstPositionalIndex, ADD_OPTION_METADATA, CREATE_OPTION_METADATA, DOCTOR_OPTION_METADATA, GLOBAL_OPTION_METADATA, INIT_OPTION_METADATA, MCP_OPTION_METADATA, MIGRATE_OPTION_METADATA, SYNC_OPTION_METADATA, TEMPLATES_OPTION_METADATA, COMMAND_OPTION_METADATA_BY_GROUP, ALL_COMMAND_OPTION_METADATA, buildCommandOptions, collectOptionNamesByType, buildCommandOptionParser, COMMAND_ROUTING_METADATA, createMissingOptionValueError, extractKnownOptionValuesFromArgv, resolveCommandOptionValues, normalizeCliOutputFormatArgv, validateCliOutputFormatArgv, prefersStructuredCliOutput, emitCliDiagnosticFailure, writeStructuredCliDiagnosticError, formatAddKindList, formatAddKindUsagePlaceholder, WP_TYPIA_CANONICAL_CREATE_USAGE, WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND, WP_TYPIA_CONFIG_SOURCES, mergeWpTypiaUserConfig, loadWpTypiaUserConfigFromSource, loadWpTypiaUserConfig, getCreateDefaults, getAddBlockDefaults, getMcpSchemaSources };
1132
1171
 
1133
- //# debugId=B4E0791804C009A564756E2164756E21
1172
+ //# debugId=F63C0DE9696AEB4464756E2164756E21
@@ -1,15 +1,17 @@
1
1
  // @bun
2
2
  import {
3
+ assertPostMetaBindingPath,
3
4
  hasAdminViewManualSettingsRouteParameters,
4
5
  hasExecutablePattern,
5
6
  hasUncommentedPattern,
6
7
  isAdminViewManualSettingsRestResource,
8
+ loadPostMetaBindingFieldsSync,
7
9
  maskTypeScriptCommentsAndLiterals
8
- } from "./cli-j8et6jvr.js";
10
+ } from "./cli-z48frc8t.js";
9
11
  import {
10
12
  getBuiltInTemplateLayerDirs,
11
13
  isOmittableBuiltInTemplateLayerDir
12
- } from "./cli-nvs5atj1.js";
14
+ } from "./cli-sw06c521.js";
13
15
  import {
14
16
  isBuiltInTemplateId,
15
17
  listTemplates
@@ -24,14 +26,17 @@ import {
24
26
  REST_RESOURCE_NAMESPACE_PATTERN,
25
27
  assertValidPostMetaPostType,
26
28
  escapeRegex,
29
+ formatPatternCatalogDiagnostics,
27
30
  isGeneratedRestResourceRoutePatternCompatible,
28
31
  pathExists,
29
32
  readWorkspaceInventoryAsync,
30
- resolveEditorPluginSlotAlias
31
- } from "./cli-k5q5v8g6.js";
33
+ resolveEditorPluginSlotAlias,
34
+ resolvePatternCatalogContentFile,
35
+ validatePatternCatalog
36
+ } from "./cli-v0nnagb3.js";
32
37
  import"./cli-cvxvcw7c.js";
33
38
  import"./cli-t73q5aqz.js";
34
- import"./cli-43mx1vfb.js";
39
+ import"./cli-bajwv85z.js";
35
40
  import {
36
41
  CLI_DIAGNOSTIC_CODES,
37
42
  createCliCommandError,
@@ -282,6 +287,55 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
282
287
  }
283
288
  return createDoctorCheck(`Binding target ${bindingSource.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `${bindingSource.block}.${bindingSource.attribute} is declared and supported` : issues.join("; "));
284
289
  }
290
+ function checkWorkspaceBindingPostMeta(projectDir, inventory, bindingSource) {
291
+ if (!bindingSource.postMeta) {
292
+ return;
293
+ }
294
+ const postMeta = inventory.postMeta.find((entry) => entry.slug === bindingSource.postMeta);
295
+ if (!postMeta) {
296
+ return createDoctorCheck(`Binding post meta ${bindingSource.slug}`, "fail", `Binding source references unknown post meta contract "${bindingSource.postMeta}".`);
297
+ }
298
+ const issues = [];
299
+ try {
300
+ const fields = loadPostMetaBindingFieldsSync(projectDir, postMeta);
301
+ if (bindingSource.metaPath) {
302
+ assertPostMetaBindingPath(fields, postMeta.slug, bindingSource.metaPath);
303
+ }
304
+ } catch (error) {
305
+ issues.push(error instanceof Error ? error.message : String(error));
306
+ }
307
+ const serverPath = path3.join(projectDir, bindingSource.serverFile);
308
+ if (fs3.existsSync(serverPath)) {
309
+ const serverSource = fs3.readFileSync(serverPath, "utf8");
310
+ if (!serverSource.includes("get_post_meta")) {
311
+ issues.push(`${bindingSource.serverFile} must read post meta values`);
312
+ }
313
+ if (!serverSource.includes(postMeta.metaKey)) {
314
+ issues.push(`${bindingSource.serverFile} must reference ${postMeta.metaKey}`);
315
+ }
316
+ if (!serverSource.includes(postMeta.schemaFile)) {
317
+ issues.push(`${bindingSource.serverFile} must reference ${postMeta.schemaFile}`);
318
+ }
319
+ } else {
320
+ issues.push(`Missing ${bindingSource.serverFile}`);
321
+ }
322
+ const editorPath = path3.join(projectDir, bindingSource.editorFile);
323
+ if (fs3.existsSync(editorPath)) {
324
+ const editorSource = fs3.readFileSync(editorPath, "utf8");
325
+ if (!editorSource.includes("POST_META_BINDING_FIELDS")) {
326
+ issues.push(`${bindingSource.editorFile} must define post meta binding fields`);
327
+ }
328
+ if (!editorSource.includes(postMeta.schemaFile)) {
329
+ issues.push(`${bindingSource.editorFile} must reference ${postMeta.schemaFile}`);
330
+ }
331
+ if (bindingSource.metaPath && !editorSource.includes(bindingSource.metaPath)) {
332
+ issues.push(`${bindingSource.editorFile} must reference default meta path "${bindingSource.metaPath}"`);
333
+ }
334
+ } else {
335
+ issues.push(`Missing ${bindingSource.editorFile}`);
336
+ }
337
+ return createDoctorCheck(`Binding post meta ${bindingSource.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `${bindingSource.slug} reads ${postMeta.slug} via ${postMeta.schemaFile}` : issues.join("; "));
338
+ }
285
339
  function getWorkspaceBindingDoctorChecks(workspace, inventory) {
286
340
  const checks = [];
287
341
  if (inventory.bindingSources.length > 0) {
@@ -298,6 +352,10 @@ function getWorkspaceBindingDoctorChecks(workspace, inventory) {
298
352
  if (bindingTargetCheck) {
299
353
  checks.push(bindingTargetCheck);
300
354
  }
355
+ const bindingPostMetaCheck = checkWorkspaceBindingPostMeta(workspace.projectDir, inventory, bindingSource);
356
+ if (bindingPostMetaCheck) {
357
+ checks.push(bindingPostMetaCheck);
358
+ }
301
359
  }
302
360
  return checks;
303
361
  }
@@ -311,7 +369,14 @@ var WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspace
311
369
  var WORKSPACE_BLOCK_STYLES_CALL_PATTERN = /registerWorkspaceBlockStyles\s*\(\s*\)\s*;?/u;
312
370
  var WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN = /^\s*import\s*\{\s*applyWorkspaceBlockTransforms\s*\}\s*from\s*["']\.\/transforms["']\s*;?\s*$/mu;
313
371
  var WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN = /applyWorkspaceBlockTransforms\s*\(\s*registration\s*\.\s*settings\s*\)\s*;?/u;
314
- function checkWorkspacePatternBootstrap(projectDir, packageName) {
372
+ function isNestedPatternContentFile(patternFile) {
373
+ if (!patternFile) {
374
+ return false;
375
+ }
376
+ const normalizedPath = patternFile.replace(/\\/gu, "/");
377
+ return normalizedPath.startsWith("src/patterns/") && normalizedPath.slice("src/patterns/".length).includes("/");
378
+ }
379
+ function checkWorkspacePatternBootstrap(projectDir, packageName, requiresNestedPatternGlob) {
315
380
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
316
381
  if (!fs4.existsSync(bootstrapPath)) {
317
382
  return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${path4.basename(bootstrapPath)}`);
@@ -319,7 +384,9 @@ function checkWorkspacePatternBootstrap(projectDir, packageName) {
319
384
  const source = fs4.readFileSync(bootstrapPath, "utf8");
320
385
  const hasCategoryAnchor = source.includes("register_block_pattern_category");
321
386
  const hasPatternGlob = source.includes("/src/patterns/*.php");
322
- return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob ? "Pattern category and loader hooks are present" : "Missing pattern category registration or src/patterns loader hook");
387
+ const hasNestedPatternGlob = source.includes("/src/patterns/*/*.php");
388
+ const hasRequiredPatternGlobs = hasPatternGlob && (!requiresNestedPatternGlob || hasNestedPatternGlob);
389
+ return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasRequiredPatternGlobs ? "pass" : "fail", hasCategoryAnchor && hasRequiredPatternGlobs ? "Pattern category and loader hooks are present" : requiresNestedPatternGlob ? "Missing pattern category registration or nested src/patterns loader hook" : "Missing pattern category registration or src/patterns loader hook");
323
390
  }
324
391
  function checkVariationEntrypoint(projectDir, blockSlug) {
325
392
  const entryPath = path4.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
@@ -409,10 +476,19 @@ function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registeredBloc
409
476
  }
410
477
  const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs4.existsSync(path4.join(workspace.projectDir, "src", "patterns"));
411
478
  if (shouldCheckPatternBootstrap) {
412
- checks.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
479
+ const requiresNestedPatternGlob = inventory.patterns.some((pattern) => isNestedPatternContentFile(resolvePatternCatalogContentFile(pattern)));
480
+ checks.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName, requiresNestedPatternGlob));
481
+ }
482
+ if (inventory.patterns.length > 0) {
483
+ const catalogValidation = validatePatternCatalog(inventory.patterns, {
484
+ projectDir: workspace.projectDir
485
+ });
486
+ checks.push(createDoctorCheck("Pattern catalog", catalogValidation.errors.length > 0 ? "fail" : catalogValidation.warnings.length > 0 ? "warn" : "pass", catalogValidation.diagnostics.length > 0 ? formatPatternCatalogDiagnostics(catalogValidation.diagnostics) : "Pattern catalog metadata is valid"));
413
487
  }
414
488
  for (const pattern of inventory.patterns) {
415
- checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [pattern.file]));
489
+ checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [
490
+ resolvePatternCatalogContentFile(pattern)
491
+ ]));
416
492
  }
417
493
  return checks;
418
494
  }
@@ -1268,6 +1344,16 @@ async function getWorkspaceDoctorChecks(cwd) {
1268
1344
 
1269
1345
  // ../wp-typia-project-tools/src/runtime/cli-doctor.ts
1270
1346
  var DEFAULT_DOCTOR_EXIT_POLICY = "strict";
1347
+ var defaultDoctorLinePrinter = (line) => {
1348
+ process.stdout.write(`${line}
1349
+ `);
1350
+ };
1351
+ function renderDefaultDoctorCheckLine(check) {
1352
+ defaultDoctorLinePrinter(formatDoctorCheckLine(check));
1353
+ }
1354
+ function renderDefaultDoctorSummaryLine(summaryLine) {
1355
+ defaultDoctorLinePrinter(summaryLine);
1356
+ }
1271
1357
  function annotateDoctorChecks(checks, scope) {
1272
1358
  return checks.map((check) => ({
1273
1359
  ...check,
@@ -1328,10 +1414,10 @@ function createDoctorRunSummary(checks, options = {}) {
1328
1414
  }
1329
1415
  async function runDoctor(cwd, options = {}) {
1330
1416
  const exitPolicy = resolveDoctorExitPolicy(options);
1331
- const renderLine = options.renderLine ?? ((check) => console.log(formatDoctorCheckLine(check)));
1417
+ const renderLine = options.renderLine ?? renderDefaultDoctorCheckLine;
1332
1418
  const renderSummaryLine = options.renderSummaryLine ?? (options.renderLine ? () => {
1333
1419
  return;
1334
- } : (summaryLine) => console.log(summaryLine));
1420
+ } : renderDefaultDoctorSummaryLine);
1335
1421
  const checks = await getDoctorChecks(cwd);
1336
1422
  for (const check of checks) {
1337
1423
  renderLine(check);
@@ -1357,4 +1443,4 @@ export {
1357
1443
  createDoctorRunSummary
1358
1444
  };
1359
1445
 
1360
- //# debugId=3074C8F7DE85281764756E2164756E21
1446
+ //# debugId=7D607F817A3CF55764756E2164756E21
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  getPackageVersions
4
- } from "./cli-fp16mntv.js";
4
+ } from "./cli-y0a8nztv.js";
5
5
  import"./cli-8hxf9qw6.js";
6
6
  import {
7
7
  discoverMigrationInitLayout
@@ -13,9 +13,9 @@ import {
13
13
  snapshotWorkspaceFiles,
14
14
  toPascalCase,
15
15
  updateWorkspaceInventorySource
16
- } from "./cli-k5q5v8g6.js";
16
+ } from "./cli-v0nnagb3.js";
17
17
  import"./cli-cvxvcw7c.js";
18
- import"./cli-43mx1vfb.js";
18
+ import"./cli-bajwv85z.js";
19
19
  import {
20
20
  CLI_DIAGNOSTIC_CODES,
21
21
  createCliDiagnosticCodeError
@@ -21,24 +21,24 @@ import {
21
21
  resolvePackageManagerId,
22
22
  resolveTemplateId,
23
23
  scaffoldProject
24
- } from "./cli-y7w3pybs.js";
24
+ } from "./cli-74y6z3yx.js";
25
25
  import"./cli-9fx0qgb7.js";
26
- import"./cli-nvs5atj1.js";
27
- import"./cli-fp16mntv.js";
26
+ import"./cli-sw06c521.js";
27
+ import"./cli-y0a8nztv.js";
28
28
  import {
29
29
  OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,
30
30
  isBuiltInTemplateId
31
31
  } from "./cli-8hxf9qw6.js";
32
- import"./cli-epsczb1c.js";
32
+ import"./cli-0v407aag.js";
33
33
  import"./cli-e4bwd81c.js";
34
34
  import {
35
35
  pathExists
36
- } from "./cli-k5q5v8g6.js";
36
+ } from "./cli-v0nnagb3.js";
37
37
  import"./cli-cvxvcw7c.js";
38
38
  import {
39
39
  createManagedTempRoot
40
40
  } from "./cli-t73q5aqz.js";
41
- import"./cli-43mx1vfb.js";
41
+ import"./cli-bajwv85z.js";
42
42
  import"./cli-tq730sqt.js";
43
43
  import"./cli-1170yyve.js";
44
44
  import {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./cli-8hxf9qw6.js";
12
12
  import {
13
13
  pathExists
14
- } from "./cli-k5q5v8g6.js";
14
+ } from "./cli-v0nnagb3.js";
15
15
  import {
16
16
  createManagedTempRoot
17
17
  } from "./cli-t73q5aqz.js";