@wp-typia/project-tools 0.23.0 → 0.23.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 (109) 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/cli-add-block-json.js +5 -1
  4. package/dist/runtime/cli-add-help.js +4 -3
  5. package/dist/runtime/cli-add-types.d.ts +18 -6
  6. package/dist/runtime/cli-add-validation.d.ts +7 -0
  7. package/dist/runtime/cli-add-validation.js +9 -0
  8. package/dist/runtime/cli-add-workspace-ability-scaffold.js +4 -1
  9. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +5 -1
  10. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  11. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  12. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  13. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  14. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  15. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  16. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  17. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  18. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  19. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  20. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
  21. package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
  22. package/dist/runtime/cli-add-workspace-ai-anchors.js +4 -1
  23. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +17 -1
  24. package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
  25. package/dist/runtime/cli-add-workspace-integration-env.js +42 -5
  26. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +8 -0
  27. package/dist/runtime/cli-add-workspace-rest-anchors.js +41 -0
  28. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  29. package/dist/runtime/cli-add-workspace-rest-generated.js +158 -0
  30. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  31. package/dist/runtime/cli-add-workspace-rest-manual.js +279 -0
  32. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +24 -0
  33. package/dist/runtime/cli-add-workspace-rest-php-templates.js +678 -0
  34. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +8 -0
  35. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +25 -4
  36. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  37. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  38. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
  39. package/dist/runtime/cli-add-workspace-rest.js +33 -788
  40. package/dist/runtime/cli-core.d.ts +1 -1
  41. package/dist/runtime/cli-core.js +1 -1
  42. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  43. package/dist/runtime/cli-diagnostics.js +17 -5
  44. package/dist/runtime/cli-doctor-workspace-bindings.js +4 -1
  45. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  46. package/dist/runtime/cli-doctor-workspace-block-addons.js +134 -0
  47. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  48. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  49. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  50. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  51. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  52. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  53. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  54. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  55. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  56. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  57. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  58. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  59. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  60. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  61. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  62. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  63. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  64. package/dist/runtime/cli-doctor-workspace-features.js +14 -487
  65. package/dist/runtime/cli-doctor.d.ts +52 -3
  66. package/dist/runtime/cli-doctor.js +79 -8
  67. package/dist/runtime/cli-help.js +6 -3
  68. package/dist/runtime/cli-init-package-json.js +4 -2
  69. package/dist/runtime/cli-prompt.d.ts +16 -2
  70. package/dist/runtime/cli-prompt.js +29 -12
  71. package/dist/runtime/cli-scaffold.d.ts +2 -1
  72. package/dist/runtime/cli-scaffold.js +19 -10
  73. package/dist/runtime/external-template-guards.js +4 -6
  74. package/dist/runtime/index.d.ts +2 -2
  75. package/dist/runtime/index.js +1 -1
  76. package/dist/runtime/json-utils.d.ts +62 -4
  77. package/dist/runtime/json-utils.js +78 -4
  78. package/dist/runtime/local-dev-presets.js +4 -1
  79. package/dist/runtime/migration-ui-capability.js +4 -1
  80. package/dist/runtime/migration-utils.js +4 -1
  81. package/dist/runtime/package-managers.js +6 -1
  82. package/dist/runtime/package-versions.js +6 -1
  83. package/dist/runtime/scaffold-bootstrap.js +7 -2
  84. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  85. package/dist/runtime/scaffold-repository-reference.js +4 -2
  86. package/dist/runtime/scaffold-template-variables.js +2 -1
  87. package/dist/runtime/scaffold.d.ts +18 -1
  88. package/dist/runtime/scaffold.js +55 -2
  89. package/dist/runtime/temp-roots.js +4 -1
  90. package/dist/runtime/template-layers.js +4 -1
  91. package/dist/runtime/template-registry.js +9 -3
  92. package/dist/runtime/template-source-contracts.d.ts +2 -0
  93. package/dist/runtime/template-source-normalization.js +2 -1
  94. package/dist/runtime/template-source-remote.js +18 -5
  95. package/dist/runtime/template-source-seeds.js +10 -3
  96. package/dist/runtime/workspace-inventory-mutations.js +2 -1
  97. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  98. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  99. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  100. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  101. package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
  102. package/dist/runtime/workspace-inventory-parser.js +3 -581
  103. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  104. package/dist/runtime/workspace-inventory-section-descriptors.js +435 -0
  105. package/dist/runtime/workspace-inventory-templates.d.ts +1 -1
  106. package/dist/runtime/workspace-inventory-templates.js +1 -0
  107. package/dist/runtime/workspace-inventory-types.d.ts +1 -0
  108. package/dist/runtime/workspace-project.js +4 -6
  109. package/package.json +2 -2
@@ -30,7 +30,7 @@
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
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";
@@ -30,7 +30,7 @@
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
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";
36
36
  export { COMPOUND_INNER_BLOCKS_PRESET_IDS, getCompoundInnerBlocksPresetDefinition, } from "./compound-inner-blocks.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,6 +2,7 @@ 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";
6
7
  function checkWorkspaceBindingBootstrap(projectDir, packageName) {
7
8
  const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
@@ -45,7 +46,9 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
45
46
  const blockJsonPath = path.join(projectDir, blockJsonRelativePath);
46
47
  const issues = [];
47
48
  try {
48
- const blockJson = parseScaffoldBlockMetadata(JSON.parse(fs.readFileSync(blockJsonPath, "utf8")));
49
+ const blockJson = parseScaffoldBlockMetadata(readJsonFileSync(blockJsonPath, {
50
+ context: "workspace block metadata",
51
+ }));
49
52
  const attributes = blockJson.attributes;
50
53
  if (!attributes || typeof attributes !== "object" || Array.isArray(attributes)) {
51
54
  issues.push(`${blockJsonRelativePath} must define an attributes object`);
@@ -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,134 @@
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 { hasExecutablePattern, hasUncommentedPattern, } from "./ts-source-masking.js";
5
+ const WORKSPACE_VARIATIONS_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspaceVariations\s*\}\s*from\s*["']\.\/variations["']\s*;?\s*$/mu;
6
+ const WORKSPACE_VARIATIONS_CALL_PATTERN = /registerWorkspaceVariations\s*\(\s*\)\s*;?/u;
7
+ const WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN = /^\s*import\s*\{\s*registerWorkspaceBlockStyles\s*\}\s*from\s*["']\.\/styles["']\s*;?\s*$/mu;
8
+ const WORKSPACE_BLOCK_STYLES_CALL_PATTERN = /registerWorkspaceBlockStyles\s*\(\s*\)\s*;?/u;
9
+ const WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN = /^\s*import\s*\{\s*applyWorkspaceBlockTransforms\s*\}\s*from\s*["']\.\/transforms["']\s*;?\s*$/mu;
10
+ const WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN = /applyWorkspaceBlockTransforms\s*\(\s*registration\s*\.\s*settings\s*\)\s*;?/u;
11
+ function checkWorkspacePatternBootstrap(projectDir, packageName) {
12
+ const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
13
+ if (!fs.existsSync(bootstrapPath)) {
14
+ return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${path.basename(bootstrapPath)}`);
15
+ }
16
+ const source = fs.readFileSync(bootstrapPath, "utf8");
17
+ const hasCategoryAnchor = source.includes("register_block_pattern_category");
18
+ const hasPatternGlob = source.includes("/src/patterns/*.php");
19
+ return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob
20
+ ? "Pattern category and loader hooks are present"
21
+ : "Missing pattern category registration or src/patterns loader hook");
22
+ }
23
+ function checkVariationEntrypoint(projectDir, blockSlug) {
24
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
25
+ if (!fs.existsSync(entryPath)) {
26
+ return createDoctorCheck(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
27
+ }
28
+ const source = fs.readFileSync(entryPath, "utf8");
29
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
30
+ const hasCall = hasExecutablePattern(source, WORKSPACE_VARIATIONS_CALL_PATTERN);
31
+ return createDoctorCheck(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
32
+ ? "Variations registration hook is present"
33
+ : "Missing ./variations import or registerWorkspaceVariations() call");
34
+ }
35
+ function checkBlockStyleEntrypoint(projectDir, blockSlug) {
36
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
37
+ if (!fs.existsSync(entryPath)) {
38
+ return createDoctorCheck(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
39
+ }
40
+ const source = fs.readFileSync(entryPath, "utf8");
41
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
42
+ const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_STYLES_CALL_PATTERN);
43
+ return createDoctorCheck(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
44
+ ? "Block style registration hook is present"
45
+ : "Missing ./styles import or registerWorkspaceBlockStyles() call");
46
+ }
47
+ function checkBlockTransformEntrypoint(projectDir, blockSlug) {
48
+ const entryPath = path.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
49
+ if (!fs.existsSync(entryPath)) {
50
+ return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path.relative(projectDir, entryPath)}`);
51
+ }
52
+ const source = fs.readFileSync(entryPath, "utf8");
53
+ const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
54
+ const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN);
55
+ return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall
56
+ ? "Block transform registration hook is present"
57
+ : "Missing ./transforms import or applyWorkspaceBlockTransforms(registration.settings) call");
58
+ }
59
+ function checkBlockTransformConfig(workspace, transform) {
60
+ const expectedTo = `${workspace.workspace.namespace}/${transform.block}`;
61
+ const issues = [];
62
+ if (!WORKSPACE_FULL_BLOCK_NAME_PATTERN.test(transform.from)) {
63
+ issues.push("from must use full namespace/block format");
64
+ }
65
+ if (transform.to !== expectedTo) {
66
+ issues.push(`to must equal "${expectedTo}" for workspace block "${transform.block}"`);
67
+ }
68
+ return createDoctorCheck(`Block transform config ${transform.block}/${transform.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0
69
+ ? `${transform.from} transforms into ${transform.to}`
70
+ : issues.join("; "));
71
+ }
72
+ /**
73
+ * Collect variation, block style, transform, and pattern doctor checks.
74
+ *
75
+ * @param workspace Resolved workspace metadata and filesystem paths.
76
+ * @param inventory Parsed workspace inventory from `scripts/block-config.ts`.
77
+ * @param registeredBlockSlugs Block slugs already declared in the inventory.
78
+ * @returns Ordered add-on and pattern doctor checks.
79
+ */
80
+ export function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registeredBlockSlugs) {
81
+ const checks = [];
82
+ const variationTargetBlocks = new Set();
83
+ for (const variation of inventory.variations) {
84
+ if (!registeredBlockSlugs.has(variation.block)) {
85
+ checks.push(createDoctorCheck(`Variation ${variation.block}/${variation.slug}`, "fail", `Variation references unknown block "${variation.block}"`));
86
+ continue;
87
+ }
88
+ variationTargetBlocks.add(variation.block);
89
+ checks.push(checkExistingFiles(workspace.projectDir, `Variation ${variation.block}/${variation.slug}`, [variation.file]));
90
+ }
91
+ for (const blockSlug of variationTargetBlocks) {
92
+ checks.push(checkVariationEntrypoint(workspace.projectDir, blockSlug));
93
+ }
94
+ const blockStyleTargetBlocks = new Set();
95
+ for (const blockStyle of inventory.blockStyles) {
96
+ if (!registeredBlockSlugs.has(blockStyle.block)) {
97
+ checks.push(createDoctorCheck(`Block style ${blockStyle.block}/${blockStyle.slug}`, "fail", `Block style references unknown block "${blockStyle.block}"`));
98
+ continue;
99
+ }
100
+ blockStyleTargetBlocks.add(blockStyle.block);
101
+ checks.push(checkExistingFiles(workspace.projectDir, `Block style ${blockStyle.block}/${blockStyle.slug}`, [blockStyle.file]));
102
+ }
103
+ for (const blockSlug of blockStyleTargetBlocks) {
104
+ checks.push(checkExistingFiles(workspace.projectDir, `Block style registry ${blockSlug}`, [
105
+ path.join("src", "blocks", blockSlug, "styles", "index.ts"),
106
+ ]));
107
+ checks.push(checkBlockStyleEntrypoint(workspace.projectDir, blockSlug));
108
+ }
109
+ const blockTransformTargetBlocks = new Set();
110
+ for (const blockTransform of inventory.blockTransforms) {
111
+ if (!registeredBlockSlugs.has(blockTransform.block)) {
112
+ checks.push(createDoctorCheck(`Block transform ${blockTransform.block}/${blockTransform.slug}`, "fail", `Block transform references unknown block "${blockTransform.block}"`));
113
+ continue;
114
+ }
115
+ blockTransformTargetBlocks.add(blockTransform.block);
116
+ checks.push(checkBlockTransformConfig(workspace, blockTransform));
117
+ checks.push(checkExistingFiles(workspace.projectDir, `Block transform ${blockTransform.block}/${blockTransform.slug}`, [blockTransform.file]));
118
+ }
119
+ for (const blockSlug of blockTransformTargetBlocks) {
120
+ checks.push(checkExistingFiles(workspace.projectDir, `Block transform registry ${blockSlug}`, [
121
+ path.join("src", "blocks", blockSlug, "transforms", "index.ts"),
122
+ ]));
123
+ checks.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
124
+ }
125
+ const shouldCheckPatternBootstrap = inventory.patterns.length > 0 ||
126
+ fs.existsSync(path.join(workspace.projectDir, "src", "patterns"));
127
+ if (shouldCheckPatternBootstrap) {
128
+ checks.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
129
+ }
130
+ for (const pattern of inventory.patterns) {
131
+ checks.push(checkExistingFiles(workspace.projectDir, `Pattern ${pattern.slug}`, [pattern.file]));
132
+ }
133
+ return checks;
134
+ }
@@ -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[];
@@ -0,0 +1,111 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
4
+ import { checkExistingFiles, createDoctorCheck, WORKSPACE_GENERATED_BLOCK_ARTIFACTS, } from "./cli-doctor-workspace-shared.js";
5
+ import { HOOKED_BLOCK_ANCHOR_PATTERN, HOOKED_BLOCK_POSITION_SET, } from "./hooked-blocks.js";
6
+ import { readJsonFileSync } from "./json-utils.js";
7
+ const WORKSPACE_COLLECTION_IMPORT_LINE = "import '../../collection';";
8
+ const WORKSPACE_COLLECTION_IMPORT_PATTERN = /^\s*import\s+["']\.\.\/\.\.\/collection["']\s*;?\s*$/m;
9
+ function getWorkspaceBlockRequiredFiles(block) {
10
+ const blockDir = path.join("src", "blocks", block.slug);
11
+ return Array.from(new Set([
12
+ block.typesFile,
13
+ block.apiTypesFile,
14
+ block.openApiFile,
15
+ path.join(blockDir, "index.tsx"),
16
+ ...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path.join(blockDir, fileName)),
17
+ ].filter((filePath) => typeof filePath === "string")));
18
+ }
19
+ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
20
+ const blockJsonRelativePath = path.join("src", "blocks", block.slug, "block.json");
21
+ const blockJsonPath = path.join(projectDir, blockJsonRelativePath);
22
+ if (!fs.existsSync(blockJsonPath)) {
23
+ return createDoctorCheck(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
24
+ }
25
+ let blockJson;
26
+ try {
27
+ blockJson = parseScaffoldBlockMetadata(readJsonFileSync(blockJsonPath, {
28
+ context: "workspace block metadata",
29
+ }));
30
+ }
31
+ catch (error) {
32
+ return createDoctorCheck(`Block metadata ${block.slug}`, "fail", error instanceof Error ? error.message : String(error));
33
+ }
34
+ const expectedName = `${workspace.workspace.namespace}/${block.slug}`;
35
+ const issues = [];
36
+ if (blockJson.name !== expectedName) {
37
+ issues.push(`block.json name must equal "${expectedName}"`);
38
+ }
39
+ if (blockJson.textdomain !== workspace.workspace.textDomain) {
40
+ issues.push(`block.json textdomain must equal "${workspace.workspace.textDomain}"`);
41
+ }
42
+ return createDoctorCheck(`Block metadata ${block.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0
43
+ ? `block.json matches ${expectedName} and ${workspace.workspace.textDomain}`
44
+ : issues.join("; "));
45
+ }
46
+ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
47
+ const blockJsonRelativePath = path.join("src", "blocks", blockSlug, "block.json");
48
+ const blockJsonPath = path.join(projectDir, blockJsonRelativePath);
49
+ if (!fs.existsSync(blockJsonPath)) {
50
+ return createDoctorCheck(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
51
+ }
52
+ let blockJson;
53
+ try {
54
+ blockJson = parseScaffoldBlockMetadata(readJsonFileSync(blockJsonPath, {
55
+ context: "workspace block metadata",
56
+ }));
57
+ }
58
+ catch (error) {
59
+ return createDoctorCheck(`Block hooks ${blockSlug}`, "fail", error instanceof Error ? error.message : String(error));
60
+ }
61
+ const blockHooks = blockJson.blockHooks;
62
+ if (blockHooks === undefined) {
63
+ return createDoctorCheck(`Block hooks ${blockSlug}`, "pass", "No blockHooks metadata configured");
64
+ }
65
+ if (!blockHooks || typeof blockHooks !== "object" || Array.isArray(blockHooks)) {
66
+ return createDoctorCheck(`Block hooks ${blockSlug}`, "fail", `${blockJsonRelativePath} must define blockHooks as an object when present.`);
67
+ }
68
+ const blockName = typeof blockJson.name === "string" && blockJson.name.trim().length > 0
69
+ ? blockJson.name.trim()
70
+ : null;
71
+ const invalidEntries = Object.entries(blockHooks).filter(([anchor, position]) => (blockName !== null && anchor.trim() === blockName) ||
72
+ anchor.trim().length === 0 ||
73
+ anchor !== anchor.trim() ||
74
+ !HOOKED_BLOCK_ANCHOR_PATTERN.test(anchor) ||
75
+ typeof position !== "string" ||
76
+ !HOOKED_BLOCK_POSITION_SET.has(position));
77
+ return createDoctorCheck(`Block hooks ${blockSlug}`, invalidEntries.length === 0 ? "pass" : "fail", invalidEntries.length === 0
78
+ ? `blockHooks metadata is valid${Object.keys(blockHooks).length > 0
79
+ ? ` (${Object.keys(blockHooks).join(", ")})`
80
+ : ""}`
81
+ : `Invalid blockHooks entries: ${invalidEntries
82
+ .map(([anchor, position]) => `${anchor || "<empty>"} => ${String(position)}`)
83
+ .join(", ")}`);
84
+ }
85
+ function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
86
+ const entryRelativePath = path.join("src", "blocks", blockSlug, "index.tsx");
87
+ const entryPath = path.join(projectDir, entryRelativePath);
88
+ if (!fs.existsSync(entryPath)) {
89
+ return createDoctorCheck(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
90
+ }
91
+ const source = fs.readFileSync(entryPath, "utf8");
92
+ const hasCollectionImport = WORKSPACE_COLLECTION_IMPORT_PATTERN.test(source);
93
+ return createDoctorCheck(`Block collection ${blockSlug}`, hasCollectionImport ? "pass" : "fail", hasCollectionImport
94
+ ? "Shared block collection import is present"
95
+ : `Missing a shared collection import like ${WORKSPACE_COLLECTION_IMPORT_LINE}`);
96
+ }
97
+ /**
98
+ * Collect base file, metadata, hook, and collection-import checks for one block.
99
+ *
100
+ * @param workspace Resolved workspace metadata and filesystem paths.
101
+ * @param block Inventory row describing the generated block.
102
+ * @returns Ordered block core doctor checks.
103
+ */
104
+ export function getWorkspaceBlockCoreDoctorChecks(workspace, block) {
105
+ return [
106
+ checkExistingFiles(workspace.projectDir, `Block ${block.slug}`, getWorkspaceBlockRequiredFiles(block)),
107
+ checkWorkspaceBlockMetadata(workspace.projectDir, workspace, block),
108
+ checkWorkspaceBlockHooks(workspace.projectDir, block.slug),
109
+ checkWorkspaceBlockCollectionImport(workspace.projectDir, block.slug),
110
+ ];
111
+ }