@wp-typia/project-tools 0.24.11 → 0.24.13

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 (72) hide show
  1. package/dist/runtime/add/cli-add-block-config.js +7 -15
  2. package/dist/runtime/add/cli-add-block-package-json.d.ts +5 -0
  3. package/dist/runtime/add/cli-add-block-package-json.js +32 -0
  4. package/dist/runtime/add/cli-add-block.js +17 -4
  5. package/dist/runtime/add/cli-add-workspace-admin-view-scaffold.js +1 -5
  6. package/dist/runtime/add/cli-add-workspace-hooked-block.js +15 -20
  7. package/dist/runtime/add/cli-add-workspace-mutation.d.ts +15 -2
  8. package/dist/runtime/add/cli-add-workspace-mutation.js +10 -4
  9. package/dist/runtime/add/persistence-rest-artifacts.d.ts +32 -7
  10. package/dist/runtime/add/persistence-rest-artifacts.js +41 -15
  11. package/dist/runtime/cli/cli-diagnostics.d.ts +9 -0
  12. package/dist/runtime/cli/cli-diagnostics.js +8 -0
  13. package/dist/runtime/cli/cli-init-package-json.js +5 -1
  14. package/dist/runtime/doctor/cli-doctor-standalone-control-flow.d.ts +38 -0
  15. package/dist/runtime/doctor/cli-doctor-standalone-control-flow.js +365 -0
  16. package/dist/runtime/doctor/cli-doctor-standalone-rest.d.ts +21 -0
  17. package/dist/runtime/doctor/cli-doctor-standalone-rest.js +1354 -0
  18. package/dist/runtime/doctor/cli-doctor-standalone-shared.d.ts +24 -0
  19. package/dist/runtime/doctor/cli-doctor-standalone-shared.js +50 -0
  20. package/dist/runtime/doctor/cli-doctor-standalone.d.ts +32 -0
  21. package/dist/runtime/doctor/cli-doctor-standalone.js +2594 -0
  22. package/dist/runtime/doctor/cli-doctor-workspace.d.ts +5 -3
  23. package/dist/runtime/doctor/cli-doctor-workspace.js +27 -3
  24. package/dist/runtime/doctor/cli-doctor.d.ts +4 -2
  25. package/dist/runtime/doctor/cli-doctor.js +4 -2
  26. package/dist/runtime/shared/json-utils.d.ts +7 -0
  27. package/dist/runtime/shared/json-utils.js +10 -0
  28. package/dist/runtime/shared/package-json-types.d.ts +1 -1
  29. package/dist/runtime/shared/package-versions.d.ts +2 -0
  30. package/dist/runtime/shared/package-versions.js +2 -0
  31. package/dist/runtime/shared/php-utils.d.ts +39 -2
  32. package/dist/runtime/shared/php-utils.js +205 -6
  33. package/dist/runtime/templates/block-generator-service-core.d.ts +1 -1
  34. package/dist/runtime/templates/block-generator-service-core.js +9 -3
  35. package/dist/runtime/templates/block-generator-service-spec.d.ts +5 -0
  36. package/dist/runtime/templates/built-in-block-artifact-documents.d.ts +1 -1
  37. package/dist/runtime/templates/built-in-block-artifact-documents.js +1 -1
  38. package/dist/runtime/templates/built-in-block-artifact-types.js +2 -2
  39. package/dist/runtime/templates/built-in-block-artifacts.d.ts +1 -1
  40. package/dist/runtime/templates/built-in-block-artifacts.js +16 -12
  41. package/dist/runtime/templates/built-in-block-attribute-emitters.d.ts +5 -0
  42. package/dist/runtime/templates/built-in-block-attribute-emitters.js +113 -8
  43. package/dist/runtime/templates/built-in-block-attribute-specs.js +4 -9
  44. package/dist/runtime/templates/built-in-block-code-artifacts.js +6 -1
  45. package/dist/runtime/templates/built-in-block-code-templates/compound-persistence.d.ts +2 -2
  46. package/dist/runtime/templates/built-in-block-code-templates/compound-persistence.js +24 -1
  47. package/dist/runtime/templates/built-in-block-code-templates/persistence.d.ts +2 -2
  48. package/dist/runtime/templates/built-in-block-code-templates/persistence.js +22 -1
  49. package/dist/runtime/templates/built-in-block-non-ts-compound-templates.d.ts +2 -2
  50. package/dist/runtime/templates/built-in-block-non-ts-compound-templates.js +6 -2
  51. package/dist/runtime/templates/built-in-block-non-ts-persistence-templates.d.ts +2 -2
  52. package/dist/runtime/templates/built-in-block-non-ts-persistence-templates.js +6 -2
  53. package/dist/runtime/templates/cli-scaffold-emission.d.ts +7 -1
  54. package/dist/runtime/templates/cli-scaffold-emission.js +10 -1
  55. package/dist/runtime/templates/cli-templates.d.ts +47 -0
  56. package/dist/runtime/templates/cli-templates.js +50 -1
  57. package/dist/runtime/templates/local-dev-presets.js +1 -1
  58. package/dist/runtime/templates/scaffold-apply-utils.d.ts +4 -8
  59. package/dist/runtime/templates/scaffold-apply-utils.js +44 -28
  60. package/dist/runtime/templates/scaffold-compiler-artifacts.d.ts +17 -0
  61. package/dist/runtime/templates/scaffold-compiler-artifacts.js +81 -0
  62. package/dist/runtime/templates/scaffold-onboarding.d.ts +5 -0
  63. package/dist/runtime/templates/scaffold-onboarding.js +13 -2
  64. package/dist/runtime/templates/scaffold-template-variable-groups.d.ts +4 -0
  65. package/dist/runtime/templates/scaffold-template-variable-groups.js +7 -0
  66. package/dist/runtime/templates/scaffold.d.ts +3 -1
  67. package/dist/runtime/templates/scaffold.js +2 -1
  68. package/dist/runtime/templates/starter-manifests.js +1 -1
  69. package/package.json +5 -5
  70. package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +1 -1
  71. package/templates/_shared/compound/persistence/package.json.mustache +1 -0
  72. package/templates/_shared/persistence/core/package.json.mustache +1 -0
@@ -0,0 +1,81 @@
1
+ import path from "node:path";
2
+ import { buildPersistenceRestArtifactPlan, } from "../add/persistence-rest-artifacts.js";
3
+ import { buildBuiltInBlockArtifacts } from "./built-in-block-artifacts.js";
4
+ import { emitsBuiltInPersistenceArtifacts } from "./scaffold-template-variable-groups.js";
5
+ import { isBuiltInTemplateId, } from "./template-registry.js";
6
+ function normalizeArtifactPath(value) {
7
+ return value.replace(/\\/gu, "/");
8
+ }
9
+ /**
10
+ * Build the canonical sync options for each typed block in a built-in scaffold.
11
+ */
12
+ export function buildBuiltInBlockMetadataSyncOptions(projectDir, templateId, artifacts) {
13
+ const emitsSchemaDocuments = templateId === "persistence" || templateId === "compound";
14
+ return artifacts.map((artifact) => {
15
+ const sourceTypeName = artifact.manifestDocument.sourceType;
16
+ if (!sourceTypeName) {
17
+ throw new Error(`Built-in block artifact at ${artifact.relativeDir} is missing its source type name.`);
18
+ }
19
+ return {
20
+ blockJsonFile: path.join(artifact.relativeDir, "block.json"),
21
+ ...(emitsSchemaDocuments
22
+ ? {
23
+ jsonSchemaFile: path.join(artifact.relativeDir, "typia.schema.json"),
24
+ openApiFile: path.join(artifact.relativeDir, "typia.openapi.json"),
25
+ }
26
+ : {}),
27
+ manifestFile: path.join(artifact.relativeDir, "typia.manifest.json"),
28
+ phpValidatorFile: path.join(artifact.relativeDir, "typia-validator.php"),
29
+ projectRoot: projectDir,
30
+ sourceTypeName,
31
+ typesFile: path.join(artifact.relativeDir, "types.ts"),
32
+ };
33
+ });
34
+ }
35
+ /**
36
+ * Resolve the canonical REST sync input for a persistence-enabled scaffold.
37
+ */
38
+ export function buildBuiltInPersistenceRestSyncOptions(projectDir, templateId, variables) {
39
+ if (!emitsBuiltInPersistenceArtifacts(templateId, variables)) {
40
+ return null;
41
+ }
42
+ const outputDir = templateId === "persistence"
43
+ ? "src"
44
+ : path.join("src", "blocks", variables.slugKebabCase);
45
+ return {
46
+ apiTypesFile: path.join(outputDir, "api-types.ts"),
47
+ outputDir,
48
+ projectDir,
49
+ variables,
50
+ };
51
+ }
52
+ /**
53
+ * Collect every compiler-derived path without executing the compiler.
54
+ */
55
+ export function collectBuiltInCompilerArtifactPaths(templateId, variables) {
56
+ if (!isBuiltInTemplateId(templateId)) {
57
+ return [];
58
+ }
59
+ const artifacts = buildBuiltInBlockArtifacts({ templateId, variables });
60
+ const blockOptions = buildBuiltInBlockMetadataSyncOptions(".", templateId, artifacts);
61
+ const files = new Set(blockOptions.flatMap((options) => [
62
+ options.blockJsonFile,
63
+ options.manifestFile,
64
+ options.phpValidatorFile,
65
+ options.jsonSchemaFile,
66
+ options.openApiFile,
67
+ ]
68
+ .filter((value) => value !== undefined)
69
+ .map(normalizeArtifactPath)));
70
+ const persistenceOptions = buildBuiltInPersistenceRestSyncOptions(".", templateId, variables);
71
+ if (persistenceOptions) {
72
+ const plan = buildPersistenceRestArtifactPlan(persistenceOptions);
73
+ for (const schema of plan.schemas) {
74
+ files.add(normalizeArtifactPath(schema.jsonSchemaFile));
75
+ files.add(normalizeArtifactPath(schema.openApiFile));
76
+ }
77
+ files.add(normalizeArtifactPath(plan.openApiFile));
78
+ files.add(normalizeArtifactPath(plan.clientFile));
79
+ }
80
+ return [...files];
81
+ }
@@ -14,6 +14,11 @@ export declare function getOptionalSyncScriptNames(templateId: string, options?:
14
14
  * Formats optional onboarding sync commands for the selected package manager.
15
15
  */
16
16
  export declare function getOptionalOnboardingSteps(packageManager: PackageManagerId, templateId: string, options?: SyncOnboardingOptions): string[];
17
+ /**
18
+ * Builds the warning shown when compiler-derived artifacts must be refreshed
19
+ * after dependencies become available.
20
+ */
21
+ export declare function getDeferredCompilerArtifactsWarning(packageManager: PackageManagerId, templateId: string, options?: SyncOnboardingOptions): string;
17
22
  /**
18
23
  * Returns the quick-start note explaining the scaffold's primary local loop.
19
24
  */
@@ -40,6 +40,17 @@ export function getOptionalSyncScriptNames(templateId, options = {}) {
40
40
  export function getOptionalOnboardingSteps(packageManager, templateId, options = {}) {
41
41
  return getOptionalSyncScriptNames(templateId, options).map((scriptName) => formatRunScript(packageManager, scriptName));
42
42
  }
43
+ /**
44
+ * Builds the warning shown when compiler-derived artifacts must be refreshed
45
+ * after dependencies become available.
46
+ */
47
+ export function getDeferredCompilerArtifactsWarning(packageManager, templateId, options = {}) {
48
+ const syncSteps = getOptionalOnboardingSteps(packageManager, templateId, options);
49
+ const followUp = syncSteps.length > 0
50
+ ? `, then run ${syncSteps.map((step) => `\`${step}\``).join(", then ")} before build or typecheck`
51
+ : " before build or typecheck";
52
+ return `Compiler-derived artifacts were deferred because compiler dependencies are unavailable. Install dependencies${followUp}.`;
53
+ }
43
54
  /**
44
55
  * Returns the quick-start note explaining the scaffold's primary local loop.
45
56
  */
@@ -58,9 +69,9 @@ export function getQuickStartWorkflowNote(packageManager, templateId = "basic",
58
69
  return `${devCommand} is the primary local entry point for this template. Use ${startCommand} for the one-shot startup flow, and ${doctorCommand} when you want a quick verification pass before build or commit.`;
59
70
  }
60
71
  if (templateHasPersistenceSync(templateId, options)) {
61
- return `${devCommand} keeps the editor, type-derived artifacts, and REST-derived artifacts moving together during local development. Use ${startCommand} for a one-shot sync plus editor startup, and ${doctorCommand} when you want an explicit verification pass before build or commit.`;
72
+ return `${devCommand} runs a full generated-artifact sync before starting the watchers, then keeps the editor, type-derived artifacts, and REST-derived artifacts moving together during local development. Use ${startCommand} for a one-shot sync plus editor startup, and ${doctorCommand} when you want an explicit verification pass before build or commit.`;
62
73
  }
63
- return `${devCommand} keeps the editor and type-derived artifacts moving together during local development. Use ${startCommand} for a one-shot sync plus editor startup, and ${doctorCommand} when you want an explicit verification pass before build or commit.`;
74
+ return `${devCommand} runs a full generated-artifact sync before starting the watchers, then keeps the editor and type-derived artifacts moving together during local development. Use ${startCommand} for a one-shot sync plus editor startup, and ${doctorCommand} when you want an explicit verification pass before build or commit.`;
64
75
  }
65
76
  /**
66
77
  * Returns the onboarding note explaining when manual sync is optional.
@@ -154,5 +154,9 @@ export type PersistenceScaffoldTemplateVariablesLike = ScaffoldTemplateVariableG
154
154
  export declare function attachScaffoldTemplateVariableGroups<TVariables extends Record<string, string>>(variables: TVariables, groups: ScaffoldTemplateVariableGroups): TVariables & ScaffoldTemplateVariableGroupsCarrier;
155
155
  export declare function getScaffoldTemplateVariableGroups(variables: ScaffoldTemplateVariableGroupsCarrier): ScaffoldTemplateVariableGroups;
156
156
  export declare function isCompoundPersistenceEnabled(variables: ScaffoldTemplateVariableGroupsCarrier): boolean;
157
+ /**
158
+ * Return whether a built-in scaffold family emits compiler-derived REST files.
159
+ */
160
+ export declare function emitsBuiltInPersistenceArtifacts(templateId: ScaffoldTemplateFamily, variables: ScaffoldTemplateVariableGroupsCarrier): boolean;
157
161
  export declare function getScaffoldAlternateRenderTargets(variables: ScaffoldTemplateVariableGroupsCarrier): ScaffoldAlternateRenderTargetVariableGroup;
158
162
  export {};
@@ -15,6 +15,13 @@ export function isCompoundPersistenceEnabled(variables) {
15
15
  const compound = getScaffoldTemplateVariableGroups(variables).compound;
16
16
  return compound.enabled && compound.persistenceEnabled;
17
17
  }
18
+ /**
19
+ * Return whether a built-in scaffold family emits compiler-derived REST files.
20
+ */
21
+ export function emitsBuiltInPersistenceArtifacts(templateId, variables) {
22
+ return (templateId === "persistence" ||
23
+ (templateId === "compound" && isCompoundPersistenceEnabled(variables)));
24
+ }
18
25
  export function getScaffoldAlternateRenderTargets(variables) {
19
26
  return getScaffoldTemplateVariableGroups(variables).alternateRenderTargets;
20
27
  }
@@ -172,6 +172,8 @@ interface ScaffoldProjectOptions {
172
172
  profile?: CreateProfileId;
173
173
  projectDir: string;
174
174
  repositoryReference?: string;
175
+ /** Whether compiler-backed metadata and REST artifacts should be seeded. */
176
+ seedCompilerArtifacts?: boolean;
175
177
  templateId: string;
176
178
  variant?: string;
177
179
  withMigrationUi?: boolean;
@@ -204,4 +206,4 @@ export declare function isCreateProfileId(value: string): value is CreateProfile
204
206
  * profile list for CLI diagnostics.
205
207
  */
206
208
  export declare function resolveCreateProfileId(profile?: string): CreateProfileId | undefined;
207
- export declare function scaffoldProject({ projectDir, templateId, answers, alternateRenderTargets, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, profile, repositoryReference, cwd, allowExistingDir, noInstall, installDependencies, onProgress, variant, withMigrationUi, withTestPreset, withWpEnv, wpVersion, }: ScaffoldProjectOptions): Promise<ScaffoldProjectResult>;
209
+ export declare function scaffoldProject({ projectDir, templateId, answers, alternateRenderTargets, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, profile, repositoryReference, seedCompilerArtifacts, cwd, allowExistingDir, noInstall, installDependencies, onProgress, variant, withMigrationUi, withTestPreset, withWpEnv, wpVersion, }: ScaffoldProjectOptions): Promise<ScaffoldProjectResult>;
@@ -77,7 +77,7 @@ async function applyCreateProfile({ profile, projectDir, }) {
77
77
  async function reportScaffoldProgress(onProgress, event) {
78
78
  await onProgress?.(event);
79
79
  }
80
- export async function scaffoldProject({ projectDir, templateId, answers, alternateRenderTargets, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, profile, repositoryReference, cwd = process.cwd(), allowExistingDir = false, noInstall = false, installDependencies = undefined, onProgress = undefined, variant, withMigrationUi = false, withTestPreset = false, withWpEnv = false, wpVersion, }) {
80
+ export async function scaffoldProject({ projectDir, templateId, answers, alternateRenderTargets, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, profile, repositoryReference, seedCompilerArtifacts = true, cwd = process.cwd(), allowExistingDir = false, noInstall = false, installDependencies = undefined, onProgress = undefined, variant, withMigrationUi = false, withTestPreset = false, withWpEnv = false, wpVersion, }) {
81
81
  const resolvedTemplateId = normalizeTemplateSelection(templateId);
82
82
  const resolvedPackageManager = getPackageManager(packageManager).id;
83
83
  const isBuiltInTemplate = isBuiltInTemplateId(resolvedTemplateId);
@@ -123,6 +123,7 @@ export async function scaffoldProject({ projectDir, templateId, answers, alterna
123
123
  installDependencies,
124
124
  onProgress,
125
125
  rendered,
126
+ seedCompilerArtifacts,
126
127
  });
127
128
  }
128
129
  if (externalLayerSource || externalLayerId) {
@@ -29,5 +29,5 @@ export function getStarterManifestFiles(templateId, variables) {
29
29
  * convention.
30
30
  */
31
31
  export function stringifyStarterManifest(document) {
32
- return `${JSON.stringify(document, null, "\t")}\n`;
32
+ return JSON.stringify(document, null, "\t");
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/project-tools",
3
- "version": "0.24.11",
3
+ "version": "0.24.13",
4
4
  "description": "Project orchestration and programmatic tooling for wp-typia",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -126,8 +126,8 @@
126
126
  "postpack": "node ./scripts/publish-manifest.mjs restore",
127
127
  "test": "bun run build && bun test tests/*.test.ts",
128
128
  "test:quick": "bun run build && bun test tests/workspace-add.test.ts tests/cli-add-workspace-ability.test.ts tests/cli-add-workspace-ai.test.ts tests/workspace-doctor.test.ts tests/scaffold-compound.test.ts",
129
- "test:scaffold-core": "bun run build && bun test tests/block-generator-service.test.ts tests/built-in-block-artifacts.test.ts tests/scaffold-basic.test.ts tests/scaffold-persistence.test.ts tests/template-source.test.ts tests/init-command.test.ts tests/package-versions.test.ts tests/cli-entry.test.ts tests/cli-prompt.test.ts tests/import-policy.test.ts tests/wordpress-ai-spec.test.ts tests/typia-llm.test.ts",
130
- "test:workspace": "bun run build && bun test tests/workspace-add.test.ts tests/cli-add-workspace-ability.test.ts tests/cli-add-workspace-ai.test.ts tests/workspace-doctor.test.ts",
129
+ "test:scaffold-core": "bun run build && bun test tests/block-generator-service.test.ts tests/built-in-block-artifacts.test.ts tests/cli-doctor-boundaries.test.ts tests/cli-doctor-standalone-shared.test.ts tests/scaffold-basic.test.ts tests/scaffold-persistence.test.ts tests/template-source.test.ts tests/init-command.test.ts tests/package-versions.test.ts tests/cli-entry.test.ts tests/cli-prompt.test.ts tests/import-policy.test.ts tests/wordpress-ai-spec.test.ts tests/typia-llm.test.ts",
130
+ "test:workspace": "bun run build && bun test tests/cli-add-workspace-mutation.test.ts tests/cli-add-workspace-boundaries.test.ts tests/workspace-add.test.ts tests/cli-add-workspace-ability.test.ts tests/cli-add-workspace-ai.test.ts tests/workspace-doctor.test.ts",
131
131
  "test:compound": "bun run build && bun test tests/scaffold-compound.test.ts",
132
132
  "test:migration-planning": "bun run build && bun test tests/migration-init.test.ts tests/migration-config.test.ts tests/migration-plan-wizard.test.ts",
133
133
  "test:migration-execution": "bun run build && bun test tests/migration-scaffold-diff.test.ts tests/migration-doctor.test.ts tests/migration-fixtures-fuzz.test.ts",
@@ -166,9 +166,9 @@
166
166
  },
167
167
  "dependencies": {
168
168
  "@wp-typia/api-client": "^0.4.6",
169
- "@wp-typia/block-runtime": "^0.7.1",
169
+ "@wp-typia/block-runtime": "^0.7.2",
170
170
  "@wp-typia/rest": "^0.3.14",
171
- "@wp-typia/block-types": "^0.3.5",
171
+ "@wp-typia/block-types": "^0.4.0",
172
172
  "mustache": "^4.2.0",
173
173
  "npm-package-arg": "^13.0.0",
174
174
  "semver": "^7.7.3",
@@ -347,7 +347,7 @@ function createCompoundChildStarterManifest(
347
347
  }
348
348
 
349
349
  function stringifyStarterManifest( document: StarterManifestDocument ): string {
350
- return `${ JSON.stringify( document, null, '\t' ) }\n`;
350
+ return JSON.stringify( document, null, '\t' );
351
351
  }
352
352
 
353
353
  function insertBeforeMarker( filePath: string, marker: string, insertionLines: string[] ) {
@@ -43,6 +43,7 @@
43
43
  "@wordpress/block-editor": "~15.19.0",
44
44
  "@wordpress/blocks": "~15.19.0",
45
45
  "@wordpress/components": "^30.2.0",
46
+ "@wordpress/data": "~10.46.0",
46
47
  "@wordpress/element": "^6.29.0",
47
48
  "@wordpress/i18n": "^6.2.0",
48
49
  "@wordpress/interactivity": "^6.29.0"
@@ -40,6 +40,7 @@
40
40
  "@wordpress/block-editor": "~15.19.0",
41
41
  "@wordpress/blocks": "~15.19.0",
42
42
  "@wordpress/components": "^30.2.0",
43
+ "@wordpress/data": "~10.46.0",
43
44
  "@wordpress/element": "^6.29.0",
44
45
  "@wordpress/i18n": "^6.2.0",
45
46
  "@wordpress/interactivity": "^6.29.0"