wp-typia 0.24.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170921,9 +170921,162 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
170921
170921
  } });
170922
170922
  });
170923
170923
 
170924
- // ../wp-typia-project-tools/src/runtime/pattern-catalog.ts
170925
- import fs from "fs";
170926
- import path from "path";
170924
+ // ../wp-typia-project-tools/src/runtime/string-case.ts
170925
+ var COMMON_ACRONYM_PREFIXES = [
170926
+ "HTML",
170927
+ "HTTP",
170928
+ "JSON",
170929
+ "REST",
170930
+ "UUID",
170931
+ "AJAX",
170932
+ "API",
170933
+ "CPT",
170934
+ "CSS",
170935
+ "CTA",
170936
+ "DOM",
170937
+ "PHP",
170938
+ "SQL",
170939
+ "SVG",
170940
+ "URL",
170941
+ "XML",
170942
+ "ID",
170943
+ "JS",
170944
+ "UI",
170945
+ "WP"
170946
+ ];
170947
+ var COMMON_ACRONYM_LOWERCASE_SUFFIXES = ["slug"];
170948
+ function capitalizeSegment(segment) {
170949
+ return segment.charAt(0).toUpperCase() + segment.slice(1);
170950
+ }
170951
+ function findCommonAcronymPrefix(segment) {
170952
+ return COMMON_ACRONYM_PREFIXES.find((prefix) => segment.startsWith(prefix));
170953
+ }
170954
+ function isCommonAcronymLowercaseSuffix(suffix) {
170955
+ return COMMON_ACRONYM_LOWERCASE_SUFFIXES.includes(suffix);
170956
+ }
170957
+ function splitKnownAcronymSegment(segment) {
170958
+ const prefixes = [];
170959
+ let remaining = segment;
170960
+ while (remaining.length > 0) {
170961
+ const prefix = findCommonAcronymPrefix(remaining);
170962
+ if (!prefix) {
170963
+ break;
170964
+ }
170965
+ const suffix = remaining.slice(prefix.length);
170966
+ if (/^[A-Z][a-z]/.test(suffix)) {
170967
+ return [...prefixes, prefix, suffix].join("-");
170968
+ }
170969
+ if (/^[a-z]+$/.test(suffix) && isCommonAcronymLowercaseSuffix(suffix)) {
170970
+ return [...prefixes, prefix, suffix].join("-");
170971
+ }
170972
+ if (!findCommonAcronymPrefix(suffix)) {
170973
+ break;
170974
+ }
170975
+ prefixes.push(prefix);
170976
+ remaining = suffix;
170977
+ }
170978
+ return segment;
170979
+ }
170980
+ function splitAcronymBoundary(value) {
170981
+ return value.replace(/[A-Z]{2,}[a-z]+/g, splitKnownAcronymSegment);
170982
+ }
170983
+ function toKebabCase(input) {
170984
+ return splitAcronymBoundary(input.trim()).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").toLowerCase();
170985
+ }
170986
+ function toSnakeCase(input) {
170987
+ return toKebabCase(input).replace(/-/g, "_");
170988
+ }
170989
+ function toPascalCase(input) {
170990
+ return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join("");
170991
+ }
170992
+ function toCamelCase(input) {
170993
+ const pascalCase = toPascalCase(input);
170994
+ return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
170995
+ }
170996
+ function toSegmentPascalCase(input) {
170997
+ return input.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map(capitalizeSegment).join("");
170998
+ }
170999
+ function toTitleCase(input) {
171000
+ return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
171001
+ }
171002
+
171003
+ // ../wp-typia-project-tools/src/runtime/scaffold-identifiers.ts
171004
+ var BLOCK_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
171005
+ var PHP_PREFIX_PATTERN = /^[a-z_][a-z0-9_]*$/;
171006
+ var PHP_PREFIX_MAX_LENGTH = 50;
171007
+ function validateBlockSlug(input) {
171008
+ return BLOCK_SLUG_PATTERN.test(input) || "Use lowercase letters, numbers, and hyphens only";
171009
+ }
171010
+ function validateNamespace(input) {
171011
+ return BLOCK_SLUG_PATTERN.test(toKebabCase(input)) ? true : "Use lowercase letters, numbers, and hyphens only";
171012
+ }
171013
+ function validateTextDomain(input) {
171014
+ return BLOCK_SLUG_PATTERN.test(toKebabCase(input)) ? true : "Use lowercase letters, numbers, and hyphens only";
171015
+ }
171016
+ function validatePhpPrefix(input) {
171017
+ const normalizedPrefix = toSnakeCase(input);
171018
+ if (normalizedPrefix.length > PHP_PREFIX_MAX_LENGTH) {
171019
+ return `Use ${PHP_PREFIX_MAX_LENGTH} characters or fewer to keep generated database identifiers within MySQL limits`;
171020
+ }
171021
+ return PHP_PREFIX_PATTERN.test(normalizedPrefix) ? true : "Use letters, numbers, and underscores only, starting with a letter";
171022
+ }
171023
+ function assertValidIdentifier(label, value, validate) {
171024
+ const result = validate(value);
171025
+ if (result !== true) {
171026
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
171027
+ }
171028
+ return value;
171029
+ }
171030
+ function normalizeBlockSlug(input) {
171031
+ return toKebabCase(input);
171032
+ }
171033
+ function resolveNonEmptyNormalizedBlockSlug(options) {
171034
+ const normalizedSlug = normalizeBlockSlug(options.input);
171035
+ if (normalizedSlug.length > 0) {
171036
+ return normalizedSlug;
171037
+ }
171038
+ if (options.input.trim().length === 0) {
171039
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `${options.label} is required. Use \`${options.usage}\`.`);
171040
+ }
171041
+ 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.`);
171042
+ }
171043
+ function resolveValidatedBlockSlug(value) {
171044
+ return assertValidIdentifier("Block slug", normalizeBlockSlug(value), validateBlockSlug);
171045
+ }
171046
+ function resolveValidatedNamespace(value) {
171047
+ return assertValidIdentifier("Namespace", toKebabCase(value), validateNamespace);
171048
+ }
171049
+ function resolveValidatedTextDomain(value) {
171050
+ return assertValidIdentifier("Text domain", toKebabCase(value), validateTextDomain);
171051
+ }
171052
+ function resolveValidatedPhpPrefix(value) {
171053
+ return assertValidIdentifier("PHP prefix", toSnakeCase(value), validatePhpPrefix);
171054
+ }
171055
+ function buildBlockCssClassName(namespace, slug) {
171056
+ const normalizedSlug = resolveValidatedBlockSlug(slug);
171057
+ const normalizedNamespace = typeof namespace === "string" && namespace.trim().length > 0 ? resolveValidatedNamespace(namespace) : "";
171058
+ if (normalizedNamespace === normalizedSlug) {
171059
+ return `wp-block-${normalizedSlug}-block`;
171060
+ }
171061
+ return normalizedNamespace.length > 0 ? `wp-block-${normalizedNamespace}-${normalizedSlug}` : `wp-block-${normalizedSlug}`;
171062
+ }
171063
+ function buildFrontendCssClassName(blockCssClassName) {
171064
+ return `${blockCssClassName}-frontend`;
171065
+ }
171066
+ function resolveScaffoldIdentifiers({
171067
+ namespace,
171068
+ phpPrefix,
171069
+ slug,
171070
+ textDomain
171071
+ }) {
171072
+ const normalizedSlug = resolveValidatedBlockSlug(slug);
171073
+ return {
171074
+ namespace: resolveValidatedNamespace(namespace),
171075
+ phpPrefix: resolveValidatedPhpPrefix(phpPrefix ?? normalizedSlug),
171076
+ slug: normalizedSlug,
171077
+ textDomain: resolveValidatedTextDomain(textDomain ?? normalizedSlug)
171078
+ };
171079
+ }
170927
171080
 
170928
171081
  // ../wp-typia-project-tools/src/runtime/pattern-catalog-section-roles.ts
170929
171082
  import {
@@ -171143,6 +171296,8 @@ function validatePatternContentSectionRoles({
171143
171296
  }
171144
171297
 
171145
171298
  // ../wp-typia-project-tools/src/runtime/pattern-catalog.ts
171299
+ import fs from "fs";
171300
+ import path from "path";
171146
171301
  var PATTERN_CATALOG_SCOPE_IDS = ["full", "section"];
171147
171302
  var PATTERN_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/u;
171148
171303
  var PATTERN_TAG_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;
@@ -171380,85 +171535,6 @@ var HOOKED_BLOCK_POSITION_IDS = ["before", "after", "firstChild", "lastChild"];
171380
171535
  var HOOKED_BLOCK_POSITION_SET = new Set(HOOKED_BLOCK_POSITION_IDS);
171381
171536
  var HOOKED_BLOCK_ANCHOR_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
171382
171537
 
171383
- // ../wp-typia-project-tools/src/runtime/string-case.ts
171384
- var COMMON_ACRONYM_PREFIXES = [
171385
- "HTML",
171386
- "HTTP",
171387
- "JSON",
171388
- "REST",
171389
- "UUID",
171390
- "AJAX",
171391
- "API",
171392
- "CPT",
171393
- "CSS",
171394
- "CTA",
171395
- "DOM",
171396
- "PHP",
171397
- "SQL",
171398
- "SVG",
171399
- "URL",
171400
- "XML",
171401
- "ID",
171402
- "JS",
171403
- "UI",
171404
- "WP"
171405
- ];
171406
- var COMMON_ACRONYM_LOWERCASE_SUFFIXES = ["slug"];
171407
- function capitalizeSegment(segment) {
171408
- return segment.charAt(0).toUpperCase() + segment.slice(1);
171409
- }
171410
- function findCommonAcronymPrefix(segment) {
171411
- return COMMON_ACRONYM_PREFIXES.find((prefix) => segment.startsWith(prefix));
171412
- }
171413
- function isCommonAcronymLowercaseSuffix(suffix) {
171414
- return COMMON_ACRONYM_LOWERCASE_SUFFIXES.includes(suffix);
171415
- }
171416
- function splitKnownAcronymSegment(segment) {
171417
- const prefixes = [];
171418
- let remaining = segment;
171419
- while (remaining.length > 0) {
171420
- const prefix = findCommonAcronymPrefix(remaining);
171421
- if (!prefix) {
171422
- break;
171423
- }
171424
- const suffix = remaining.slice(prefix.length);
171425
- if (/^[A-Z][a-z]/.test(suffix)) {
171426
- return [...prefixes, prefix, suffix].join("-");
171427
- }
171428
- if (/^[a-z]+$/.test(suffix) && isCommonAcronymLowercaseSuffix(suffix)) {
171429
- return [...prefixes, prefix, suffix].join("-");
171430
- }
171431
- if (!findCommonAcronymPrefix(suffix)) {
171432
- break;
171433
- }
171434
- prefixes.push(prefix);
171435
- remaining = suffix;
171436
- }
171437
- return segment;
171438
- }
171439
- function splitAcronymBoundary(value) {
171440
- return value.replace(/[A-Z]{2,}[a-z]+/g, splitKnownAcronymSegment);
171441
- }
171442
- function toKebabCase(input) {
171443
- return splitAcronymBoundary(input.trim()).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").toLowerCase();
171444
- }
171445
- function toSnakeCase(input) {
171446
- return toKebabCase(input).replace(/-/g, "_");
171447
- }
171448
- function toPascalCase(input) {
171449
- return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join("");
171450
- }
171451
- function toCamelCase(input) {
171452
- const pascalCase = toPascalCase(input);
171453
- return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
171454
- }
171455
- function toSegmentPascalCase(input) {
171456
- return input.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map(capitalizeSegment).join("");
171457
- }
171458
- function toTitleCase(input) {
171459
- return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
171460
- }
171461
-
171462
171538
  // ../wp-typia-project-tools/src/runtime/cli-add-validation.ts
171463
171539
  var WORKSPACE_GENERATED_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
171464
171540
  var WORDPRESS_POST_TYPE_PATTERN = /^[a-z0-9_][a-z0-9_-]*$/u;
@@ -171796,7 +171872,7 @@ function formatAddHelpText() {
171796
171872
  wp-typia add variation <name> --block <block-slug> [--dry-run]
171797
171873
  wp-typia add style <name> --block <block-slug> [--dry-run]
171798
171874
  wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]
171799
- wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>|--tag <tag>...] [--thumbnail-url <url>] [--dry-run]
171875
+ wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]
171800
171876
  wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--from-post-meta|--post-meta <post-meta> [--meta-path <field>]] [--dry-run]
171801
171877
  wp-typia add contract <name> [--type <ExportedTypeName>] [--dry-run]
171802
171878
  wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <${REST_RESOURCE_METHOD_IDS.join(",")}>] [--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--dry-run]
@@ -171824,7 +171900,7 @@ Notes:
171824
171900
  \`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
171825
171901
  \`add style\` registers a Block Styles option for an existing generated block.
171826
171902
  \`add transform\` adds a block-to-block transform into an existing generated block.
171827
- \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/full/\` or \`src/patterns/sections/\` and records typed catalog metadata in \`PATTERNS\`; pass \`--catalog-title "Hero Photo"\` to override the generated catalog title, and pass \`--tags hero,landing\` or repeat \`--tag hero --tag landing\` to set catalog tags.
171903
+ \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/full/\` or \`src/patterns/sections/\` and records typed catalog metadata in \`PATTERNS\`; pass \`--catalog-title "Hero Photo"\` to override the generated catalog title, pass \`--tags hero,landing\` for a comma-separated tag list, and repeat \`--tag hero --tag landing\` for single tag values.
171828
171904
  \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare an end-to-end bindable attribute on an existing generated block. Pass \`--from-post-meta\` or \`--post-meta\` to generate a source backed by a typed post-meta contract; \`--meta-path\` selects one top-level field as the default binding arg.
171829
171905
  \`add contract\` registers a standalone TypeScript wire contract under \`src/contracts/\` and generates a stable JSON Schema artifact without creating PHP route glue.
171830
171906
  \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`. Use \`--route-pattern\`, \`--permission-callback\`, \`--controller-class\`, and \`--controller-extends\` when an existing WordPress controller or permission model needs to own part of the generated route surface.
@@ -171835,84 +171911,6 @@ Notes:
171835
171911
  \`add hooked-block\` patches an existing workspace block's \`block.json\` \`blockHooks\` metadata.
171836
171912
  \`add editor-plugin\` scaffolds a document-level editor extension under \`src/editor-plugins/\`; legacy aliases \`PluginSidebar\` and \`PluginDocumentSettingPanel\` resolve to \`sidebar\` and \`document-setting-panel\`.`;
171837
171913
  }
171838
-
171839
- // ../wp-typia-project-tools/src/runtime/scaffold-identifiers.ts
171840
- var BLOCK_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
171841
- var PHP_PREFIX_PATTERN = /^[a-z_][a-z0-9_]*$/;
171842
- var PHP_PREFIX_MAX_LENGTH = 50;
171843
- function validateBlockSlug(input) {
171844
- return BLOCK_SLUG_PATTERN.test(input) || "Use lowercase letters, numbers, and hyphens only";
171845
- }
171846
- function validateNamespace(input) {
171847
- return BLOCK_SLUG_PATTERN.test(toKebabCase(input)) ? true : "Use lowercase letters, numbers, and hyphens only";
171848
- }
171849
- function validateTextDomain(input) {
171850
- return BLOCK_SLUG_PATTERN.test(toKebabCase(input)) ? true : "Use lowercase letters, numbers, and hyphens only";
171851
- }
171852
- function validatePhpPrefix(input) {
171853
- const normalizedPrefix = toSnakeCase(input);
171854
- if (normalizedPrefix.length > PHP_PREFIX_MAX_LENGTH) {
171855
- return `Use ${PHP_PREFIX_MAX_LENGTH} characters or fewer to keep generated database identifiers within MySQL limits`;
171856
- }
171857
- return PHP_PREFIX_PATTERN.test(normalizedPrefix) ? true : "Use letters, numbers, and underscores only, starting with a letter";
171858
- }
171859
- function assertValidIdentifier(label, value, validate) {
171860
- const result = validate(value);
171861
- if (result !== true) {
171862
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
171863
- }
171864
- return value;
171865
- }
171866
- function normalizeBlockSlug(input) {
171867
- return toKebabCase(input);
171868
- }
171869
- function resolveNonEmptyNormalizedBlockSlug(options) {
171870
- const normalizedSlug = normalizeBlockSlug(options.input);
171871
- if (normalizedSlug.length > 0) {
171872
- return normalizedSlug;
171873
- }
171874
- if (options.input.trim().length === 0) {
171875
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `${options.label} is required. Use \`${options.usage}\`.`);
171876
- }
171877
- 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.`);
171878
- }
171879
- function resolveValidatedBlockSlug(value) {
171880
- return assertValidIdentifier("Block slug", normalizeBlockSlug(value), validateBlockSlug);
171881
- }
171882
- function resolveValidatedNamespace(value) {
171883
- return assertValidIdentifier("Namespace", toKebabCase(value), validateNamespace);
171884
- }
171885
- function resolveValidatedTextDomain(value) {
171886
- return assertValidIdentifier("Text domain", toKebabCase(value), validateTextDomain);
171887
- }
171888
- function resolveValidatedPhpPrefix(value) {
171889
- return assertValidIdentifier("PHP prefix", toSnakeCase(value), validatePhpPrefix);
171890
- }
171891
- function buildBlockCssClassName(namespace, slug) {
171892
- const normalizedSlug = resolveValidatedBlockSlug(slug);
171893
- const normalizedNamespace = typeof namespace === "string" && namespace.trim().length > 0 ? resolveValidatedNamespace(namespace) : "";
171894
- if (normalizedNamespace === normalizedSlug) {
171895
- return `wp-block-${normalizedSlug}-block`;
171896
- }
171897
- return normalizedNamespace.length > 0 ? `wp-block-${normalizedNamespace}-${normalizedSlug}` : `wp-block-${normalizedSlug}`;
171898
- }
171899
- function buildFrontendCssClassName(blockCssClassName) {
171900
- return `${blockCssClassName}-frontend`;
171901
- }
171902
- function resolveScaffoldIdentifiers({
171903
- namespace,
171904
- phpPrefix,
171905
- slug,
171906
- textDomain
171907
- }) {
171908
- const normalizedSlug = resolveValidatedBlockSlug(slug);
171909
- return {
171910
- namespace: resolveValidatedNamespace(namespace),
171911
- phpPrefix: resolveValidatedPhpPrefix(phpPrefix ?? normalizedSlug),
171912
- slug: normalizedSlug,
171913
- textDomain: resolveValidatedTextDomain(textDomain ?? normalizedSlug)
171914
- };
171915
- }
171916
171914
  // ../wp-typia-project-tools/src/runtime/cli-add-filesystem.ts
171917
171915
  import { promises as fsp2 } from "fs";
171918
171916
  import path2 from "path";
@@ -173818,6 +173816,6 @@ async function appendWorkspaceInventoryEntries(projectDir, options) {
173818
173816
  await writeFile(blockConfigPath, nextSource, "utf8");
173819
173817
  }
173820
173818
  }
173821
- export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, PATTERN_CATALOG_SCOPE_IDS, isValidPatternThumbnailUrl, resolvePatternCatalogContentFile, validatePatternCatalog, formatPatternCatalogDiagnostics, REST_RESOURCE_METHOD_IDS, MANUAL_REST_CONTRACT_HTTP_METHOD_IDS, MANUAL_REST_CONTRACT_AUTH_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, suggestAddBlockTemplateId, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, assertValidTypeScriptIdentifier, resolveRestResourceNamespace, assertValidPostMetaPostType, resolvePostMetaKey, assertValidRestResourceMethods, resolveOptionalPhpCallbackReference, resolveOptionalPhpClassReference, assertValidManualRestContractHttpMethod, assertValidManualRestContractAuth, isGeneratedRestResourceRoutePatternCompatible, collectRestRouteNamedCaptureNames, resolveManualRestContractPathPattern, resolveGeneratedRestResourceRoutePattern, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, assertValidIntegrationEnvService, pathExists, readOptionalUtf8File, getNodeErrorCode, getOptionalNodeErrorCode, isFileNotFoundError, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertPostMetaDoesNotExist, assertContractDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, getPropertyNameText, readWorkspaceInventory, readWorkspaceInventoryAsync, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, escapeRegex, quotePhpString, hasPhpFunctionDefinition, hasPhpFunctionCall, findPhpFunctionRange, replacePhpFunctionDefinition, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
173819
+ export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, PATTERN_SECTION_ROLE_PATTERN, PATTERN_CATALOG_SCOPE_IDS, PATTERN_TAG_PATTERN, isValidPatternThumbnailUrl, resolvePatternCatalogContentFile, validatePatternCatalog, formatPatternCatalogDiagnostics, REST_RESOURCE_METHOD_IDS, MANUAL_REST_CONTRACT_HTTP_METHOD_IDS, MANUAL_REST_CONTRACT_AUTH_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, suggestAddBlockTemplateId, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, assertValidTypeScriptIdentifier, resolveRestResourceNamespace, assertValidPostMetaPostType, resolvePostMetaKey, assertValidRestResourceMethods, resolveOptionalPhpCallbackReference, resolveOptionalPhpClassReference, assertValidManualRestContractHttpMethod, assertValidManualRestContractAuth, isGeneratedRestResourceRoutePatternCompatible, collectRestRouteNamedCaptureNames, resolveManualRestContractPathPattern, resolveGeneratedRestResourceRoutePattern, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, assertValidIntegrationEnvService, pathExists, readOptionalUtf8File, getNodeErrorCode, getOptionalNodeErrorCode, isFileNotFoundError, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertPostMetaDoesNotExist, assertContractDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, getPropertyNameText, readWorkspaceInventory, readWorkspaceInventoryAsync, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, escapeRegex, quotePhpString, hasPhpFunctionDefinition, hasPhpFunctionCall, findPhpFunctionRange, replacePhpFunctionDefinition, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
173822
173820
 
173823
- //# debugId=3009CBE929AC544A64756E2164756E21
173821
+ //# debugId=9E60A37E69B52ED864756E2164756E21
@@ -21,19 +21,19 @@ import {
21
21
  resolvePackageManagerId,
22
22
  resolveTemplateId,
23
23
  scaffoldProject
24
- } from "./cli-4ah8dawy.js";
24
+ } from "./cli-4eqznv15.js";
25
25
  import"./cli-9fx0qgb7.js";
26
- import"./cli-gaq29kzp.js";
27
- import"./cli-zjw3eqfj.js";
26
+ import"./cli-vxd8eyax.js";
27
+ import"./cli-wfvf3tv1.js";
28
28
  import {
29
29
  OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,
30
30
  isBuiltInTemplateId
31
31
  } from "./cli-8hxf9qw6.js";
32
- import"./cli-fzhkqzc7.js";
32
+ import"./cli-6ys6d16y.js";
33
33
  import"./cli-e4bwd81c.js";
34
34
  import {
35
35
  pathExists
36
- } from "./cli-h2v72j8q.js";
36
+ } from "./cli-kbqztfkt.js";
37
37
  import"./cli-cvxvcw7c.js";
38
38
  import {
39
39
  createManagedTempRoot
@@ -11,7 +11,7 @@ import {
11
11
  } from "./cli-8hxf9qw6.js";
12
12
  import {
13
13
  pathExists
14
- } from "./cli-h2v72j8q.js";
14
+ } from "./cli-kbqztfkt.js";
15
15
  import {
16
16
  createManagedTempRoot
17
17
  } from "./cli-t73q5aqz.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-8hxf9qw6.js";
5
5
  import {
6
6
  getOptionalNodeErrorCode
7
- } from "./cli-h2v72j8q.js";
7
+ } from "./cli-kbqztfkt.js";
8
8
  import {
9
9
  safeJsonParse
10
10
  } from "./cli-ccax7s0s.js";
package/dist-bunli/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  package_default,
23
23
  validateCliOutputFormatArgv,
24
24
  writeStructuredCliDiagnosticError
25
- } from "./cli-1xt99e09.js";
25
+ } from "./cli-6mr6vja7.js";
26
26
  import"./cli-03j0axbt.js";
27
27
  import {
28
28
  GLOBAL_FLAGS,
@@ -2460,7 +2460,7 @@ async function formatCliError(error) {
2460
2460
  }
2461
2461
  async function createWpTypiaCli(options = {}) {
2462
2462
  applyStandaloneSupportLayoutEnv();
2463
- const { wpTypiaCommands } = await import("./command-list-bd2582k1.js");
2463
+ const { wpTypiaCommands } = await import("./command-list-rqt03qqy.js");
2464
2464
  const cli = await createCLI({
2465
2465
  ...bunliConfig,
2466
2466
  description: package_default.description,
@@ -19,7 +19,7 @@ import {
19
19
  package_default,
20
20
  prefersStructuredCliOutput,
21
21
  resolveCommandOptionValues
22
- } from "./cli-1xt99e09.js";
22
+ } from "./cli-6mr6vja7.js";
23
23
  import {
24
24
  Result,
25
25
  TaggedError,
@@ -115,6 +115,13 @@ var NAME_ONLY_VISIBLE_FIELDS = [
115
115
  "kind",
116
116
  "name"
117
117
  ];
118
+ var PATTERN_CATALOG_VISIBLE_FIELDS = [
119
+ "kind",
120
+ "name",
121
+ "scope",
122
+ "section-role",
123
+ "catalog-title"
124
+ ];
118
125
  var NAME_SOURCE_VISIBLE_FIELDS = [
119
126
  "kind",
120
127
  "name",
@@ -583,6 +590,15 @@ var contractAddKindEntry = defineAddKindRegistryEntry({
583
590
  // src/add-kinds/core-variation.ts
584
591
  var CORE_VARIATION_MISSING_NAME_MESSAGE = "`wp-typia add core-variation` requires <name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
585
592
  var CORE_VARIATION_MISSING_BLOCK_MESSAGE = "`wp-typia add core-variation` requires <block-name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
593
+ var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
594
+ function formatCoreVariationMissingPositionalNameMessage(blockName) {
595
+ return [
596
+ `\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
597
+ "Usage: wp-typia add core-variation <block-name> <name>",
598
+ "Alternative: wp-typia add core-variation <name> --block <namespace/block>"
599
+ ].join(`
600
+ `);
601
+ }
586
602
  function resolveCoreVariationInputs(context) {
587
603
  const positionalTargetBlockName = context.positionalArgs?.[1];
588
604
  const positionalVariationName = context.positionalArgs?.[2];
@@ -595,16 +611,17 @@ function resolveCoreVariationInputs(context) {
595
611
  variationName: positionalVariationName
596
612
  };
597
613
  }
598
- if (context.name?.includes("/") && !readOptionalStrictStringFlag(context.flags, "block")) {
599
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, CORE_VARIATION_MISSING_NAME_MESSAGE);
614
+ const targetBlockFlag = readOptionalStrictStringFlag(context.flags, "block");
615
+ const missingPositionalNameTarget = context.name !== undefined && positionalTargetBlockName === context.name && CORE_VARIATION_BLOCK_NAME_PATTERN.test(context.name) ? context.name : undefined;
616
+ if (missingPositionalNameTarget && !targetBlockFlag) {
617
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, formatCoreVariationMissingPositionalNameMessage(missingPositionalNameTarget));
600
618
  }
601
619
  const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
602
- const targetBlockName = readOptionalStrictStringFlag(context.flags, "block");
603
- if (!targetBlockName) {
620
+ if (!targetBlockFlag) {
604
621
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
605
622
  }
606
623
  return {
607
- targetBlockName,
624
+ targetBlockName: targetBlockFlag,
608
625
  variationName
609
626
  };
610
627
  }
@@ -783,7 +800,8 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
783
800
  supportsDryRun: true,
784
801
  usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
785
802
  visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
786
- hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
803
+ hiddenBooleanSubmitFields: ["wp-env", "release-zip"],
804
+ hiddenStringSubmitFields: ["service"]
787
805
  });
788
806
 
789
807
  // src/add-kinds/pattern.ts
@@ -802,19 +820,12 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
802
820
  title: "Added workspace pattern"
803
821
  },
804
822
  description: "Add a PHP block pattern shell",
805
- hiddenStringSubmitFields: [
806
- "catalog-title",
807
- "scope",
808
- "section-role",
809
- "tag",
810
- "tags",
811
- "thumbnail-url"
812
- ],
823
+ hiddenStringSubmitFields: ["tag", "tags", "thumbnail-url"],
813
824
  nameLabel: "Pattern name",
814
825
  async prepareExecution(context) {
815
826
  const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
816
- const scope = typeof context.flags.scope === "string" ? context.flags.scope : undefined;
817
- const sectionRole = typeof context.flags["section-role"] === "string" ? context.flags["section-role"] : undefined;
827
+ const scope = resolvePatternScopeFlag(context);
828
+ const sectionRole = resolvePatternSectionRoleFlag(context, scope);
818
829
  const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
819
830
  const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
820
831
  const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
@@ -839,9 +850,42 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
839
850
  },
840
851
  sortOrder: 60,
841
852
  supportsDryRun: true,
842
- usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>|--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
843
- visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
853
+ usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
854
+ visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
844
855
  });
856
+ function createInvalidPatternArgumentError(message) {
857
+ return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, message);
858
+ }
859
+ function createMissingPatternArgumentError(message) {
860
+ return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
861
+ }
862
+ function resolvePatternScopeFlag(context) {
863
+ const scope = readOptionalLooseStringFlag(context.flags, "scope");
864
+ if (!scope) {
865
+ return;
866
+ }
867
+ if (context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.includes(scope)) {
868
+ return scope;
869
+ }
870
+ throw createInvalidPatternArgumentError(`\`--scope\` must be one of: ${context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.join(", ")}. Usage: wp-typia add pattern <name> --scope <full|section>.`);
871
+ }
872
+ function resolvePatternSectionRoleFlag(context, scope) {
873
+ const sectionRole = readOptionalLooseStringFlag(context.flags, "section-role");
874
+ if (scope === "section" && sectionRole === undefined) {
875
+ throw createMissingPatternArgumentError("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
876
+ }
877
+ if (scope !== "section" && sectionRole !== undefined) {
878
+ throw createInvalidPatternArgumentError("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
879
+ }
880
+ const normalizedSectionRole = sectionRole === undefined ? undefined : context.addRuntime.normalizeBlockSlug(sectionRole);
881
+ if (normalizedSectionRole && !context.addRuntime.PATTERN_SECTION_ROLE_PATTERN.test(normalizedSectionRole)) {
882
+ throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
883
+ }
884
+ if (sectionRole !== undefined && !normalizedSectionRole) {
885
+ throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
886
+ }
887
+ return normalizedSectionRole;
888
+ }
845
889
  function collectStringFlagValues(value) {
846
890
  if (typeof value === "string") {
847
891
  return [value];
@@ -856,13 +900,7 @@ function normalizePatternTagFlags(tagsFlag, tagFlag) {
856
900
  ...collectStringFlagValues(tagsFlag),
857
901
  ...collectStringFlagValues(tagFlag)
858
902
  ];
859
- if (tags.length === 0) {
860
- return;
861
- }
862
- if (tags.length === 1) {
863
- return tags[0];
864
- }
865
- return tags;
903
+ return tags.length > 0 ? tags : undefined;
866
904
  }
867
905
 
868
906
  // src/add-kinds/post-meta.ts
@@ -1818,7 +1856,7 @@ function pushFlag(argv, name, value) {
1818
1856
  }
1819
1857
 
1820
1858
  // src/runtime-bridge-add.ts
1821
- var loadCliAddRuntime = () => import("./cli-add-mr731xtv.js");
1859
+ var loadCliAddRuntime = () => import("./cli-add-r4c15g7g.js");
1822
1860
  var loadCliPromptRuntime = () => import("./cli-prompt-ncyg68rn.js");
1823
1861
  async function executeWorkspaceAddWithOptionalDryRun(options) {
1824
1862
  const simulated = options.dryRun ? await simulateWorkspaceAddDryRun({
@@ -1928,7 +1966,7 @@ async function executeAddCommand({
1928
1966
  }
1929
1967
  // src/runtime-bridge-create.ts
1930
1968
  var loadCliPromptRuntime2 = () => import("./cli-prompt-ncyg68rn.js");
1931
- var loadCliScaffoldRuntime = () => import("./cli-scaffold-bt1ttnkg.js");
1969
+ var loadCliScaffoldRuntime = () => import("./cli-scaffold-b49zc1rw.js");
1932
1970
  var loadCliTemplatesRuntime = () => import("./cli-templates-g8t4fm11.js");
1933
1971
  var loadCreateTemplateValidationRuntime = () => import("./create-template-validation-4fr851vg.js");
1934
1972
  var PACKAGE_MANAGER_PROMPT_OPTIONS = [
@@ -2049,7 +2087,7 @@ async function executeCreateCommand({
2049
2087
  }
2050
2088
  }
2051
2089
  // src/runtime-bridge-doctor.ts
2052
- var loadCliDoctorRuntime = () => import("./cli-doctor-kf9gwdhh.js");
2090
+ var loadCliDoctorRuntime = () => import("./cli-doctor-fd6mfx0f.js");
2053
2091
  async function executeDoctorCommand(cwd, options = {}) {
2054
2092
  try {
2055
2093
  const { runDoctor } = await loadCliDoctorRuntime();
@@ -2060,7 +2098,7 @@ async function executeDoctorCommand(cwd, options = {}) {
2060
2098
  }
2061
2099
  // src/runtime-bridge-init.ts
2062
2100
  import path2 from "path";
2063
- var loadCliInitRuntime = () => import("./cli-init-557vq109.js");
2101
+ var loadCliInitRuntime = () => import("./cli-init-kmredfj7.js");
2064
2102
  async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
2065
2103
  try {
2066
2104
  const { runInitCommand } = await loadCliInitRuntime();
@@ -2086,7 +2124,7 @@ async function executeInitCommand({ apply, cwd, packageManager, projectDir }, op
2086
2124
  }
2087
2125
  }
2088
2126
  // src/runtime-bridge-migrate.ts
2089
- var loadMigrationsRuntime = () => import("./migrations-ky53fj2h.js");
2127
+ var loadMigrationsRuntime = () => import("./migrations-zhd03hvy.js");
2090
2128
  var defaultPrintLine2 = (line) => {
2091
2129
  process.stdout.write(`${line}
2092
2130
  `);
@@ -2982,7 +3020,7 @@ var doctorCommand = defineCommand({
2982
3020
  createDoctorRunSummary,
2983
3021
  getDoctorChecks,
2984
3022
  getDoctorExitFailureDetailLines
2985
- } = await import("./cli-doctor-kf9gwdhh.js");
3023
+ } = await import("./cli-doctor-fd6mfx0f.js");
2986
3024
  const checks = await getDoctorChecks(args.cwd);
2987
3025
  const summary = createDoctorRunSummary(checks, {
2988
3026
  exitPolicy: doctorExitPolicy
@@ -3877,4 +3915,4 @@ export {
3877
3915
  wpTypiaCommands
3878
3916
  };
3879
3917
 
3880
- //# debugId=B6599B689F520BC764756E2164756E21
3918
+ //# debugId=30271EF71AB322F564756E2164756E21
@@ -15,9 +15,9 @@ import {
15
15
  snapshotProjectVersion,
16
16
  verifyProjectMigrations,
17
17
  wizardProjectMigrations
18
- } from "./cli-fzhkqzc7.js";
18
+ } from "./cli-6ys6d16y.js";
19
19
  import"./cli-e4bwd81c.js";
20
- import"./cli-h2v72j8q.js";
20
+ import"./cli-kbqztfkt.js";
21
21
  import"./cli-cvxvcw7c.js";
22
22
  import"./cli-bajwv85z.js";
23
23
  import"./cli-tq730sqt.js";