@wp-typia/project-tools 0.23.1 → 0.24.1

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.
Files changed (157) hide show
  1. package/dist/runtime/built-in-block-non-ts-basic-artifacts.d.ts +9 -0
  2. package/dist/runtime/built-in-block-non-ts-basic-artifacts.js +84 -0
  3. package/dist/runtime/built-in-block-non-ts-compound-artifacts.d.ts +9 -0
  4. package/dist/runtime/built-in-block-non-ts-compound-artifacts.js +36 -0
  5. package/dist/runtime/built-in-block-non-ts-compound-templates.d.ts +23 -0
  6. package/dist/runtime/built-in-block-non-ts-compound-templates.js +453 -0
  7. package/dist/runtime/built-in-block-non-ts-family-artifacts.d.ts +8 -26
  8. package/dist/runtime/built-in-block-non-ts-family-artifacts.js +8 -1034
  9. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.d.ts +9 -0
  10. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.js +83 -0
  11. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.d.ts +9 -0
  12. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.js +33 -0
  13. package/dist/runtime/built-in-block-non-ts-persistence-templates.d.ts +23 -0
  14. package/dist/runtime/built-in-block-non-ts-persistence-templates.js +395 -0
  15. package/dist/runtime/cli-add-collision.js +8 -0
  16. package/dist/runtime/cli-add-help.js +11 -7
  17. package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
  18. package/dist/runtime/cli-add-kind-ids.js +1 -0
  19. package/dist/runtime/cli-add-types.d.ts +28 -1
  20. package/dist/runtime/cli-add-types.js +2 -0
  21. package/dist/runtime/cli-add-workspace-ability-anchors.d.ts +24 -0
  22. package/dist/runtime/cli-add-workspace-ability-anchors.js +294 -0
  23. package/dist/runtime/cli-add-workspace-ability-registry.d.ts +10 -0
  24. package/dist/runtime/cli-add-workspace-ability-registry.js +51 -0
  25. package/dist/runtime/cli-add-workspace-ability-scaffold.d.ts +1 -1
  26. package/dist/runtime/cli-add-workspace-ability-scaffold.js +5 -311
  27. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +1 -1
  28. package/dist/runtime/cli-add-workspace-ai-anchors.d.ts +4 -4
  29. package/dist/runtime/cli-add-workspace-ai-anchors.js +4 -232
  30. package/dist/runtime/cli-add-workspace-ai-scaffold.js +4 -2
  31. package/dist/runtime/cli-add-workspace-ai-source-emitters.d.ts +1 -4
  32. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +3 -171
  33. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.d.ts +5 -0
  34. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.js +236 -0
  35. package/dist/runtime/cli-add-workspace-ai-sync-script-source.d.ts +4 -0
  36. package/dist/runtime/cli-add-workspace-ai-sync-script-source.js +145 -0
  37. package/dist/runtime/cli-add-workspace-assets.d.ts +6 -63
  38. package/dist/runtime/cli-add-workspace-assets.js +6 -950
  39. package/dist/runtime/cli-add-workspace-binding-source-anchors.d.ts +23 -0
  40. package/dist/runtime/cli-add-workspace-binding-source-anchors.js +112 -0
  41. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.d.ts +33 -0
  42. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.js +436 -0
  43. package/dist/runtime/cli-add-workspace-binding-source-types.d.ts +20 -0
  44. package/dist/runtime/cli-add-workspace-binding-source-types.js +1 -0
  45. package/dist/runtime/cli-add-workspace-binding-source.d.ts +40 -0
  46. package/dist/runtime/cli-add-workspace-binding-source.js +275 -0
  47. package/dist/runtime/cli-add-workspace-block-style.d.ts +22 -0
  48. package/dist/runtime/cli-add-workspace-block-style.js +148 -0
  49. package/dist/runtime/cli-add-workspace-block-transform.d.ts +32 -0
  50. package/dist/runtime/cli-add-workspace-block-transform.js +197 -0
  51. package/dist/runtime/cli-add-workspace-contract.js +1 -1
  52. package/dist/runtime/cli-add-workspace-core-variation.d.ts +22 -0
  53. package/dist/runtime/cli-add-workspace-core-variation.js +429 -0
  54. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.d.ts +37 -0
  55. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.js +206 -0
  56. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.d.ts +47 -0
  57. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.js +219 -0
  58. package/dist/runtime/cli-add-workspace-editor-plugin.d.ts +22 -0
  59. package/dist/runtime/cli-add-workspace-editor-plugin.js +78 -0
  60. package/dist/runtime/cli-add-workspace-hooked-block.d.ts +23 -0
  61. package/dist/runtime/cli-add-workspace-hooked-block.js +57 -0
  62. package/dist/runtime/cli-add-workspace-integration-env-files.d.ts +33 -0
  63. package/dist/runtime/cli-add-workspace-integration-env-files.js +65 -0
  64. package/dist/runtime/cli-add-workspace-integration-env-package-json.d.ts +38 -0
  65. package/dist/runtime/cli-add-workspace-integration-env-package-json.js +122 -0
  66. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.d.ts +44 -0
  67. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.js +262 -0
  68. package/dist/runtime/cli-add-workspace-integration-env.js +5 -345
  69. package/dist/runtime/cli-add-workspace-pattern-anchors.d.ts +10 -0
  70. package/dist/runtime/cli-add-workspace-pattern-anchors.js +95 -0
  71. package/dist/runtime/cli-add-workspace-pattern-options.d.ts +20 -0
  72. package/dist/runtime/cli-add-workspace-pattern-options.js +113 -0
  73. package/dist/runtime/cli-add-workspace-pattern-source-emitters.d.ts +20 -0
  74. package/dist/runtime/cli-add-workspace-pattern-source-emitters.js +57 -0
  75. package/dist/runtime/cli-add-workspace-pattern.d.ts +42 -0
  76. package/dist/runtime/cli-add-workspace-pattern.js +99 -0
  77. package/dist/runtime/cli-add-workspace-post-meta.js +1 -1
  78. package/dist/runtime/cli-add-workspace-registration-hooks.d.ts +50 -0
  79. package/dist/runtime/cli-add-workspace-registration-hooks.js +162 -0
  80. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +6 -9
  81. package/dist/runtime/cli-add-workspace-rest-anchors.js +6 -466
  82. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.d.ts +17 -0
  83. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.js +108 -0
  84. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.d.ts +9 -0
  85. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.js +142 -0
  86. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.d.ts +51 -0
  87. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.js +415 -0
  88. package/dist/runtime/cli-add-workspace-rest-generated.js +5 -3
  89. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.d.ts +80 -0
  90. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.js +238 -0
  91. package/dist/runtime/cli-add-workspace-rest-manual.js +3 -16
  92. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +1 -7
  93. package/dist/runtime/cli-add-workspace-rest-php-templates.js +3 -322
  94. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.d.ts +33 -0
  95. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.js +145 -0
  96. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.d.ts +9 -0
  97. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.js +162 -0
  98. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.d.ts +7 -0
  99. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.js +193 -0
  100. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +5 -99
  101. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +5 -663
  102. package/dist/runtime/cli-add-workspace-rest-source-utils.d.ts +17 -0
  103. package/dist/runtime/cli-add-workspace-rest-source-utils.js +50 -0
  104. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.d.ts +56 -0
  105. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.js +122 -0
  106. package/dist/runtime/cli-add-workspace-rest-types.d.ts +3 -3
  107. package/dist/runtime/cli-add-workspace-variation.d.ts +22 -0
  108. package/dist/runtime/cli-add-workspace-variation.js +162 -0
  109. package/dist/runtime/cli-add-workspace.d.ts +42 -107
  110. package/dist/runtime/cli-add-workspace.js +42 -674
  111. package/dist/runtime/cli-add.d.ts +3 -3
  112. package/dist/runtime/cli-add.js +2 -2
  113. package/dist/runtime/cli-core.d.ts +2 -1
  114. package/dist/runtime/cli-core.js +1 -1
  115. package/dist/runtime/cli-doctor-workspace-bindings.js +59 -0
  116. package/dist/runtime/cli-doctor-workspace-block-addons.js +33 -5
  117. package/dist/runtime/cli-doctor.d.ts +2 -0
  118. package/dist/runtime/cli-doctor.js +13 -2
  119. package/dist/runtime/cli-help.js +7 -4
  120. package/dist/runtime/index.d.ts +5 -2
  121. package/dist/runtime/index.js +4 -2
  122. package/dist/runtime/json-utils.d.ts +2 -5
  123. package/dist/runtime/json-utils.js +2 -5
  124. package/dist/runtime/local-dev-presets.js +2 -1
  125. package/dist/runtime/package-versions.d.ts +1 -0
  126. package/dist/runtime/package-versions.js +15 -8
  127. package/dist/runtime/pattern-catalog-section-roles.d.ts +101 -0
  128. package/dist/runtime/pattern-catalog-section-roles.js +276 -0
  129. package/dist/runtime/pattern-catalog.d.ts +67 -0
  130. package/dist/runtime/pattern-catalog.js +225 -0
  131. package/dist/runtime/post-meta-binding-fields.d.ts +46 -0
  132. package/dist/runtime/post-meta-binding-fields.js +135 -0
  133. package/dist/runtime/template-source-cache-markers.js +7 -2
  134. package/dist/runtime/typia-llm-json-schema.d.ts +24 -0
  135. package/dist/runtime/typia-llm-json-schema.js +33 -0
  136. package/dist/runtime/typia-llm-openapi-constraints.d.ts +20 -0
  137. package/dist/runtime/typia-llm-openapi-constraints.js +254 -0
  138. package/dist/runtime/typia-llm-projection.d.ts +25 -0
  139. package/dist/runtime/typia-llm-projection.js +58 -0
  140. package/dist/runtime/typia-llm-render.d.ts +21 -0
  141. package/dist/runtime/typia-llm-render.js +252 -0
  142. package/dist/runtime/typia-llm-sync.d.ts +10 -0
  143. package/dist/runtime/typia-llm-sync.js +63 -0
  144. package/dist/runtime/typia-llm-types.d.ts +197 -0
  145. package/dist/runtime/typia-llm-types.js +1 -0
  146. package/dist/runtime/typia-llm.d.ts +9 -255
  147. package/dist/runtime/typia-llm.js +5 -634
  148. package/dist/runtime/workspace-inventory-mutations.js +13 -0
  149. package/dist/runtime/workspace-inventory-section-descriptors.js +9 -1
  150. package/dist/runtime/workspace-inventory-templates.d.ts +2 -2
  151. package/dist/runtime/workspace-inventory-templates.js +9 -1
  152. package/dist/runtime/workspace-inventory-types.d.ts +9 -1
  153. package/package.json +8 -3
  154. package/templates/_shared/compound/core/scripts/block-config.ts.mustache +22 -0
  155. package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +103 -2
  156. package/templates/_shared/compound/core/src/inner-blocks-templates.ts.mustache +13 -0
  157. package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +22 -1
@@ -7,9 +7,9 @@
7
7
  * - `cli-add-block` for built-in block scaffolding
8
8
  * - `cli-add-workspace` for workspace mutation commands
9
9
  */
10
- export { ADD_BLOCK_TEMPLATE_IDS, ADD_KIND_IDS, EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, isAddBlockTemplateId, suggestAddBlockTemplateId, } from "./cli-add-shared.js";
11
- export type { AddBlockTemplateId, AddKindId, EditorPluginSlotId, } from "./cli-add-shared.js";
10
+ export { ADD_BLOCK_TEMPLATE_IDS, ADD_KIND_IDS, EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, isAddBlockTemplateId, PATTERN_CATALOG_SCOPE_IDS, suggestAddBlockTemplateId, } from "./cli-add-shared.js";
11
+ export type { AddBlockTemplateId, AddKindId, EditorPluginSlotId, PatternCatalogScope, } from "./cli-add-shared.js";
12
12
  export { runAddBlockCommand, seedWorkspaceMigrationProject, } from "./cli-add-block.js";
13
- export { runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddIntegrationEnvCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, } from "./cli-add-workspace.js";
13
+ export { runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddIntegrationEnvCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, } from "./cli-add-workspace.js";
14
14
  export { getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, } from "./workspace-inventory.js";
15
15
  export type { WorkspaceBlockSelectOption } from "./workspace-inventory.js";
@@ -7,7 +7,7 @@
7
7
  * - `cli-add-block` for built-in block scaffolding
8
8
  * - `cli-add-workspace` for workspace mutation commands
9
9
  */
10
- export { ADD_BLOCK_TEMPLATE_IDS, ADD_KIND_IDS, EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, isAddBlockTemplateId, suggestAddBlockTemplateId, } from "./cli-add-shared.js";
10
+ export { ADD_BLOCK_TEMPLATE_IDS, ADD_KIND_IDS, EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, isAddBlockTemplateId, PATTERN_CATALOG_SCOPE_IDS, suggestAddBlockTemplateId, } from "./cli-add-shared.js";
11
11
  export { runAddBlockCommand, seedWorkspaceMigrationProject, } from "./cli-add-block.js";
12
- export { runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddIntegrationEnvCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, } from "./cli-add-workspace.js";
12
+ export { runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddIntegrationEnvCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, } from "./cli-add-workspace.js";
13
13
  export { getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, } from "./workspace-inventory.js";
@@ -33,7 +33,8 @@
33
33
  export { createDoctorRunSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, runDoctor, type DoctorCheck, type DoctorCheckScope, type DoctorExitPolicy, type DoctorFailureSummary, type DoctorRunSummary, } from "./cli-doctor.js";
34
34
  export { createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODE_METADATA, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatDoctorCheckLine, formatDoctorSummaryLine, getCliDiagnosticCodeMetadata, getDoctorFailureDetailLines, getFailingDoctorChecks, isCliDiagnosticError, } from "./cli-diagnostics.js";
35
35
  export type { CliDiagnosticCode, CliDiagnosticCodeError, CliDiagnosticMessage, } from "./cli-diagnostics.js";
36
- export { EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, runAddAdminViewCommand, runAddAbilityCommand, runAddBindingSourceCommand, runAddAiFeatureCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, seedWorkspaceMigrationProject, } from "./cli-add.js";
36
+ export { EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, PATTERN_CATALOG_SCOPE_IDS, runAddAdminViewCommand, runAddAbilityCommand, runAddBindingSourceCommand, runAddAiFeatureCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, seedWorkspaceMigrationProject, } from "./cli-add.js";
37
+ export type { PatternCatalogScope } from "./cli-add.js";
37
38
  export { COMPOUND_INNER_BLOCKS_PRESET_IDS, getCompoundInnerBlocksPresetDefinition, } from "./compound-inner-blocks.js";
38
39
  export type { CompoundInnerBlocksPresetId } from "./compound-inner-blocks.js";
39
40
  export { HOOKED_BLOCK_POSITION_IDS } from "./hooked-blocks.js";
@@ -32,7 +32,7 @@
32
32
  */
33
33
  export { createDoctorRunSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, runDoctor, } from "./cli-doctor.js";
34
34
  export { createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODE_METADATA, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatDoctorCheckLine, formatDoctorSummaryLine, getCliDiagnosticCodeMetadata, getDoctorFailureDetailLines, getFailingDoctorChecks, isCliDiagnosticError, } from "./cli-diagnostics.js";
35
- export { EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, runAddAdminViewCommand, runAddAbilityCommand, runAddBindingSourceCommand, runAddAiFeatureCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, seedWorkspaceMigrationProject, } from "./cli-add.js";
35
+ export { EDITOR_PLUGIN_SLOT_IDS, formatAddHelpText, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, PATTERN_CATALOG_SCOPE_IDS, runAddAdminViewCommand, runAddAbilityCommand, runAddBindingSourceCommand, runAddAiFeatureCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddContractCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runAddRestResourceCommand, runAddVariationCommand, seedWorkspaceMigrationProject, } from "./cli-add.js";
36
36
  export { COMPOUND_INNER_BLOCKS_PRESET_IDS, getCompoundInnerBlocksPresetDefinition, } from "./compound-inner-blocks.js";
37
37
  export { HOOKED_BLOCK_POSITION_IDS } from "./hooked-blocks.js";
38
38
  export { formatHelpText } from "./cli-help.js";
@@ -4,6 +4,7 @@ import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
4
4
  import { checkExistingFiles, createDoctorCheck, resolveWorkspaceBootstrapPath, WORKSPACE_BINDING_EDITOR_ASSET, WORKSPACE_BINDING_EDITOR_SCRIPT, WORKSPACE_BINDING_SERVER_GLOB, } from "./cli-doctor-workspace-shared.js";
5
5
  import { readJsonFileSync } from "./json-utils.js";
6
6
  import { escapeRegex } from "./php-utils.js";
7
+ import { assertPostMetaBindingPath, loadPostMetaBindingFieldsSync, } from "./post-meta-binding-fields.js";
7
8
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
8
9
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
9
10
  if (!fs.existsSync(bootstrapPath)) {
@@ -108,6 +109,60 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
108
109
  ? `${bindingSource.block}.${bindingSource.attribute} is declared and supported`
109
110
  : issues.join("; "));
110
111
  }
112
+ function checkWorkspaceBindingPostMeta(projectDir, inventory, bindingSource) {
113
+ if (!bindingSource.postMeta) {
114
+ return undefined;
115
+ }
116
+ const postMeta = inventory.postMeta.find((entry) => entry.slug === bindingSource.postMeta);
117
+ if (!postMeta) {
118
+ return createDoctorCheck(`Binding post meta ${bindingSource.slug}`, "fail", `Binding source references unknown post meta contract "${bindingSource.postMeta}".`);
119
+ }
120
+ const issues = [];
121
+ try {
122
+ const fields = loadPostMetaBindingFieldsSync(projectDir, postMeta);
123
+ if (bindingSource.metaPath) {
124
+ assertPostMetaBindingPath(fields, postMeta.slug, bindingSource.metaPath);
125
+ }
126
+ }
127
+ catch (error) {
128
+ issues.push(error instanceof Error ? error.message : String(error));
129
+ }
130
+ const serverPath = path.join(projectDir, bindingSource.serverFile);
131
+ if (fs.existsSync(serverPath)) {
132
+ const serverSource = fs.readFileSync(serverPath, "utf8");
133
+ if (!serverSource.includes("get_post_meta")) {
134
+ issues.push(`${bindingSource.serverFile} must read post meta values`);
135
+ }
136
+ if (!serverSource.includes(postMeta.metaKey)) {
137
+ issues.push(`${bindingSource.serverFile} must reference ${postMeta.metaKey}`);
138
+ }
139
+ if (!serverSource.includes(postMeta.schemaFile)) {
140
+ issues.push(`${bindingSource.serverFile} must reference ${postMeta.schemaFile}`);
141
+ }
142
+ }
143
+ else {
144
+ issues.push(`Missing ${bindingSource.serverFile}`);
145
+ }
146
+ const editorPath = path.join(projectDir, bindingSource.editorFile);
147
+ if (fs.existsSync(editorPath)) {
148
+ const editorSource = fs.readFileSync(editorPath, "utf8");
149
+ if (!editorSource.includes("POST_META_BINDING_FIELDS")) {
150
+ issues.push(`${bindingSource.editorFile} must define post meta binding fields`);
151
+ }
152
+ if (!editorSource.includes(postMeta.schemaFile)) {
153
+ issues.push(`${bindingSource.editorFile} must reference ${postMeta.schemaFile}`);
154
+ }
155
+ if (bindingSource.metaPath && !editorSource.includes(bindingSource.metaPath)) {
156
+ issues.push(`${bindingSource.editorFile} must reference default meta path "${bindingSource.metaPath}"`);
157
+ }
158
+ }
159
+ else {
160
+ issues.push(`Missing ${bindingSource.editorFile}`);
161
+ }
162
+ return createDoctorCheck(`Binding post meta ${bindingSource.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0
163
+ ? `${bindingSource.slug} reads ${postMeta.slug} via ${postMeta.schemaFile}`
164
+ : issues.join("; "));
165
+ }
111
166
  /**
112
167
  * Collect workspace doctor checks for extracted binding-source diagnostics.
113
168
  *
@@ -131,6 +186,10 @@ export function getWorkspaceBindingDoctorChecks(workspace, inventory) {
131
186
  if (bindingTargetCheck) {
132
187
  checks.push(bindingTargetCheck);
133
188
  }
189
+ const bindingPostMetaCheck = checkWorkspaceBindingPostMeta(workspace.projectDir, inventory, bindingSource);
190
+ if (bindingPostMetaCheck) {
191
+ checks.push(bindingPostMetaCheck);
192
+ }
134
193
  }
135
194
  return checks;
136
195
  }
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { checkExistingFiles, createDoctorCheck, resolveWorkspaceBootstrapPath, WORKSPACE_FULL_BLOCK_NAME_PATTERN, } from "./cli-doctor-workspace-shared.js";
4
+ import { formatPatternCatalogDiagnostics, resolvePatternCatalogContentFile, validatePatternCatalog, } from "./pattern-catalog.js";
4
5
  import { hasExecutablePattern, hasUncommentedPattern, } from "./ts-source-masking.js";
5
6
  const WORKSPACE_VARIATIONS_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspaceVariations\s*\}\s*from\s*["']\.\/variations["']\s*;?\s*$/mu;
6
7
  const WORKSPACE_VARIATIONS_CALL_PATTERN = /registerWorkspaceVariations\s*\(\s*\)\s*;?/u;
@@ -8,7 +9,15 @@ const WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspa
8
9
  const WORKSPACE_BLOCK_STYLES_CALL_PATTERN = /registerWorkspaceBlockStyles\s*\(\s*\)\s*;?/u;
9
10
  const WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN = /^\s*import\s*\{\s*applyWorkspaceBlockTransforms\s*\}\s*from\s*["']\.\/transforms["']\s*;?\s*$/mu;
10
11
  const WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN = /applyWorkspaceBlockTransforms\s*\(\s*registration\s*\.\s*settings\s*\)\s*;?/u;
11
- function checkWorkspacePatternBootstrap(projectDir, packageName) {
12
+ function isNestedPatternContentFile(patternFile) {
13
+ if (!patternFile) {
14
+ return false;
15
+ }
16
+ const normalizedPath = patternFile.replace(/\\/gu, "/");
17
+ return (normalizedPath.startsWith("src/patterns/") &&
18
+ normalizedPath.slice("src/patterns/".length).includes("/"));
19
+ }
20
+ function checkWorkspacePatternBootstrap(projectDir, packageName, requiresNestedPatternGlob) {
12
21
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
13
22
  if (!fs.existsSync(bootstrapPath)) {
14
23
  return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${path.basename(bootstrapPath)}`);
@@ -16,9 +25,13 @@ function checkWorkspacePatternBootstrap(projectDir, packageName) {
16
25
  const source = fs.readFileSync(bootstrapPath, "utf8");
17
26
  const hasCategoryAnchor = source.includes("register_block_pattern_category");
18
27
  const hasPatternGlob = source.includes("/src/patterns/*.php");
19
- return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob
28
+ const hasNestedPatternGlob = source.includes("/src/patterns/*/*.php");
29
+ const hasRequiredPatternGlobs = hasPatternGlob && (!requiresNestedPatternGlob || hasNestedPatternGlob);
30
+ return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasRequiredPatternGlobs ? "pass" : "fail", hasCategoryAnchor && hasRequiredPatternGlobs
20
31
  ? "Pattern category and loader hooks are present"
21
- : "Missing pattern category registration or src/patterns loader hook");
32
+ : requiresNestedPatternGlob
33
+ ? "Missing pattern category registration or nested src/patterns loader hook"
34
+ : "Missing pattern category registration or src/patterns loader hook");
22
35
  }
23
36
  function checkVariationEntrypoint(projectDir, blockSlug) {
24
37
  const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
@@ -125,10 +138,25 @@ export function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registe
125
138
  const shouldCheckPatternBootstrap = inventory.patterns.length > 0 ||
126
139
  fs.existsSync(path.join(workspace.projectDir, "src", "patterns"));
127
140
  if (shouldCheckPatternBootstrap) {
128
- checks.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
141
+ const requiresNestedPatternGlob = inventory.patterns.some((pattern) => isNestedPatternContentFile(resolvePatternCatalogContentFile(pattern)));
142
+ checks.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName, requiresNestedPatternGlob));
143
+ }
144
+ if (inventory.patterns.length > 0) {
145
+ const catalogValidation = validatePatternCatalog(inventory.patterns, {
146
+ projectDir: workspace.projectDir,
147
+ });
148
+ checks.push(createDoctorCheck("Pattern catalog", catalogValidation.errors.length > 0
149
+ ? "fail"
150
+ : catalogValidation.warnings.length > 0
151
+ ? "warn"
152
+ : "pass", catalogValidation.diagnostics.length > 0
153
+ ? formatPatternCatalogDiagnostics(catalogValidation.diagnostics)
154
+ : "Pattern catalog metadata is valid"));
129
155
  }
130
156
  for (const pattern of inventory.patterns) {
131
- checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [pattern.file]));
157
+ checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [
158
+ resolvePatternCatalogContentFile(pattern),
159
+ ]));
132
160
  }
133
161
  return checks;
134
162
  }
@@ -81,6 +81,8 @@ export declare function createDoctorRunSummary(checks: readonly DoctorCheck[], o
81
81
  * @param cwd Working directory to validate.
82
82
  * @param options Optional renderer overrides and exit-policy selection.
83
83
  * @param options.exitPolicy Policy deciding which failed checks contribute to the process exit code.
84
+ * @param options.renderLine Optional renderer for each check row. Defaults to the stdout line printer.
85
+ * @param options.renderSummaryLine Optional renderer for the summary row. Defaults to the stdout line printer unless a custom `renderLine` suppresses implicit summary output.
84
86
  * @returns The completed list of doctor checks.
85
87
  * @throws {Error} When one or more failed checks contribute to the exit code under the active policy.
86
88
  */
@@ -2,6 +2,15 @@ import { CLI_DIAGNOSTIC_CODES, createCliCommandError, formatDoctorCheckLine, for
2
2
  import { getEnvironmentDoctorChecks } from "./cli-doctor-environment.js";
3
3
  import { getWorkspaceDoctorChecks } from "./cli-doctor-workspace.js";
4
4
  const DEFAULT_DOCTOR_EXIT_POLICY = "strict";
5
+ const defaultDoctorLinePrinter = (line) => {
6
+ process.stdout.write(`${line}\n`);
7
+ };
8
+ function renderDefaultDoctorCheckLine(check) {
9
+ defaultDoctorLinePrinter(formatDoctorCheckLine(check));
10
+ }
11
+ function renderDefaultDoctorSummaryLine(summaryLine) {
12
+ defaultDoctorLinePrinter(summaryLine);
13
+ }
5
14
  function annotateDoctorChecks(checks, scope) {
6
15
  return checks.map((check) => ({
7
16
  ...check,
@@ -92,14 +101,16 @@ export function createDoctorRunSummary(checks, options = {}) {
92
101
  * @param cwd Working directory to validate.
93
102
  * @param options Optional renderer overrides and exit-policy selection.
94
103
  * @param options.exitPolicy Policy deciding which failed checks contribute to the process exit code.
104
+ * @param options.renderLine Optional renderer for each check row. Defaults to the stdout line printer.
105
+ * @param options.renderSummaryLine Optional renderer for the summary row. Defaults to the stdout line printer unless a custom `renderLine` suppresses implicit summary output.
95
106
  * @returns The completed list of doctor checks.
96
107
  * @throws {Error} When one or more failed checks contribute to the exit code under the active policy.
97
108
  */
98
109
  export async function runDoctor(cwd, options = {}) {
99
110
  const exitPolicy = resolveDoctorExitPolicy(options);
100
- const renderLine = options.renderLine ?? ((check) => console.log(formatDoctorCheckLine(check)));
111
+ const renderLine = options.renderLine ?? renderDefaultDoctorCheckLine;
101
112
  const renderSummaryLine = options.renderSummaryLine ??
102
- (options.renderLine ? () => undefined : (summaryLine) => console.log(summaryLine));
113
+ (options.renderLine ? () => undefined : renderDefaultDoctorSummaryLine);
103
114
  const checks = await getDoctorChecks(cwd);
104
115
  for (const check of checks) {
105
116
  renderLine(check);
@@ -22,11 +22,13 @@ export function formatHelpText() {
22
22
  wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>]
23
23
  wp-typia add block <name> [--template <basic|interactivity|persistence|compound>] [--external-layer-source <./path|github:owner/repo/path[#ref]|npm-package>] [--external-layer-id <layer-id>] [--inner-blocks-preset <freeform|ordered|horizontal|locked-structure>] [--alternate-render-targets <email,mjml,plain-text>] [--data-storage <post-meta|custom-table>] [--persistence-policy <authenticated|public>]
24
24
  wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>]
25
+ wp-typia add core-variation <block-name> <name>
26
+ wp-typia add core-variation <name> --block <namespace/block>
25
27
  wp-typia add variation <name> --block <block-slug>
26
28
  wp-typia add style <name> --block <block-slug>
27
29
  wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>
28
- wp-typia add pattern <name>
29
- wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>]
30
+ wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>|--tag <tag>...] [--thumbnail-url <url>]
31
+ wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--from-post-meta|--post-meta <post-meta> [--meta-path <field>]]
30
32
  wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <method[,method...]>]
31
33
  wp-typia add rest-resource <name> --manual [--namespace <vendor/v1>] [--method <GET|POST|PUT|PATCH|DELETE>] [--auth <public|authenticated|public-write-protected>] [--path <route-pattern>|--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--query-type <Type>] [--body-type <Type>] [--response-type <Type>] [--secret-field <field>] [--secret-state-field|--secret-has-value-field <field>] [--secret-preserve-on-empty <true|false>]
32
34
  wp-typia add post-meta <name> --post-type <post-type> [--type <ExportedTypeName>] [--meta-key <meta-key>] [--hide-from-rest]
@@ -54,6 +56,7 @@ Notes:
54
56
  Use \`--template workspace\` as shorthand for \`@wp-typia/create-workspace-template\`, the official empty workspace scaffold behind \`wp-typia add ...\`.
55
57
  Use \`--profile plugin-qa\` with \`--template workspace\` when a plugin needs local wp-env smoke checks, \`.env.example\`, and release zip scripts from day one; omit it for the minimal workspace shell.
56
58
  Interactive add flows let you choose a template when \`--template\` is omitted; non-interactive runs default to \`basic\`.
59
+ Unknown \`core/*\` targets for \`add core-variation\` warn instead of failing so newer WordPress core blocks remain scaffoldable; third-party namespaces are allowed without local discovery.
57
60
  \`add admin-view\` scaffolds an opt-in DataViews-powered WordPress admin screen under \`src/admin-views/\`.
58
61
  Pass \`--source rest-resource:<slug>\` to reuse a list-capable REST resource.
59
62
  Pass \`--source core-data:postType/post\` or \`--source core-data:taxonomy/category\` to bind a WordPress-owned entity collection.
@@ -65,8 +68,8 @@ Notes:
65
68
  \`add variation\` uses an existing workspace block from \`scripts/block-config.ts\`.
66
69
  \`add style\` registers a Block Styles option for an existing generated block.
67
70
  \`add transform\` adds a block-to-block transform into an existing generated block.
68
- \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/\`.
69
- \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare a bindable generated-block attribute.
71
+ \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/full/\` or \`src/patterns/sections/\`; 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.
72
+ \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare a bindable generated-block attribute. Pass \`--from-post-meta\` or \`--post-meta\` to back the source from a typed post-meta contract and \`--meta-path\` to choose its default top-level field.
70
73
  \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`.
71
74
  \`add rest-resource --manual\` tracks an external/provider REST route with typed schemas, OpenAPI, clients, and drift checks without generating PHP route/controller files while still allowing route-owner metadata such as permission callbacks and controller classes. Settings contracts can add \`--secret-field\` plus \`--secret-preserve-on-empty\` to model write-only credentials and preserve blank submissions.
72
75
  \`add post-meta\` scaffolds typed post meta contracts under \`src/post-meta/\`, emits schema artifacts, and wires generated \`register_post_meta()\` helpers under \`inc/post-meta/\`.
@@ -7,7 +7,8 @@
7
7
  * and workspace-aware helpers such as `getWorkspaceBlockSelectOptions`,
8
8
  * `getWorkspaceBlockSelectOptionsAsync`,
9
9
  * `runAddBlockCommand`, `runAddBlockStyleCommand`,
10
- * `runAddBlockTransformCommand`, `runAddVariationCommand`,
10
+ * `runAddBlockTransformCommand`, `runAddCoreVariationCommand`,
11
+ * `runAddVariationCommand`,
11
12
  * `runAddPatternCommand`, `runAddBindingSourceCommand`,
12
13
  * `runAddEditorPluginCommand`,
13
14
  * `runAddAdminViewCommand`,
@@ -38,5 +39,7 @@ export { TEMPLATE_IDS, TEMPLATE_REGISTRY, getTemplateById, getTemplateSelectOpti
38
39
  export { EXTERNAL_TEMPLATE_CACHE_TTL_DAYS_ENV, pruneExternalTemplateCache, } from "./template-source-cache.js";
39
40
  export type { ExternalTemplateCachePruneOptions, ExternalTemplateCachePruneResult, } from "./template-source-cache.js";
40
41
  export { STALE_TEMP_ROOT_MAX_AGE_MS, WP_TYPIA_TEMP_ROOT_PREFIX, cleanupManagedTempRoot, cleanupStaleTempRoots, createManagedTempRoot, getTrackedTempRoots, } from "./temp-roots.js";
41
- export { createReadlinePrompt, createDoctorRunSummary, createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatAddHelpText, formatDoctorCheckLine, formatDoctorSummaryLine, formatHelpText, formatTemplateDetails, formatTemplateFeatures, formatTemplateSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, getDoctorFailureDetailLines, getFailingDoctorChecks, getNextSteps, getOptionalOnboarding, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, HOOKED_BLOCK_POSITION_IDS, EDITOR_PLUGIN_SLOT_IDS, isCliDiagnosticError, runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runDoctor, runAddVariationCommand, runScaffoldFlow, } from "./cli-core.js";
42
+ export { createReadlinePrompt, createDoctorRunSummary, createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatAddHelpText, formatDoctorCheckLine, formatDoctorSummaryLine, formatHelpText, formatTemplateDetails, formatTemplateFeatures, formatTemplateSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, getDoctorFailureDetailLines, getFailingDoctorChecks, getNextSteps, getOptionalOnboarding, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, HOOKED_BLOCK_POSITION_IDS, EDITOR_PLUGIN_SLOT_IDS, isCliDiagnosticError, runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runDoctor, runAddVariationCommand, runScaffoldFlow, } from "./cli-core.js";
43
+ export { extractPatternSectionRoleMatches, extractPatternSectionRolesFromAttributes, formatPatternCatalogDiagnostics, PATTERN_CATALOG_SCOPE_IDS, resolvePatternCatalogContentFile, validatePatternCatalog, } from "./pattern-catalog.js";
42
44
  export type { CliDiagnosticCode, CliDiagnosticCodeError, CliDiagnosticMessage, DoctorCheck, DoctorCheckScope, DoctorExitPolicy, DoctorFailureSummary, DoctorRunSummary, EditorPluginSlotId, HookedBlockPositionId, ReadlinePrompt, WorkspaceBlockSelectOption, } from "./cli-core.js";
45
+ export type { PatternCatalogDiagnostic, PatternCatalogDiagnosticCode, PatternCatalogDiagnosticSeverity, PatternCatalogEntry, PatternCatalogScope, PatternCatalogSectionRoleConvention, PatternCatalogSectionRoleMatch, PatternCatalogValidationOptions, PatternCatalogValidationResult, } from "./pattern-catalog.js";
@@ -7,7 +7,8 @@
7
7
  * and workspace-aware helpers such as `getWorkspaceBlockSelectOptions`,
8
8
  * `getWorkspaceBlockSelectOptionsAsync`,
9
9
  * `runAddBlockCommand`, `runAddBlockStyleCommand`,
10
- * `runAddBlockTransformCommand`, `runAddVariationCommand`,
10
+ * `runAddBlockTransformCommand`, `runAddCoreVariationCommand`,
11
+ * `runAddVariationCommand`,
11
12
  * `runAddPatternCommand`, `runAddBindingSourceCommand`,
12
13
  * `runAddEditorPluginCommand`,
13
14
  * `runAddAdminViewCommand`,
@@ -29,4 +30,5 @@ export { clearPackageVersionsCache, getPackageVersions, invalidatePackageVersion
29
30
  export { TEMPLATE_IDS, TEMPLATE_REGISTRY, getTemplateById, getTemplateSelectOptions, listTemplates, } from "./template-registry.js";
30
31
  export { EXTERNAL_TEMPLATE_CACHE_TTL_DAYS_ENV, pruneExternalTemplateCache, } from "./template-source-cache.js";
31
32
  export { STALE_TEMP_ROOT_MAX_AGE_MS, WP_TYPIA_TEMP_ROOT_PREFIX, cleanupManagedTempRoot, cleanupStaleTempRoots, createManagedTempRoot, getTrackedTempRoots, } from "./temp-roots.js";
32
- export { createReadlinePrompt, createDoctorRunSummary, createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatAddHelpText, formatDoctorCheckLine, formatDoctorSummaryLine, formatHelpText, formatTemplateDetails, formatTemplateFeatures, formatTemplateSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, getDoctorFailureDetailLines, getFailingDoctorChecks, getNextSteps, getOptionalOnboarding, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, HOOKED_BLOCK_POSITION_IDS, EDITOR_PLUGIN_SLOT_IDS, isCliDiagnosticError, runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runDoctor, runAddVariationCommand, runScaffoldFlow, } from "./cli-core.js";
33
+ export { createReadlinePrompt, createDoctorRunSummary, createCliCommandError, createCliDiagnosticCodeError, CliDiagnosticError, CLI_DIAGNOSTIC_CODES, formatCliDiagnosticError, formatAddHelpText, formatDoctorCheckLine, formatDoctorSummaryLine, formatHelpText, formatTemplateDetails, formatTemplateFeatures, formatTemplateSummary, getDoctorChecks, getDoctorExitFailureChecks, getDoctorExitFailureDetailLines, getDoctorFailureDetailLines, getFailingDoctorChecks, getNextSteps, getOptionalOnboarding, getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, HOOKED_BLOCK_POSITION_IDS, EDITOR_PLUGIN_SLOT_IDS, isCliDiagnosticError, runAddAdminViewCommand, runAddAbilityCommand, runAddAiFeatureCommand, runAddBindingSourceCommand, runAddBlockCommand, runAddBlockStyleCommand, runAddBlockTransformCommand, runAddCoreVariationCommand, runAddEditorPluginCommand, runAddHookedBlockCommand, runAddPatternCommand, runAddPostMetaCommand, runDoctor, runAddVariationCommand, runScaffoldFlow, } from "./cli-core.js";
34
+ export { extractPatternSectionRoleMatches, extractPatternSectionRolesFromAttributes, formatPatternCatalogDiagnostics, PATTERN_CATALOG_SCOPE_IDS, resolvePatternCatalogContentFile, validatePatternCatalog, } from "./pattern-catalog.js";
@@ -4,11 +4,8 @@
4
4
  * File-backed runtime JSON readers should use `safeJsonParse`,
5
5
  * `readJsonFileSync`, or `readJsonFile` so malformed JSON reports the file path
6
6
  * and operation context. Raw `JSON.parse` remains intentional for trusted
7
- * in-memory clones, subprocess output, test fixtures, generated workspace
8
- * script templates that embed their own path-aware parse handling,
9
- * package-version manifest cache probes with colocated path-aware wrappers,
10
- * and cache/discovery probes that immediately catch malformed documents to
11
- * continue with fallback behavior.
7
+ * in-memory clones, subprocess output, test fixtures, and generated workspace
8
+ * script templates that embed their own path-aware parse handling.
12
9
  *
13
10
  * This module keeps `cloneJsonValue` local instead of re-exporting the
14
11
  * block-runtime helper so Bunli CLI bundles that only need project-tools JSON
@@ -6,11 +6,8 @@ import { promises as fsp } from "node:fs";
6
6
  * File-backed runtime JSON readers should use `safeJsonParse`,
7
7
  * `readJsonFileSync`, or `readJsonFile` so malformed JSON reports the file path
8
8
  * and operation context. Raw `JSON.parse` remains intentional for trusted
9
- * in-memory clones, subprocess output, test fixtures, generated workspace
10
- * script templates that embed their own path-aware parse handling,
11
- * package-version manifest cache probes with colocated path-aware wrappers,
12
- * and cache/discovery probes that immediately catch malformed documents to
13
- * continue with fallback behavior.
9
+ * in-memory clones, subprocess output, test fixtures, and generated workspace
10
+ * script templates that embed their own path-aware parse handling.
14
11
  *
15
12
  * This module keeps `cloneJsonValue` local instead of re-exporting the
16
13
  * block-runtime helper so Bunli CLI bundles that only need project-tools JSON
@@ -8,6 +8,7 @@ import fs from "node:fs";
8
8
  import { promises as fsp } from "node:fs";
9
9
  import path from "node:path";
10
10
  import { formatRunScript, } from "./package-managers.js";
11
+ import { DEFAULT_WORDPRESS_ENV_VERSION } from "./package-versions.js";
11
12
  import { readJsonFile } from "./json-utils.js";
12
13
  import { OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE, SHARED_TEST_PRESET_TEMPLATE_ROOT, SHARED_WP_ENV_PRESET_TEMPLATE_ROOT, } from "./template-registry.js";
13
14
  import { copyInterpolatedDirectory } from "./template-render.js";
@@ -106,7 +107,7 @@ export async function applyGeneratedProjectDxPackageJson({ compoundPersistenceEn
106
107
  : {}),
107
108
  };
108
109
  if (withWpEnv || withTestPreset) {
109
- packageJson.devDependencies["@wordpress/env"] = "^11.2.0";
110
+ packageJson.devDependencies["@wordpress/env"] = DEFAULT_WORDPRESS_ENV_VERSION;
110
111
  }
111
112
  if (withTestPreset) {
112
113
  packageJson.devDependencies["@playwright/test"] = "^1.54.2";
@@ -23,6 +23,7 @@ export declare const DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION = "^0.9.0";
23
23
  export declare const DEFAULT_WORDPRESS_CORE_DATA_VERSION = "^7.44.0";
24
24
  export declare const DEFAULT_WORDPRESS_DATA_VERSION = "^9.28.0";
25
25
  export declare const DEFAULT_WORDPRESS_DATAVIEWS_VERSION = "^14.1.0";
26
+ export declare const DEFAULT_WORDPRESS_ENV_VERSION = "^11.2.0";
26
27
  export declare const DEFAULT_WP_TYPIA_DATAVIEWS_VERSION = "^0.1.1";
27
28
  /**
28
29
  * Resolve a managed package version range from linked workspace packages first,
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import path from 'node:path';
4
4
  import { getOptionalNodeErrorCode } from './fs-async.js';
5
+ import { safeJsonParse } from './json-utils.js';
5
6
  import { PROJECT_TOOLS_PACKAGE_ROOT } from './template-registry.js';
6
7
  const require = createRequire(import.meta.url);
7
8
  const DEFAULT_VERSION_RANGE = '^0.0.0';
@@ -20,6 +21,7 @@ export const DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION = '^0.9.0';
20
21
  export const DEFAULT_WORDPRESS_CORE_DATA_VERSION = '^7.44.0';
21
22
  export const DEFAULT_WORDPRESS_DATA_VERSION = '^9.28.0';
22
23
  export const DEFAULT_WORDPRESS_DATAVIEWS_VERSION = '^14.1.0';
24
+ export const DEFAULT_WORDPRESS_ENV_VERSION = '^11.2.0';
23
25
  export const DEFAULT_WP_TYPIA_DATAVIEWS_VERSION = '^0.1.1';
24
26
  let cachedPackageVersions = null;
25
27
  function normalizeVersionRange(value) {
@@ -92,12 +94,10 @@ function readPackageManifest(location) {
92
94
  if (!location.packageJsonPath || location.source === null) {
93
95
  return null;
94
96
  }
95
- try {
96
- return JSON.parse(location.source);
97
- }
98
- catch (error) {
99
- throw new Error(`Failed to parse package version manifest at ${location.packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`);
100
- }
97
+ return safeJsonParse(location.source, {
98
+ context: 'package version manifest',
99
+ filePath: location.packageJsonPath,
100
+ });
101
101
  }
102
102
  function tryReadPackageManifest(location) {
103
103
  if (!location) {
@@ -175,6 +175,7 @@ export function getPackageVersions() {
175
175
  const createManifestLocation = resolvePackageManifestLocation(path.join(PROJECT_TOOLS_PACKAGE_ROOT, 'package.json'));
176
176
  const monorepoManifestLocation = resolvePackageManifestLocation(path.join(PROJECT_TOOLS_PACKAGE_ROOT, '..', '..', 'package.json'));
177
177
  const blockRuntimeManifestLocation = resolvePackageManifestLocation(path.join(PROJECT_TOOLS_PACKAGE_ROOT, '..', 'wp-typia-block-runtime', 'package.json'));
178
+ const blockTypesManifestLocation = resolvePackageManifestLocation(path.join(PROJECT_TOOLS_PACKAGE_ROOT, '..', 'wp-typia-block-types', 'package.json'));
178
179
  const wpTypiaManifestLocation = resolvePackageManifestLocation(path.join(PROJECT_TOOLS_PACKAGE_ROOT, '..', 'wp-typia', 'package.json'));
179
180
  const installedProjectToolsManifestLocation = resolveInstalledPackageManifestLocation('@wp-typia/project-tools');
180
181
  const installedApiClientManifestLocation = resolveInstalledPackageManifestLocation('@wp-typia/api-client');
@@ -190,6 +191,7 @@ export function getPackageVersions() {
190
191
  createManifestLocation,
191
192
  monorepoManifestLocation,
192
193
  blockRuntimeManifestLocation,
194
+ blockTypesManifestLocation,
193
195
  wpTypiaManifestLocation,
194
196
  installedProjectToolsManifestLocation,
195
197
  installedApiClientManifestLocation,
@@ -212,18 +214,23 @@ export function getPackageVersions() {
212
214
  const blockRuntimeManifest = readPackageManifest(blockRuntimeManifestLocation) ??
213
215
  readPackageManifest(installedBlockRuntimeManifestLocation) ??
214
216
  {};
217
+ const blockTypesManifest = readPackageManifest(blockTypesManifestLocation) ??
218
+ readPackageManifest(installedBlockTypesManifestLocation) ??
219
+ {};
215
220
  const wpTypiaManifest = readPackageManifest(wpTypiaManifestLocation) ??
216
221
  readPackageManifest(installedWpTypiaManifestLocation) ??
217
222
  {};
218
223
  const blockRuntimeDependencyVersion = normalizeVersionRange(createManifest.dependencies?.['@wp-typia/block-runtime']);
224
+ const blockTypesDependencyVersion = normalizeVersionRange(createManifest.dependencies?.['@wp-typia/block-types']);
219
225
  const versions = {
220
226
  apiClientPackageVersion: normalizeVersionRange(createManifest.dependencies?.['@wp-typia/api-client'] ??
221
227
  readPackageManifest(installedApiClientManifestLocation)?.version),
222
228
  blockRuntimePackageVersion: blockRuntimeDependencyVersion !== DEFAULT_VERSION_RANGE
223
229
  ? blockRuntimeDependencyVersion
224
230
  : normalizeVersionRange(blockRuntimeManifest.version),
225
- blockTypesPackageVersion: normalizeVersionRange(createManifest.dependencies?.['@wp-typia/block-types'] ??
226
- readPackageManifest(installedBlockTypesManifestLocation)?.version),
231
+ blockTypesPackageVersion: blockTypesDependencyVersion !== DEFAULT_VERSION_RANGE
232
+ ? blockTypesDependencyVersion
233
+ : normalizeVersionRange(blockTypesManifest.version),
227
234
  projectToolsPackageVersion: normalizeVersionRange(createManifest.version),
228
235
  restPackageVersion: normalizeVersionRange(createManifest.dependencies?.['@wp-typia/rest'] ??
229
236
  readPackageManifest(installedRestManifestLocation)?.version),
@@ -0,0 +1,101 @@
1
+ import { type ParsedBlockPatternBlock } from "@wp-typia/block-runtime/metadata-core";
2
+ import type { PatternCatalogDiagnostic, PatternCatalogEntry } from "./pattern-catalog.js";
3
+ /**
4
+ * Validates section role slugs used by pattern manifests and content markers.
5
+ */
6
+ export declare const PATTERN_SECTION_ROLE_PATTERN: RegExp;
7
+ /**
8
+ * Convention used to discover section role markers in serialized pattern
9
+ * content. Defaults target `core/group` wrappers with a `section` base class,
10
+ * `section--{role}` role class tokens, and `metadata.sectionRole` attributes.
11
+ */
12
+ export type PatternCatalogSectionRoleConvention = {
13
+ /**
14
+ * Serialized block name used as the section wrapper. Defaults to
15
+ * `core/group`.
16
+ */
17
+ wrapperBlockName?: string;
18
+ /**
19
+ * Optional class that marks a wrapper block as section-like even when the
20
+ * role marker is missing. Defaults to `section`.
21
+ */
22
+ baseClassName?: string;
23
+ /**
24
+ * Class token pattern where exactly one `{role}` placeholder is replaced by
25
+ * the section role slug. Defaults to `section--{role}`.
26
+ */
27
+ roleClassNamePattern?: string;
28
+ /**
29
+ * Dot-separated block attribute paths that can carry role slugs. Defaults to
30
+ * `metadata.sectionRole`.
31
+ */
32
+ roleAttributePaths?: readonly string[];
33
+ /**
34
+ * Warn when a full pattern repeats the same section role marker. Defaults to
35
+ * `false`.
36
+ */
37
+ requireUniqueFullPatternRoles?: boolean;
38
+ };
39
+ /**
40
+ * Section wrapper match extracted from a parsed WordPress block tree.
41
+ */
42
+ export type PatternCatalogSectionRoleMatch = {
43
+ blockName: string;
44
+ blockPath: string;
45
+ roles: readonly string[];
46
+ };
47
+ /**
48
+ * Fully resolved section-role marker convention with its compiled class matcher.
49
+ */
50
+ export type NormalizedPatternCatalogSectionRoleConvention = Required<PatternCatalogSectionRoleConvention> & {
51
+ /**
52
+ * Compiled matcher for role class tokens produced from `roleClassNamePattern`.
53
+ */
54
+ roleClassNamePatternRegExp: RegExp;
55
+ };
56
+ /**
57
+ * Resolve a section-role convention and compile its class-token matcher.
58
+ *
59
+ * @param convention Optional marker convention override.
60
+ * @returns A fully populated convention ready for repeated block traversal.
61
+ * @throws When `roleClassNamePattern` does not contain exactly one `{role}` placeholder.
62
+ */
63
+ export declare function normalizePatternCatalogSectionRoleConvention(convention?: PatternCatalogSectionRoleConvention): NormalizedPatternCatalogSectionRoleConvention;
64
+ /**
65
+ * Extract section role slugs from serialized block attributes using the
66
+ * configured class and metadata marker convention.
67
+ *
68
+ * @param attributes Parsed block attributes from serialized pattern content.
69
+ * @param convention Optional marker convention override.
70
+ * @returns Unique role marker values in discovery order.
71
+ */
72
+ export declare function extractPatternSectionRolesFromAttributes(attributes: Record<string, unknown>, convention?: PatternCatalogSectionRoleConvention): string[];
73
+ /**
74
+ * Find section wrapper blocks and their role markers in parsed pattern content.
75
+ *
76
+ * @param blocks Parsed block tree returned by `validateBlockPatternContentNesting`.
77
+ * @param convention Optional marker convention override.
78
+ * @returns Section wrapper matches with serialized block paths.
79
+ */
80
+ export declare function extractPatternSectionRoleMatches(blocks: readonly ParsedBlockPatternBlock[], convention?: PatternCatalogSectionRoleConvention): PatternCatalogSectionRoleMatch[];
81
+ /**
82
+ * Build the known valid section-role set from pattern catalog entries.
83
+ *
84
+ * @param patterns Catalog entries that may declare a `sectionRole`.
85
+ * @returns Valid section role slugs declared by the catalog.
86
+ */
87
+ export declare function collectKnownPatternSectionRoles(patterns: readonly Pick<PatternCatalogEntry, "sectionRole">[]): ReadonlySet<string>;
88
+ /**
89
+ * Validate serialized pattern content against the catalog section-role rules.
90
+ *
91
+ * @param options Pattern content, marker convention, known roles, and diagnostic context.
92
+ * @returns Diagnostics for invalid, missing, mismatched, unknown, or duplicate section-role markers.
93
+ */
94
+ export declare function validatePatternContentSectionRoles({ content, contentFile, convention, knownSectionRoles, label, pattern, }: {
95
+ content: string;
96
+ contentFile: string;
97
+ convention: NormalizedPatternCatalogSectionRoleConvention;
98
+ knownSectionRoles: ReadonlySet<string>;
99
+ label: string;
100
+ pattern: PatternCatalogEntry;
101
+ }): PatternCatalogDiagnostic[];