@wp-typia/project-tools 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/runtime/ai-feature-artifacts.js +4 -1
  2. package/dist/runtime/block-generator-service-spec.js +2 -1
  3. package/dist/runtime/built-in-block-non-ts-basic-artifacts.d.ts +9 -0
  4. package/dist/runtime/built-in-block-non-ts-basic-artifacts.js +84 -0
  5. package/dist/runtime/built-in-block-non-ts-compound-artifacts.d.ts +9 -0
  6. package/dist/runtime/built-in-block-non-ts-compound-artifacts.js +36 -0
  7. package/dist/runtime/built-in-block-non-ts-compound-templates.d.ts +23 -0
  8. package/dist/runtime/built-in-block-non-ts-compound-templates.js +453 -0
  9. package/dist/runtime/built-in-block-non-ts-family-artifacts.d.ts +8 -26
  10. package/dist/runtime/built-in-block-non-ts-family-artifacts.js +8 -1034
  11. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.d.ts +9 -0
  12. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.js +83 -0
  13. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.d.ts +9 -0
  14. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.js +33 -0
  15. package/dist/runtime/built-in-block-non-ts-persistence-templates.d.ts +23 -0
  16. package/dist/runtime/built-in-block-non-ts-persistence-templates.js +395 -0
  17. package/dist/runtime/cli-add-block-json.js +5 -1
  18. package/dist/runtime/cli-add-collision.js +8 -0
  19. package/dist/runtime/cli-add-help.js +14 -10
  20. package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
  21. package/dist/runtime/cli-add-kind-ids.js +1 -0
  22. package/dist/runtime/cli-add-types.d.ts +45 -6
  23. package/dist/runtime/cli-add-types.js +2 -0
  24. package/dist/runtime/cli-add-validation.d.ts +7 -0
  25. package/dist/runtime/cli-add-validation.js +9 -0
  26. package/dist/runtime/cli-add-workspace-ability-anchors.d.ts +24 -0
  27. package/dist/runtime/cli-add-workspace-ability-anchors.js +294 -0
  28. package/dist/runtime/cli-add-workspace-ability-registry.d.ts +10 -0
  29. package/dist/runtime/cli-add-workspace-ability-registry.js +51 -0
  30. package/dist/runtime/cli-add-workspace-ability-scaffold.d.ts +1 -1
  31. package/dist/runtime/cli-add-workspace-ability-scaffold.js +5 -308
  32. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +6 -2
  33. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  34. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  35. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  36. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  37. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  38. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  39. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  40. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  41. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  42. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  43. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
  44. package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
  45. package/dist/runtime/cli-add-workspace-ai-anchors.d.ts +4 -4
  46. package/dist/runtime/cli-add-workspace-ai-anchors.js +8 -233
  47. package/dist/runtime/cli-add-workspace-ai-scaffold.js +4 -2
  48. package/dist/runtime/cli-add-workspace-ai-source-emitters.d.ts +1 -4
  49. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +1 -129
  50. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.d.ts +5 -0
  51. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.js +236 -0
  52. package/dist/runtime/cli-add-workspace-ai-sync-script-source.d.ts +4 -0
  53. package/dist/runtime/cli-add-workspace-ai-sync-script-source.js +145 -0
  54. package/dist/runtime/cli-add-workspace-assets.d.ts +6 -63
  55. package/dist/runtime/cli-add-workspace-assets.js +6 -950
  56. package/dist/runtime/cli-add-workspace-binding-source-anchors.d.ts +23 -0
  57. package/dist/runtime/cli-add-workspace-binding-source-anchors.js +112 -0
  58. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.d.ts +33 -0
  59. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.js +436 -0
  60. package/dist/runtime/cli-add-workspace-binding-source-types.d.ts +20 -0
  61. package/dist/runtime/cli-add-workspace-binding-source-types.js +1 -0
  62. package/dist/runtime/cli-add-workspace-binding-source.d.ts +40 -0
  63. package/dist/runtime/cli-add-workspace-binding-source.js +275 -0
  64. package/dist/runtime/cli-add-workspace-block-style.d.ts +22 -0
  65. package/dist/runtime/cli-add-workspace-block-style.js +148 -0
  66. package/dist/runtime/cli-add-workspace-block-transform.d.ts +32 -0
  67. package/dist/runtime/cli-add-workspace-block-transform.js +197 -0
  68. package/dist/runtime/cli-add-workspace-contract.js +1 -1
  69. package/dist/runtime/cli-add-workspace-core-variation.d.ts +20 -0
  70. package/dist/runtime/cli-add-workspace-core-variation.js +322 -0
  71. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.d.ts +37 -0
  72. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.js +206 -0
  73. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.d.ts +47 -0
  74. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.js +219 -0
  75. package/dist/runtime/cli-add-workspace-editor-plugin.d.ts +22 -0
  76. package/dist/runtime/cli-add-workspace-editor-plugin.js +78 -0
  77. package/dist/runtime/cli-add-workspace-hooked-block.d.ts +23 -0
  78. package/dist/runtime/cli-add-workspace-hooked-block.js +57 -0
  79. package/dist/runtime/cli-add-workspace-integration-env-files.d.ts +33 -0
  80. package/dist/runtime/cli-add-workspace-integration-env-files.js +65 -0
  81. package/dist/runtime/cli-add-workspace-integration-env-package-json.d.ts +38 -0
  82. package/dist/runtime/cli-add-workspace-integration-env-package-json.js +122 -0
  83. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.d.ts +44 -0
  84. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.js +262 -0
  85. package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
  86. package/dist/runtime/cli-add-workspace-integration-env.js +10 -313
  87. package/dist/runtime/cli-add-workspace-pattern-anchors.d.ts +10 -0
  88. package/dist/runtime/cli-add-workspace-pattern-anchors.js +95 -0
  89. package/dist/runtime/cli-add-workspace-pattern-options.d.ts +20 -0
  90. package/dist/runtime/cli-add-workspace-pattern-options.js +113 -0
  91. package/dist/runtime/cli-add-workspace-pattern-source-emitters.d.ts +20 -0
  92. package/dist/runtime/cli-add-workspace-pattern-source-emitters.js +57 -0
  93. package/dist/runtime/cli-add-workspace-pattern.d.ts +42 -0
  94. package/dist/runtime/cli-add-workspace-pattern.js +99 -0
  95. package/dist/runtime/cli-add-workspace-post-meta.js +1 -1
  96. package/dist/runtime/cli-add-workspace-registration-hooks.d.ts +50 -0
  97. package/dist/runtime/cli-add-workspace-registration-hooks.js +162 -0
  98. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +9 -4
  99. package/dist/runtime/cli-add-workspace-rest-anchors.js +9 -428
  100. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.d.ts +17 -0
  101. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.js +108 -0
  102. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.d.ts +9 -0
  103. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.js +142 -0
  104. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.d.ts +51 -0
  105. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.js +415 -0
  106. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  107. package/dist/runtime/cli-add-workspace-rest-generated.js +160 -0
  108. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.d.ts +80 -0
  109. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.js +238 -0
  110. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  111. package/dist/runtime/cli-add-workspace-rest-manual.js +266 -0
  112. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +18 -0
  113. package/dist/runtime/cli-add-workspace-rest-php-templates.js +359 -0
  114. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.d.ts +33 -0
  115. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.js +145 -0
  116. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.d.ts +9 -0
  117. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.js +162 -0
  118. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.d.ts +7 -0
  119. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.js +193 -0
  120. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +5 -91
  121. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +5 -642
  122. package/dist/runtime/cli-add-workspace-rest-source-utils.d.ts +17 -0
  123. package/dist/runtime/cli-add-workspace-rest-source-utils.js +50 -0
  124. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.d.ts +56 -0
  125. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.js +122 -0
  126. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  127. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  128. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
  129. package/dist/runtime/cli-add-workspace-rest.js +33 -788
  130. package/dist/runtime/cli-add-workspace-variation.d.ts +22 -0
  131. package/dist/runtime/cli-add-workspace-variation.js +162 -0
  132. package/dist/runtime/cli-add-workspace.d.ts +42 -107
  133. package/dist/runtime/cli-add-workspace.js +42 -674
  134. package/dist/runtime/cli-add.d.ts +3 -3
  135. package/dist/runtime/cli-add.js +2 -2
  136. package/dist/runtime/cli-core.d.ts +3 -2
  137. package/dist/runtime/cli-core.js +2 -2
  138. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  139. package/dist/runtime/cli-diagnostics.js +17 -5
  140. package/dist/runtime/cli-doctor-workspace-bindings.js +63 -1
  141. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  142. package/dist/runtime/cli-doctor-workspace-block-addons.js +162 -0
  143. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  144. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  145. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  146. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  147. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  148. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  149. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  150. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  151. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  152. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  153. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  154. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  155. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  156. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  157. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  158. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  159. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  160. package/dist/runtime/cli-doctor-workspace-features.js +14 -487
  161. package/dist/runtime/cli-doctor.d.ts +54 -3
  162. package/dist/runtime/cli-doctor.js +92 -10
  163. package/dist/runtime/cli-help.js +12 -7
  164. package/dist/runtime/cli-init-package-json.js +4 -2
  165. package/dist/runtime/cli-prompt.d.ts +16 -2
  166. package/dist/runtime/cli-prompt.js +29 -12
  167. package/dist/runtime/cli-scaffold.d.ts +2 -1
  168. package/dist/runtime/cli-scaffold.js +19 -10
  169. package/dist/runtime/external-template-guards.js +4 -6
  170. package/dist/runtime/index.d.ts +6 -3
  171. package/dist/runtime/index.js +4 -2
  172. package/dist/runtime/json-utils.d.ts +62 -4
  173. package/dist/runtime/json-utils.js +78 -4
  174. package/dist/runtime/local-dev-presets.js +6 -2
  175. package/dist/runtime/migration-ui-capability.js +4 -1
  176. package/dist/runtime/migration-utils.js +4 -1
  177. package/dist/runtime/package-managers.js +6 -1
  178. package/dist/runtime/package-versions.d.ts +1 -0
  179. package/dist/runtime/package-versions.js +16 -3
  180. package/dist/runtime/pattern-catalog.d.ts +122 -0
  181. package/dist/runtime/pattern-catalog.js +471 -0
  182. package/dist/runtime/post-meta-binding-fields.d.ts +46 -0
  183. package/dist/runtime/post-meta-binding-fields.js +135 -0
  184. package/dist/runtime/scaffold-bootstrap.js +7 -2
  185. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  186. package/dist/runtime/scaffold-repository-reference.js +4 -2
  187. package/dist/runtime/scaffold-template-variables.js +2 -1
  188. package/dist/runtime/scaffold.d.ts +18 -1
  189. package/dist/runtime/scaffold.js +55 -2
  190. package/dist/runtime/temp-roots.js +4 -1
  191. package/dist/runtime/template-layers.js +4 -1
  192. package/dist/runtime/template-registry.js +9 -3
  193. package/dist/runtime/template-source-contracts.d.ts +2 -0
  194. package/dist/runtime/template-source-normalization.js +2 -1
  195. package/dist/runtime/template-source-remote.js +18 -5
  196. package/dist/runtime/template-source-seeds.js +10 -3
  197. package/dist/runtime/typia-llm-json-schema.d.ts +24 -0
  198. package/dist/runtime/typia-llm-json-schema.js +33 -0
  199. package/dist/runtime/typia-llm-openapi-constraints.d.ts +20 -0
  200. package/dist/runtime/typia-llm-openapi-constraints.js +254 -0
  201. package/dist/runtime/typia-llm-projection.d.ts +25 -0
  202. package/dist/runtime/typia-llm-projection.js +58 -0
  203. package/dist/runtime/typia-llm-render.d.ts +21 -0
  204. package/dist/runtime/typia-llm-render.js +252 -0
  205. package/dist/runtime/typia-llm-sync.d.ts +10 -0
  206. package/dist/runtime/typia-llm-sync.js +63 -0
  207. package/dist/runtime/typia-llm-types.d.ts +197 -0
  208. package/dist/runtime/typia-llm-types.js +1 -0
  209. package/dist/runtime/typia-llm.d.ts +9 -255
  210. package/dist/runtime/typia-llm.js +5 -634
  211. package/dist/runtime/workspace-inventory-mutations.js +15 -1
  212. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  213. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  214. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  215. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  216. package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
  217. package/dist/runtime/workspace-inventory-parser.js +3 -581
  218. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  219. package/dist/runtime/workspace-inventory-section-descriptors.js +443 -0
  220. package/dist/runtime/workspace-inventory-templates.d.ts +3 -3
  221. package/dist/runtime/workspace-inventory-templates.js +10 -1
  222. package/dist/runtime/workspace-inventory-types.d.ts +10 -1
  223. package/dist/runtime/workspace-project.js +4 -6
  224. package/package.json +8 -3
  225. package/templates/_shared/compound/core/scripts/block-config.ts.mustache +22 -0
  226. package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +103 -2
  227. package/templates/_shared/compound/core/src/inner-blocks-templates.ts.mustache +13 -0
  228. 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";
@@ -30,10 +30,11 @@
30
30
  * `getTemplateSelectOptions`, `listTemplates`, and `isBuiltInTemplateId` for
31
31
  * template inspection flows.
32
32
  */
33
- export { getDoctorChecks, runDoctor, type DoctorCheck } from "./cli-doctor.js";
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";
@@ -30,9 +30,9 @@
30
30
  * `getTemplateSelectOptions`, `listTemplates`, and `isBuiltInTemplateId` for
31
31
  * template inspection flows.
32
32
  */
33
- export { getDoctorChecks, runDoctor } from "./cli-doctor.js";
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";
@@ -160,7 +160,9 @@ export declare function getFailingDoctorChecks<TCheck extends DoctorCheckLike>(c
160
160
  /**
161
161
  * Format the final doctor summary row.
162
162
  */
163
- export declare function formatDoctorSummaryLine(checks: readonly DoctorCheckLike[]): string;
163
+ export declare function formatDoctorSummaryLine(checks: readonly DoctorCheckLike[], options?: {
164
+ exitFailureChecks?: readonly DoctorCheckLike[];
165
+ }): string;
164
166
  /**
165
167
  * Build detail lines for doctor failures so the non-interactive formatter can
166
168
  * restate the failed checks after the streaming rows.
@@ -228,9 +228,14 @@ export function createCliDiagnosticCodeError(code, message, options) {
228
228
  }
229
229
  /**
230
230
  * Compatibility-only fallback for legacy or third-party errors that have not
231
- * yet been tagged by their throw site. New user-facing failures should pass an
232
- * explicit code through `createCliDiagnosticCodeError()` or
233
- * `createCliCommandError({ code })` instead of relying on message matching.
231
+ * yet been tagged by their throw site.
232
+ *
233
+ * The regexes below intentionally couple this classifier to existing
234
+ * project-tools runtime validation messages. Treat them as compatibility shims:
235
+ * changing a validation message can silently change, downgrade, or remove the
236
+ * inferred diagnostic code. New user-facing runtime validation failures should
237
+ * pass an explicit code through `createCliDiagnosticCodeError()` or
238
+ * `createCliCommandError({ code })` instead of adding new message patterns.
234
239
  */
235
240
  function inferCliDiagnosticCode(options) {
236
241
  const inheritedCode = readCliDiagnosticCode(options.error);
@@ -362,12 +367,19 @@ export function getFailingDoctorChecks(checks) {
362
367
  /**
363
368
  * Format the final doctor summary row.
364
369
  */
365
- export function formatDoctorSummaryLine(checks) {
370
+ export function formatDoctorSummaryLine(checks, options = {}) {
366
371
  const failedChecks = getFailingDoctorChecks(checks);
372
+ const exitFailureChecks = options.exitFailureChecks ?? failedChecks;
373
+ const advisoryFailureCount = failedChecks.length - exitFailureChecks.length;
367
374
  const warningCount = checks.filter((check) => check.status === "warn").length;
368
- const summaryStatus = failedChecks.length > 0 ? "FAIL" : warningCount > 0 ? "WARN" : "PASS";
375
+ const summaryStatus = exitFailureChecks.length > 0
376
+ ? "FAIL"
377
+ : advisoryFailureCount > 0 || warningCount > 0
378
+ ? "WARN"
379
+ : "PASS";
369
380
  return formatWrappedPrefixedLine(`${summaryStatus} wp-typia doctor summary: `, [
370
381
  `${checks.length - failedChecks.length - warningCount}/${checks.length} checks passed`,
382
+ advisoryFailureCount > 0 ? `${advisoryFailureCount} advisory failure(s)` : null,
371
383
  warningCount > 0 ? `${warningCount} warning(s)` : null,
372
384
  ]
373
385
  .filter((detail) => detail !== null)
@@ -2,7 +2,9 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  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
+ import { readJsonFileSync } from "./json-utils.js";
5
6
  import { escapeRegex } from "./php-utils.js";
7
+ import { assertPostMetaBindingPath, loadPostMetaBindingFieldsSync, } from "./post-meta-binding-fields.js";
6
8
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
7
9
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
8
10
  if (!fs.existsSync(bootstrapPath)) {
@@ -45,7 +47,9 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
45
47
  const blockJsonPath = path.join(projectDir, blockJsonRelativePath);
46
48
  const issues = [];
47
49
  try {
48
- const blockJson = parseScaffoldBlockMetadata(JSON.parse(fs.readFileSync(blockJsonPath, "utf8")));
50
+ const blockJson = parseScaffoldBlockMetadata(readJsonFileSync(blockJsonPath, {
51
+ context: "workspace block metadata",
52
+ }));
49
53
  const attributes = blockJson.attributes;
50
54
  if (!attributes || typeof attributes !== "object" || Array.isArray(attributes)) {
51
55
  issues.push(`${blockJsonRelativePath} must define an attributes object`);
@@ -105,6 +109,60 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
105
109
  ? `${bindingSource.block}.${bindingSource.attribute} is declared and supported`
106
110
  : issues.join("; "));
107
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
+ }
108
166
  /**
109
167
  * Collect workspace doctor checks for extracted binding-source diagnostics.
110
168
  *
@@ -128,6 +186,10 @@ export function getWorkspaceBindingDoctorChecks(workspace, inventory) {
128
186
  if (bindingTargetCheck) {
129
187
  checks.push(bindingTargetCheck);
130
188
  }
189
+ const bindingPostMetaCheck = checkWorkspaceBindingPostMeta(workspace.projectDir, inventory, bindingSource);
190
+ if (bindingPostMetaCheck) {
191
+ checks.push(bindingPostMetaCheck);
192
+ }
131
193
  }
132
194
  return checks;
133
195
  }
@@ -0,0 +1,12 @@
1
+ import type { DoctorCheck } from "./cli-doctor.js";
2
+ import type { WorkspaceInventory } from "./workspace-inventory.js";
3
+ import type { WorkspaceProject } from "./workspace-project.js";
4
+ /**
5
+ * Collect variation, block style, transform, and pattern doctor checks.
6
+ *
7
+ * @param workspace Resolved workspace metadata and filesystem paths.
8
+ * @param inventory Parsed workspace inventory from `scripts/block-config.ts`.
9
+ * @param registeredBlockSlugs Block slugs already declared in the inventory.
10
+ * @returns Ordered add-on and pattern doctor checks.
11
+ */
12
+ export declare function getWorkspaceBlockAddonDoctorChecks(workspace: WorkspaceProject, inventory: WorkspaceInventory, registeredBlockSlugs: ReadonlySet<string>): DoctorCheck[];
@@ -0,0 +1,162 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
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";
5
+ import { hasExecutablePattern, hasUncommentedPattern, } from "./ts-source-masking.js";
6
+ const WORKSPACE_VARIATIONS_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspaceVariations\s*\}\s*from\s*["']\.\/variations["']\s*;?\s*$/mu;
7
+ const WORKSPACE_VARIATIONS_CALL_PATTERN = /registerWorkspaceVariations\s*\(\s*\)\s*;?/u;
8
+ const WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspaceBlockStyles\s*\}\s*from\s*["']\.\/styles["']\s*;?\s*$/mu;
9
+ const WORKSPACE_BLOCK_STYLES_CALL_PATTERN = /registerWorkspaceBlockStyles\s*\(\s*\)\s*;?/u;
10
+ const WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN = /^\s*import\s*\{\s*applyWorkspaceBlockTransforms\s*\}\s*from\s*["']\.\/transforms["']\s*;?\s*$/mu;
11
+ const WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN = /applyWorkspaceBlockTransforms\s*\(\s*registration\s*\.\s*settings\s*\)\s*;?/u;
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) {
21
+ const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
22
+ if (!fs.existsSync(bootstrapPath)) {
23
+ return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${path.basename(bootstrapPath)}`);
24
+ }
25
+ const source = fs.readFileSync(bootstrapPath, "utf8");
26
+ const hasCategoryAnchor = source.includes("register_block_pattern_category");
27
+ const hasPatternGlob = source.includes("/src/patterns/*.php");
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
31
+ ? "Pattern category and loader hooks are present"
32
+ : requiresNestedPatternGlob
33
+ ? "Missing pattern category registration or nested src/patterns loader hook"
34
+ : "Missing pattern category registration or src/patterns loader hook");
35
+ }
36
+ function checkVariationEntrypoint(projectDir, blockSlug) {
37
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
38
+ if (!fs.existsSync(entryPath)) {
39
+ return createDoctorCheck(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
40
+ }
41
+ const source = fs.readFileSync(entryPath, "utf8");
42
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
43
+ const hasCall = hasExecutablePattern(source, WORKSPACE_VARIATIONS_CALL_PATTERN);
44
+ return createDoctorCheck(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
45
+ ? "Variations registration hook is present"
46
+ : "Missing ./variations import or registerWorkspaceVariations() call");
47
+ }
48
+ function checkBlockStyleEntrypoint(projectDir, blockSlug) {
49
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
50
+ if (!fs.existsSync(entryPath)) {
51
+ return createDoctorCheck(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
52
+ }
53
+ const source = fs.readFileSync(entryPath, "utf8");
54
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
55
+ const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_STYLES_CALL_PATTERN);
56
+ return createDoctorCheck(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
57
+ ? "Block style registration hook is present"
58
+ : "Missing ./styles import or registerWorkspaceBlockStyles() call");
59
+ }
60
+ function checkBlockTransformEntrypoint(projectDir, blockSlug) {
61
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
62
+ if (!fs.existsSync(entryPath)) {
63
+ return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
64
+ }
65
+ const source = fs.readFileSync(entryPath, "utf8");
66
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
67
+ const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN);
68
+ return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
69
+ ? "Block transform registration hook is present"
70
+ : "Missing ./transforms import or applyWorkspaceBlockTransforms(registration.settings) call");
71
+ }
72
+ function checkBlockTransformConfig(workspace, transform) {
73
+ const expectedTo = `${workspace.workspace.namespace}/${transform.block}`;
74
+ const issues = [];
75
+ if (!WORKSPACE_FULL_BLOCK_NAME_PATTERN.test(transform.from)) {
76
+ issues.push("from must use full namespace/block format");
77
+ }
78
+ if (transform.to !== expectedTo) {
79
+ issues.push(`to must equal "${expectedTo}" for workspace block "${transform.block}"`);
80
+ }
81
+ return createDoctorCheck(`Block transform config ${transform.block}/${transform.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0
82
+ ? `${transform.from} transforms into ${transform.to}`
83
+ : issues.join("; "));
84
+ }
85
+ /**
86
+ * Collect variation, block style, transform, and pattern doctor checks.
87
+ *
88
+ * @param workspace Resolved workspace metadata and filesystem paths.
89
+ * @param inventory Parsed workspace inventory from `scripts/block-config.ts`.
90
+ * @param registeredBlockSlugs Block slugs already declared in the inventory.
91
+ * @returns Ordered add-on and pattern doctor checks.
92
+ */
93
+ export function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registeredBlockSlugs) {
94
+ const checks = [];
95
+ const variationTargetBlocks = new Set();
96
+ for (const variation of inventory.variations) {
97
+ if (!registeredBlockSlugs.has(variation.block)) {
98
+ checks.push(createDoctorCheck(`Variation ${variation.block}/${variation.slug}`, "fail", `Variation references unknown block "${variation.block}"`));
99
+ continue;
100
+ }
101
+ variationTargetBlocks.add(variation.block);
102
+ checks.push(checkExistingFiles(workspace.projectDir, `Variation ${variation.block}/${variation.slug}`, [variation.file]));
103
+ }
104
+ for (const blockSlug of variationTargetBlocks) {
105
+ checks.push(checkVariationEntrypoint(workspace.projectDir, blockSlug));
106
+ }
107
+ const blockStyleTargetBlocks = new Set();
108
+ for (const blockStyle of inventory.blockStyles) {
109
+ if (!registeredBlockSlugs.has(blockStyle.block)) {
110
+ checks.push(createDoctorCheck(`Block style ${blockStyle.block}/${blockStyle.slug}`, "fail", `Block style references unknown block "${blockStyle.block}"`));
111
+ continue;
112
+ }
113
+ blockStyleTargetBlocks.add(blockStyle.block);
114
+ checks.push(checkExistingFiles(workspace.projectDir, `Block style ${blockStyle.block}/${blockStyle.slug}`, [blockStyle.file]));
115
+ }
116
+ for (const blockSlug of blockStyleTargetBlocks) {
117
+ checks.push(checkExistingFiles(workspace.projectDir, `Block style registry ${blockSlug}`, [
118
+ path.join("src", "blocks", blockSlug, "styles", "index.ts"),
119
+ ]));
120
+ checks.push(checkBlockStyleEntrypoint(workspace.projectDir, blockSlug));
121
+ }
122
+ const blockTransformTargetBlocks = new Set();
123
+ for (const blockTransform of inventory.blockTransforms) {
124
+ if (!registeredBlockSlugs.has(blockTransform.block)) {
125
+ checks.push(createDoctorCheck(`Block transform ${blockTransform.block}/${blockTransform.slug}`, "fail", `Block transform references unknown block "${blockTransform.block}"`));
126
+ continue;
127
+ }
128
+ blockTransformTargetBlocks.add(blockTransform.block);
129
+ checks.push(checkBlockTransformConfig(workspace, blockTransform));
130
+ checks.push(checkExistingFiles(workspace.projectDir, `Block transform ${blockTransform.block}/${blockTransform.slug}`, [blockTransform.file]));
131
+ }
132
+ for (const blockSlug of blockTransformTargetBlocks) {
133
+ checks.push(checkExistingFiles(workspace.projectDir, `Block transform registry ${blockSlug}`, [
134
+ path.join("src", "blocks", blockSlug, "transforms", "index.ts"),
135
+ ]));
136
+ checks.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
137
+ }
138
+ const shouldCheckPatternBootstrap = inventory.patterns.length > 0 ||
139
+ fs.existsSync(path.join(workspace.projectDir, "src", "patterns"));
140
+ if (shouldCheckPatternBootstrap) {
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"));
155
+ }
156
+ for (const pattern of inventory.patterns) {
157
+ checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [
158
+ resolvePatternCatalogContentFile(pattern),
159
+ ]));
160
+ }
161
+ return checks;
162
+ }
@@ -0,0 +1,9 @@
1
+ import type { DoctorCheck } from "./cli-doctor.js";
2
+ /**
3
+ * Collect iframe/API v3 compatibility checks for one workspace block.
4
+ *
5
+ * @param projectDir Absolute workspace project root.
6
+ * @param blockSlug Block slug from the workspace inventory.
7
+ * @returns Ordered iframe compatibility doctor checks.
8
+ */
9
+ export declare function getWorkspaceBlockIframeCompatibilityChecks(projectDir: string, blockSlug: string): DoctorCheck[];
@@ -0,0 +1,228 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
4
+ import { createDoctorCheck } from "./cli-doctor-workspace-shared.js";
5
+ import { readJsonFileSync } from "./json-utils.js";
6
+ import { hasExecutablePattern, maskTypeScriptCommentsAndLiterals, } from "./ts-source-masking.js";
7
+ const WORKSPACE_BLOCK_IFRAME_COMPATIBILITY_DOC_URL = "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/";
8
+ const WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES = {
9
+ API_VERSION: "wp-typia.workspace.block.iframe.api-version",
10
+ BLOCK_PROPS: "wp-typia.workspace.block.iframe.block-props",
11
+ EDITOR_GLOBALS: "wp-typia.workspace.block.iframe.editor-globals",
12
+ EDITOR_STYLES: "wp-typia.workspace.block.iframe.editor-styles",
13
+ };
14
+ const WORKSPACE_BLOCK_EDITOR_SOURCE_FILE_PATTERN = /\.[cm]?[jt]sx?$/u;
15
+ const WORKSPACE_BLOCK_EDITOR_SOURCE_BASENAMES = new Set([
16
+ "edit",
17
+ "editor",
18
+ "index",
19
+ "save",
20
+ ]);
21
+ const WORKSPACE_BLOCK_EDITOR_SOURCE_DIRECTORIES = new Set([
22
+ "components",
23
+ "controls",
24
+ "editor",
25
+ "inspector",
26
+ ]);
27
+ const WORKSPACE_BLOCK_LOCAL_STYLE_FILES = [
28
+ "editor.css",
29
+ "editor.scss",
30
+ "index.css",
31
+ "style.css",
32
+ "style.scss",
33
+ ];
34
+ const WORKSPACE_BLOCK_IFRAME_GLOBAL_DOM_PATTERN = /\b(?:document|window)\b|\b(?:parent|top)\b(?!\s*:)/gu;
35
+ const WORKSPACE_BLOCK_PROPS_PATTERN = /\buse(?:Block|InnerBlocks)Props(?:\.save)?\s*\(/u;
36
+ function normalizePathSeparators(relativePath) {
37
+ return relativePath.split(path.sep).join("/");
38
+ }
39
+ function hasRegisteredBlockAsset(value) {
40
+ if (typeof value === "string") {
41
+ return value.trim().length > 0;
42
+ }
43
+ if (Array.isArray(value)) {
44
+ return value.some((entry) => hasRegisteredBlockAsset(entry));
45
+ }
46
+ return false;
47
+ }
48
+ function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
49
+ const blockJsonRelativePath = path.join("src", "blocks", blockSlug, "block.json");
50
+ const blockJsonPath = path.join(projectDir, blockJsonRelativePath);
51
+ if (!fs.existsSync(blockJsonPath)) {
52
+ return {
53
+ blockJsonRelativePath,
54
+ error: `Missing ${blockJsonRelativePath}`,
55
+ };
56
+ }
57
+ try {
58
+ const document = parseScaffoldBlockMetadata(readJsonFileSync(blockJsonPath, {
59
+ context: "workspace block metadata",
60
+ }));
61
+ return {
62
+ blockJsonRelativePath,
63
+ document,
64
+ };
65
+ }
66
+ catch (error) {
67
+ return {
68
+ blockJsonRelativePath,
69
+ error: error instanceof Error ? error.message : String(error),
70
+ };
71
+ }
72
+ }
73
+ function isWorkspaceBlockEditorSource(relativePath) {
74
+ if (!WORKSPACE_BLOCK_EDITOR_SOURCE_FILE_PATTERN.test(relativePath)) {
75
+ return false;
76
+ }
77
+ const normalizedRelativePath = normalizePathSeparators(relativePath);
78
+ const normalizedDirName = path.posix.dirname(normalizedRelativePath);
79
+ const normalizedBaseName = path.posix.basename(normalizedRelativePath, path.posix.extname(normalizedRelativePath));
80
+ if (WORKSPACE_BLOCK_EDITOR_SOURCE_BASENAMES.has(normalizedBaseName)) {
81
+ return true;
82
+ }
83
+ const pathSegments = normalizedDirName.split("/");
84
+ return pathSegments.some((segment) => WORKSPACE_BLOCK_EDITOR_SOURCE_DIRECTORIES.has(segment));
85
+ }
86
+ function isWorkspaceBlockSaveSource(relativePath) {
87
+ const normalizedBaseName = path.basename(relativePath, path.extname(relativePath));
88
+ return normalizedBaseName === "save";
89
+ }
90
+ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
91
+ const blockDir = path.join(projectDir, "src", "blocks", blockSlug);
92
+ if (!fs.existsSync(blockDir)) {
93
+ return [];
94
+ }
95
+ const collected = [];
96
+ const queue = [blockDir];
97
+ while (queue.length > 0) {
98
+ const currentDir = queue.pop();
99
+ if (!currentDir) {
100
+ continue;
101
+ }
102
+ for (const entry of fs.readdirSync(currentDir, { withFileTypes: true })) {
103
+ const absolutePath = path.join(currentDir, entry.name);
104
+ if (entry.isDirectory()) {
105
+ queue.push(absolutePath);
106
+ continue;
107
+ }
108
+ if (!entry.isFile()) {
109
+ continue;
110
+ }
111
+ const relativePath = path.relative(projectDir, absolutePath);
112
+ if (!isWorkspaceBlockEditorSource(relativePath)) {
113
+ continue;
114
+ }
115
+ collected.push({
116
+ relativePath: normalizePathSeparators(relativePath),
117
+ source: fs.readFileSync(absolutePath, "utf8"),
118
+ });
119
+ }
120
+ }
121
+ return collected.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
122
+ }
123
+ function getSourceLineNumber(source, index) {
124
+ let line = 1;
125
+ for (let cursor = 0; cursor < index; cursor += 1) {
126
+ if (source[cursor] === "\n") {
127
+ line += 1;
128
+ }
129
+ }
130
+ return line;
131
+ }
132
+ function isGlobalDomAccessCandidate(source, index, identifier) {
133
+ const lineStart = source.lastIndexOf("\n", index - 1) + 1;
134
+ const lineEndCandidate = source.indexOf("\n", index);
135
+ const lineEnd = lineEndCandidate === -1 ? source.length : lineEndCandidate;
136
+ const lineSource = source.slice(lineStart, lineEnd);
137
+ const trimmedLine = lineSource.trimStart();
138
+ if (trimmedLine.startsWith("import ")) {
139
+ return false;
140
+ }
141
+ if (trimmedLine.startsWith("const ") ||
142
+ trimmedLine.startsWith("let ") ||
143
+ trimmedLine.startsWith("var ")) {
144
+ return false;
145
+ }
146
+ if (trimmedLine.startsWith("function ") || trimmedLine.startsWith("class ")) {
147
+ return false;
148
+ }
149
+ const precedingCharacter = index > 0 ? source[index - 1] : "";
150
+ if (precedingCharacter === "." || precedingCharacter === "'" || precedingCharacter === '"') {
151
+ return false;
152
+ }
153
+ return (identifier === "document" ||
154
+ identifier === "window" ||
155
+ identifier === "parent" ||
156
+ identifier === "top");
157
+ }
158
+ function findWorkspaceBlockGlobalDomAccesses(editorSources) {
159
+ return editorSources.flatMap(({ relativePath, source }) => {
160
+ const maskedSource = maskTypeScriptCommentsAndLiterals(source);
161
+ const matches = maskedSource.matchAll(WORKSPACE_BLOCK_IFRAME_GLOBAL_DOM_PATTERN);
162
+ const findings = [];
163
+ for (const match of matches) {
164
+ const identifier = match[0];
165
+ const matchIndex = match.index ?? -1;
166
+ if (matchIndex < 0) {
167
+ continue;
168
+ }
169
+ if (!isGlobalDomAccessCandidate(source, matchIndex, identifier)) {
170
+ continue;
171
+ }
172
+ findings.push(`${relativePath}:${getSourceLineNumber(source, matchIndex)}`);
173
+ }
174
+ return findings;
175
+ });
176
+ }
177
+ /**
178
+ * Collect iframe/API v3 compatibility checks for one workspace block.
179
+ *
180
+ * @param projectDir Absolute workspace project root.
181
+ * @param blockSlug Block slug from the workspace inventory.
182
+ * @returns Ordered iframe compatibility doctor checks.
183
+ */
184
+ export function getWorkspaceBlockIframeCompatibilityChecks(projectDir, blockSlug) {
185
+ const metadataResult = readWorkspaceBlockIframeMetadata(projectDir, blockSlug);
186
+ if (!metadataResult.document) {
187
+ return [
188
+ createDoctorCheck(`Block iframe/API v3 ${blockSlug}`, "warn", metadataResult.error ?? `Unable to inspect ${metadataResult.blockJsonRelativePath}`, WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES.API_VERSION),
189
+ ];
190
+ }
191
+ const blockJson = metadataResult.document;
192
+ const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion)
193
+ ? blockJson.apiVersion
194
+ : null;
195
+ const blockDir = path.join(projectDir, "src", "blocks", blockSlug);
196
+ const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs.existsSync(path.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path.join("src", "blocks", blockSlug, fileName)));
197
+ const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) ||
198
+ hasRegisteredBlockAsset(blockJson.editorStyle);
199
+ const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
200
+ const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
201
+ const globalDomAccesses = findWorkspaceBlockGlobalDomAccesses(editorSources);
202
+ const hasBlockPropsUsage = editorSources.some(({ source }) => hasExecutablePattern(source, WORKSPACE_BLOCK_PROPS_PATTERN));
203
+ const hasEditorBlockPropsUsage = editorWrapperSources.some(({ source }) => hasExecutablePattern(source, WORKSPACE_BLOCK_PROPS_PATTERN));
204
+ const blockWrapperStatus = editorWrapperSources.length === 0 || hasEditorBlockPropsUsage ? "pass" : "warn";
205
+ const blockWrapperDetail = editorSources.length === 0
206
+ ? "No editor-facing block source files found; general file checks will report missing entrypoints"
207
+ : editorWrapperSources.length === 0
208
+ ? "No editor wrapper source files found; general file checks will report missing entrypoints"
209
+ : hasEditorBlockPropsUsage
210
+ ? "Editor-facing sources use block wrapper props"
211
+ : hasBlockPropsUsage
212
+ ? "Only save-facing useBlockProps.save() usage was detected. Confirm the editor wrapper also receives useBlockProps() or useInnerBlocksProps() before relying on iframe editor rendering."
213
+ : "No useBlockProps(), useBlockProps.save(), or useInnerBlocksProps() usage was detected in editor-facing sources. Confirm the block wrapper receives WordPress block editor props before relying on iframe editor rendering.";
214
+ return [
215
+ createDoctorCheck(`Block iframe API version ${blockSlug}`, apiVersion !== null && apiVersion >= 3 ? "pass" : "warn", apiVersion !== null && apiVersion >= 3
216
+ ? "block.json declares apiVersion 3 for iframe editor readiness"
217
+ : `Set ${metadataResult.blockJsonRelativePath} apiVersion to 3 after testing the block in iframe-enabled Post Editor and Site Editor contexts. WordPress recommends API v3 for iframe editor compatibility. See ${WORKSPACE_BLOCK_IFRAME_COMPATIBILITY_DOC_URL}`, WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES.API_VERSION),
218
+ createDoctorCheck(`Block iframe styles ${blockSlug}`, localStyleFiles.length === 0 || hasRegisteredEditorStyles ? "pass" : "warn", localStyleFiles.length === 0
219
+ ? "No local block stylesheet source files found to register"
220
+ : hasRegisteredEditorStyles
221
+ ? "block.json registers block styles for iframe editor loading"
222
+ : `Found stylesheet source files (${localStyleFiles.join(", ")}) but block.json does not declare style or editorStyle. Register block content styles so iframe editors do not depend on parent admin styles.`, WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES.EDITOR_STYLES),
223
+ createDoctorCheck(`Block iframe globals ${blockSlug}`, globalDomAccesses.length === 0 ? "pass" : "warn", globalDomAccesses.length === 0
224
+ ? "No direct window/document/parent DOM access detected in editor-facing block sources"
225
+ : `Direct global DOM access detected at ${globalDomAccesses.join(", ")}. Prefer element.ownerDocument/defaultView via refs or useRefEffect for iframe editor content.`, WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES.EDITOR_GLOBALS),
226
+ createDoctorCheck(`Block iframe wrapper ${blockSlug}`, blockWrapperStatus, blockWrapperDetail, WORKSPACE_BLOCK_IFRAME_DIAGNOSTIC_CODES.BLOCK_PROPS),
227
+ ];
228
+ }
@@ -0,0 +1,11 @@
1
+ import type { DoctorCheck } from "./cli-doctor.js";
2
+ import type { WorkspaceInventory } from "./workspace-inventory.js";
3
+ import type { WorkspaceProject } from "./workspace-project.js";
4
+ /**
5
+ * Collect base file, metadata, hook, and collection-import checks for one block.
6
+ *
7
+ * @param workspace Resolved workspace metadata and filesystem paths.
8
+ * @param block Inventory row describing the generated block.
9
+ * @returns Ordered block core doctor checks.
10
+ */
11
+ export declare function getWorkspaceBlockCoreDoctorChecks(workspace: WorkspaceProject, block: WorkspaceInventory["blocks"][number]): DoctorCheck[];