@wp-typia/project-tools 0.22.3 → 0.22.4

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 (40) hide show
  1. package/dist/runtime/cli-add-block-json.d.ts +31 -0
  2. package/dist/runtime/cli-add-block-json.js +65 -0
  3. package/dist/runtime/cli-add-collision.d.ts +129 -0
  4. package/dist/runtime/cli-add-collision.js +293 -0
  5. package/dist/runtime/cli-add-filesystem.d.ts +29 -0
  6. package/dist/runtime/cli-add-filesystem.js +77 -0
  7. package/dist/runtime/cli-add-help.d.ts +4 -0
  8. package/dist/runtime/cli-add-help.js +41 -0
  9. package/dist/runtime/cli-add-shared.d.ts +6 -304
  10. package/dist/runtime/cli-add-shared.js +6 -524
  11. package/dist/runtime/cli-add-types.d.ts +247 -0
  12. package/dist/runtime/cli-add-types.js +64 -0
  13. package/dist/runtime/cli-add-validation.d.ts +87 -0
  14. package/dist/runtime/cli-add-validation.js +147 -0
  15. package/dist/runtime/cli-add-workspace-ability-scaffold.js +46 -72
  16. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +35 -61
  17. package/dist/runtime/cli-add-workspace-ai-scaffold.js +53 -57
  18. package/dist/runtime/cli-add-workspace-ai-templates.js +2 -0
  19. package/dist/runtime/cli-add-workspace-mutation.d.ts +30 -0
  20. package/dist/runtime/cli-add-workspace-mutation.js +60 -0
  21. package/dist/runtime/cli-add-workspace.js +1 -79
  22. package/dist/runtime/cli-add.d.ts +2 -2
  23. package/dist/runtime/cli-add.js +2 -2
  24. package/dist/runtime/cli-doctor-workspace-blocks.js +1 -66
  25. package/dist/runtime/index.d.ts +2 -0
  26. package/dist/runtime/index.js +1 -0
  27. package/dist/runtime/migration-utils.d.ts +2 -1
  28. package/dist/runtime/migration-utils.js +3 -11
  29. package/dist/runtime/package-managers.d.ts +19 -0
  30. package/dist/runtime/package-managers.js +62 -0
  31. package/dist/runtime/template-source-cache.d.ts +59 -0
  32. package/dist/runtime/template-source-cache.js +160 -0
  33. package/dist/runtime/ts-source-masking.d.ts +28 -0
  34. package/dist/runtime/ts-source-masking.js +104 -0
  35. package/dist/runtime/typia-llm.d.ts +9 -1
  36. package/dist/runtime/typia-llm.js +20 -5
  37. package/dist/runtime/workspace-inventory.js +116 -59
  38. package/dist/runtime/workspace-project.d.ts +1 -1
  39. package/dist/runtime/workspace-project.js +2 -10
  40. package/package.json +2 -2
@@ -1,305 +1,7 @@
1
- import { type HookedBlockPositionId } from "./hooked-blocks.js";
2
- import { type WorkspaceInventory } from "./workspace-inventory.js";
3
- import { type WorkspaceProject } from "./workspace-project.js";
4
1
  export { normalizeBlockSlug, } from "./scaffold-identifiers.js";
5
- /**
6
- * Supported top-level `wp-typia add` kinds exposed by the canonical CLI.
7
- */
8
- export declare const ADD_KIND_IDS: readonly ["admin-view", "block", "variation", "style", "transform", "pattern", "binding-source", "rest-resource", "ability", "ai-feature", "hooked-block", "editor-plugin"];
9
- export type AddKindId = (typeof ADD_KIND_IDS)[number];
10
- /**
11
- * Supported plugin-level REST resource methods accepted by
12
- * `wp-typia add rest-resource --methods`.
13
- */
14
- export declare const REST_RESOURCE_METHOD_IDS: readonly ["list", "read", "create", "update", "delete"];
15
- export type RestResourceMethodId = (typeof REST_RESOURCE_METHOD_IDS)[number];
16
- /**
17
- * Supported editor-plugin shell surfaces accepted by
18
- * `wp-typia add editor-plugin --slot`.
19
- */
20
- export declare const EDITOR_PLUGIN_SLOT_IDS: readonly ["sidebar", "document-setting-panel"];
21
- export type EditorPluginSlotId = (typeof EDITOR_PLUGIN_SLOT_IDS)[number];
22
- export declare const EDITOR_PLUGIN_SLOT_ALIASES: {
23
- readonly PluginDocumentSettingPanel: "document-setting-panel";
24
- readonly PluginSidebar: "sidebar";
25
- readonly "document-setting-panel": "document-setting-panel";
26
- readonly sidebar: "sidebar";
27
- };
28
- export declare function resolveEditorPluginSlotAlias(slot: string): EditorPluginSlotId | undefined;
29
- /**
30
- * Supported built-in block families accepted by `wp-typia add block --template`.
31
- */
32
- export declare const ADD_BLOCK_TEMPLATE_IDS: readonly ["basic", "interactivity", "persistence", "compound"];
33
- export type AddBlockTemplateId = (typeof ADD_BLOCK_TEMPLATE_IDS)[number];
34
- export declare const REST_RESOURCE_NAMESPACE_PATTERN: RegExp;
35
- export interface RunAddVariationCommandOptions {
36
- blockName: string;
37
- cwd?: string;
38
- variationName: string;
39
- }
40
- /**
41
- * Options for `wp-typia add style`.
42
- *
43
- * @property blockName Existing workspace block slug that owns the style.
44
- * @property cwd Working directory used to resolve the nearest official workspace.
45
- * Defaults to `process.cwd()`.
46
- * @property styleName Human-entered style name that will be normalized into the
47
- * generated style slug.
48
- */
49
- export interface RunAddBlockStyleCommandOptions {
50
- blockName: string;
51
- cwd?: string;
52
- styleName: string;
53
- }
54
- /**
55
- * Options for `wp-typia add transform`.
56
- *
57
- * @property cwd Working directory used to resolve the nearest official workspace.
58
- * Defaults to `process.cwd()`.
59
- * @property fromBlockName Full `namespace/block` source block name accepted by
60
- * WordPress block transform definitions.
61
- * @property toBlockName Existing workspace block slug or full block name that
62
- * owns the generated transform.
63
- * @property transformName Human-entered transform name that will be normalized
64
- * into the generated transform slug.
65
- */
66
- export interface RunAddBlockTransformCommandOptions {
67
- cwd?: string;
68
- fromBlockName: string;
69
- toBlockName: string;
70
- transformName: string;
71
- }
72
- export interface RunAddPatternCommandOptions {
73
- cwd?: string;
74
- patternName: string;
75
- }
76
- export interface RunAddBindingSourceCommandOptions {
77
- attributeName?: string;
78
- blockName?: string;
79
- bindingSourceName: string;
80
- cwd?: string;
81
- }
82
- export interface RunAddRestResourceCommandOptions {
83
- cwd?: string;
84
- methods?: string;
85
- namespace?: string;
86
- restResourceName: string;
87
- }
88
- /**
89
- * Options for `wp-typia add admin-view`.
90
- *
91
- * @property adminViewName Human-entered admin screen name that will be
92
- * normalized into the generated slug.
93
- * @property cwd Working directory used to resolve the nearest official workspace.
94
- * Defaults to `process.cwd()`.
95
- * @property source Optional data source locator. `rest-resource:<slug>` wires
96
- * the generated screen to an existing list-capable REST resource.
97
- * `core-data:<kind>/<name>` binds the screen to a supported WordPress-owned
98
- * entity collection such as `core-data:postType/post`.
99
- */
100
- export interface RunAddAdminViewCommandOptions {
101
- adminViewName: string;
102
- cwd?: string;
103
- source?: string;
104
- }
105
- /**
106
- * Options for `wp-typia add ability`.
107
- *
108
- * @property cwd Working directory used to resolve the nearest official workspace.
109
- * Defaults to `process.cwd()`.
110
- * @property abilityName Human-entered workflow ability name that will be
111
- * normalized into the generated slug.
112
- */
113
- export interface RunAddAbilityCommandOptions {
114
- abilityName: string;
115
- cwd?: string;
116
- }
117
- export interface RunAddAiFeatureCommandOptions {
118
- aiFeatureName: string;
119
- cwd?: string;
120
- namespace?: string;
121
- }
122
- export interface RunAddHookedBlockCommandOptions {
123
- anchorBlockName: string;
124
- blockName: string;
125
- cwd?: string;
126
- position: string;
127
- }
128
- /**
129
- * Options for `wp-typia add editor-plugin`.
130
- *
131
- * @property cwd Working directory used to resolve the nearest official workspace.
132
- * Defaults to `process.cwd()`.
133
- * @property editorPluginName Human-entered editor plugin name that will be
134
- * normalized into the generated slug.
135
- * @property slot Optional editor shell slot. Defaults to `sidebar`.
136
- */
137
- export interface RunAddEditorPluginCommandOptions {
138
- cwd?: string;
139
- editorPluginName: string;
140
- slot?: string;
141
- }
142
- export interface RunAddBlockCommandOptions {
143
- alternateRenderTargets?: string;
144
- blockName: string;
145
- cwd?: string;
146
- dataStorageMode?: string;
147
- externalLayerId?: string;
148
- externalLayerSource?: string;
149
- innerBlocksPreset?: string;
150
- persistencePolicy?: string;
151
- selectExternalLayerId?: (options: Array<{
152
- description?: string;
153
- extends: string[];
154
- id: string;
155
- }>) => Promise<string>;
156
- templateId?: string;
157
- }
158
- export interface WorkspaceMutationSnapshot {
159
- /** Snapshots of file contents taken before the mutation starts. */
160
- fileSources: Array<{
161
- /** Absolute file path recorded for rollback. */
162
- filePath: string;
163
- /** Previous file contents, or `null` when the file did not exist. */
164
- source: string | null;
165
- }>;
166
- /** Snapshot directories created while seeding migration history. */
167
- snapshotDirs: string[];
168
- /** Files or directories created by the mutation that should be removed on rollback. */
169
- targetPaths: string[];
170
- }
171
- export declare function assertValidGeneratedSlug(label: string, slug: string, usage: string): string;
172
- export declare function assertValidRestResourceNamespace(namespace: string): string;
173
- export declare function resolveRestResourceNamespace(workspaceNamespace: string, namespace?: string): string;
174
- export declare function assertValidRestResourceMethods(methods?: string): RestResourceMethodId[];
175
- export declare function assertValidHookedBlockPosition(position: string): HookedBlockPositionId;
176
- export declare function getWorkspaceBootstrapPath(workspace: WorkspaceProject): string;
177
- export declare function buildWorkspacePhpPrefix(workspacePhpPrefix: string, slug: string): string;
178
- export declare function isAddBlockTemplateId(value: string): value is AddBlockTemplateId;
179
- export declare function quoteTsString(value: string): string;
180
- /**
181
- * Apply a text transform to an existing file only when the contents change.
182
- */
183
- export declare function patchFile(filePath: string, transform: (source: string) => string): Promise<void>;
184
- /**
185
- * Read a file when it exists and otherwise return `null`.
186
- */
187
- export declare function readOptionalFile(filePath: string): Promise<string | null>;
188
- /**
189
- * Restore a file to its captured source, deleting it when the snapshot was `null`.
190
- */
191
- export declare function restoreOptionalFile(filePath: string, source: string | null): Promise<void>;
192
- /**
193
- * Capture the current contents of a set of workspace files for rollback.
194
- */
195
- export declare function snapshotWorkspaceFiles(filePaths: string[]): Promise<WorkspaceMutationSnapshot["fileSources"]>;
196
- /**
197
- * Undo a partially applied workspace mutation from a captured snapshot.
198
- */
199
- export declare function rollbackWorkspaceMutation(snapshot: WorkspaceMutationSnapshot): Promise<void>;
200
- export declare function resolveWorkspaceBlock(inventory: WorkspaceInventory, blockSlug: string): WorkspaceInventory["blocks"][number];
201
- export declare function assertValidHookAnchor(anchorBlockName: string): string;
202
- /**
203
- * Validate and normalize the editor plugin shell slot.
204
- *
205
- * @param slot Optional shell slot. Defaults to `sidebar`.
206
- * @returns The canonical editor plugin slot id.
207
- * @throws {Error} When the slot is not supported by the workspace scaffold.
208
- */
209
- export declare function assertValidEditorPluginSlot(slot?: string): EditorPluginSlotId;
210
- export declare function readWorkspaceBlockJson(projectDir: string, blockSlug: string): {
211
- blockJson: Record<string, unknown>;
212
- blockJsonPath: string;
213
- };
214
- export declare function getMutableBlockHooks(blockJson: Record<string, unknown>, blockJsonRelativePath: string): Record<string, string>;
215
- type ScaffoldFilesystemCollision = {
216
- label: string;
217
- relativePath: string;
218
- };
219
- type ScaffoldInventoryCollision<TEntry> = {
220
- entries: readonly TEntry[];
221
- exists: (entry: TEntry) => boolean;
222
- message: string;
223
- };
224
- /**
225
- * Ensure scaffold targets do not already exist on disk or in workspace inventory.
226
- *
227
- * @param options Collision checks to run before writing scaffold files.
228
- * @throws {Error} When a filesystem path or inventory entry already exists.
229
- */
230
- export declare function assertScaffoldDoesNotExist<TEntry>(options: {
231
- projectDir: string;
232
- filesystemCollisions: readonly ScaffoldFilesystemCollision[];
233
- inventoryCollision?: ScaffoldInventoryCollision<TEntry>;
234
- }): void;
235
- /**
236
- * Ensure a block variation scaffold does not already exist.
237
- *
238
- * @param projectDir Absolute workspace root used to resolve scaffold paths.
239
- * @param blockSlug Existing workspace block slug that owns the variation.
240
- * @param variationSlug Normalized variation slug that would be created.
241
- * @param inventory Current workspace inventory used for duplicate detection.
242
- * @throws {Error} When the variation file or inventory entry already exists.
243
- */
244
- export declare function assertVariationDoesNotExist(projectDir: string, blockSlug: string, variationSlug: string, inventory: WorkspaceInventory): void;
245
- /**
246
- * Ensure a block style scaffold does not already exist.
247
- *
248
- * @param projectDir Absolute workspace root used to resolve scaffold paths.
249
- * @param blockSlug Existing workspace block slug that owns the style.
250
- * @param styleSlug Normalized style slug that would be created.
251
- * @param inventory Current workspace inventory used for duplicate detection.
252
- * @throws {Error} When the style file or inventory entry already exists.
253
- */
254
- export declare function assertBlockStyleDoesNotExist(projectDir: string, blockSlug: string, styleSlug: string, inventory: WorkspaceInventory): void;
255
- /**
256
- * Ensure a block transform scaffold does not already exist.
257
- *
258
- * @param projectDir Absolute workspace root used to resolve scaffold paths.
259
- * @param blockSlug Existing workspace block slug that owns the transform.
260
- * @param transformSlug Normalized transform slug that would be created.
261
- * @param inventory Current workspace inventory used for duplicate detection.
262
- * @throws {Error} When the transform file or inventory entry already exists.
263
- */
264
- export declare function assertBlockTransformDoesNotExist(projectDir: string, blockSlug: string, transformSlug: string, inventory: WorkspaceInventory): void;
265
- export declare function assertPatternDoesNotExist(projectDir: string, patternSlug: string, inventory: WorkspaceInventory): void;
266
- export declare function assertBindingSourceDoesNotExist(projectDir: string, bindingSourceSlug: string, inventory: WorkspaceInventory): void;
267
- export declare function assertRestResourceDoesNotExist(projectDir: string, restResourceSlug: string, inventory: WorkspaceInventory): void;
268
- /**
269
- * Ensure a DataViews admin screen scaffold does not already exist on disk or in
270
- * the workspace inventory.
271
- *
272
- * @param projectDir Workspace root directory.
273
- * @param adminViewSlug Normalized admin screen slug.
274
- * @param inventory Parsed workspace inventory.
275
- * @throws {Error} When the directory, PHP bootstrap, or inventory entry already exists.
276
- */
277
- export declare function assertAdminViewDoesNotExist(projectDir: string, adminViewSlug: string, inventory: WorkspaceInventory): void;
278
- /**
279
- * Ensure a workflow ability scaffold does not already exist on disk or in the
280
- * workspace inventory.
281
- *
282
- * The check covers the generated `src/abilities/<slug>` directory,
283
- * `inc/abilities/<slug>.php`, and any matching `inventory.abilities` entry.
284
- *
285
- * @param projectDir Workspace root directory.
286
- * @param abilitySlug Normalized workflow ability slug.
287
- * @param inventory Parsed workspace inventory.
288
- * @throws {Error} When the ability directory, PHP bootstrap, or inventory entry already exists.
289
- */
290
- export declare function assertAbilityDoesNotExist(projectDir: string, abilitySlug: string, inventory: WorkspaceInventory): void;
291
- export declare function assertAiFeatureDoesNotExist(projectDir: string, aiFeatureSlug: string, inventory: WorkspaceInventory): void;
292
- /**
293
- * Ensure an editor plugin scaffold does not already exist on disk or in the
294
- * workspace inventory.
295
- *
296
- * @param projectDir Workspace root directory.
297
- * @param editorPluginSlug Normalized editor plugin slug.
298
- * @param inventory Parsed workspace inventory.
299
- * @throws {Error} When the directory or inventory entry already exists.
300
- */
301
- export declare function assertEditorPluginDoesNotExist(projectDir: string, editorPluginSlug: string, inventory: WorkspaceInventory): void;
302
- /**
303
- * Returns help text for the canonical `wp-typia add` subcommands.
304
- */
305
- export declare function formatAddHelpText(): string;
2
+ export * from "./cli-add-types.js";
3
+ export * from "./cli-add-validation.js";
4
+ export * from "./cli-add-filesystem.js";
5
+ export * from "./cli-add-block-json.js";
6
+ export * from "./cli-add-collision.js";
7
+ export * from "./cli-add-help.js";