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