@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,525 +1,7 @@
1
- import fs from "node:fs";
2
- import { promises as fsp } from "node:fs";
3
- import path from "node:path";
4
- import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
5
- import { HOOKED_BLOCK_ANCHOR_PATTERN, HOOKED_BLOCK_POSITION_IDS, } from "./hooked-blocks.js";
6
- import { toSnakeCase, } from "./string-case.js";
7
- import { WORKSPACE_TEMPLATE_PACKAGE, } from "./workspace-project.js";
8
1
  export { normalizeBlockSlug, } from "./scaffold-identifiers.js";
9
- /**
10
- * Supported top-level `wp-typia add` kinds exposed by the canonical CLI.
11
- */
12
- export const ADD_KIND_IDS = [
13
- "admin-view",
14
- "block",
15
- "variation",
16
- "style",
17
- "transform",
18
- "pattern",
19
- "binding-source",
20
- "rest-resource",
21
- "ability",
22
- "ai-feature",
23
- "hooked-block",
24
- "editor-plugin",
25
- ];
26
- /**
27
- * Supported plugin-level REST resource methods accepted by
28
- * `wp-typia add rest-resource --methods`.
29
- */
30
- export const REST_RESOURCE_METHOD_IDS = [
31
- "list",
32
- "read",
33
- "create",
34
- "update",
35
- "delete",
36
- ];
37
- /**
38
- * Supported editor-plugin shell surfaces accepted by
39
- * `wp-typia add editor-plugin --slot`.
40
- */
41
- export const EDITOR_PLUGIN_SLOT_IDS = ["sidebar", "document-setting-panel"];
42
- export const EDITOR_PLUGIN_SLOT_ALIASES = {
43
- PluginDocumentSettingPanel: "document-setting-panel",
44
- PluginSidebar: "sidebar",
45
- "document-setting-panel": "document-setting-panel",
46
- sidebar: "sidebar",
47
- };
48
- export function resolveEditorPluginSlotAlias(slot) {
49
- const trimmed = slot.trim();
50
- if (!Object.prototype.hasOwnProperty.call(EDITOR_PLUGIN_SLOT_ALIASES, trimmed)) {
51
- return undefined;
52
- }
53
- return EDITOR_PLUGIN_SLOT_ALIASES[trimmed];
54
- }
55
- /**
56
- * Supported built-in block families accepted by `wp-typia add block --template`.
57
- */
58
- export const ADD_BLOCK_TEMPLATE_IDS = [
59
- "basic",
60
- "interactivity",
61
- "persistence",
62
- "compound",
63
- ];
64
- const WORKSPACE_GENERATED_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
65
- export const REST_RESOURCE_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]*(?:\/[a-z0-9-]+)+$/u;
66
- export function assertValidGeneratedSlug(label, slug, usage) {
67
- if (!slug) {
68
- throw new Error(`${label} is required. Use \`${usage}\`.`);
69
- }
70
- if (!WORKSPACE_GENERATED_SLUG_PATTERN.test(slug)) {
71
- throw new Error(`${label} must start with a letter and contain only lowercase letters, numbers, and hyphens.`);
72
- }
73
- return slug;
74
- }
75
- export function assertValidRestResourceNamespace(namespace) {
76
- const trimmed = namespace.trim();
77
- if (!trimmed) {
78
- throw new Error("REST resource namespace is required. Use `--namespace <vendor/v1>` or let the workspace default apply.");
79
- }
80
- if (!REST_RESOURCE_NAMESPACE_PATTERN.test(trimmed)) {
81
- throw new Error("REST resource namespace must use lowercase slash-separated segments like `demo-space/v1`.");
82
- }
83
- return trimmed;
84
- }
85
- export function resolveRestResourceNamespace(workspaceNamespace, namespace) {
86
- return assertValidRestResourceNamespace(namespace ?? `${workspaceNamespace}/v1`);
87
- }
88
- export function assertValidRestResourceMethods(methods) {
89
- const rawMethods = typeof methods === "string" && methods.trim().length > 0
90
- ? methods.split(",").map((value) => value.trim()).filter(Boolean)
91
- : ["list", "read", "create"];
92
- const normalizedMethods = Array.from(new Set(rawMethods));
93
- const invalidMethods = normalizedMethods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
94
- if (invalidMethods.length > 0) {
95
- throw new Error(`REST resource methods must be a comma-separated list of: ${REST_RESOURCE_METHOD_IDS.join(", ")}.`);
96
- }
97
- if (normalizedMethods.length === 0) {
98
- throw new Error("REST resource methods must include at least one of: list, read, create, update, delete.");
99
- }
100
- return normalizedMethods;
101
- }
102
- export function assertValidHookedBlockPosition(position) {
103
- if (HOOKED_BLOCK_POSITION_IDS.includes(position)) {
104
- return position;
105
- }
106
- throw new Error(`Hook position must be one of: ${HOOKED_BLOCK_POSITION_IDS.join(", ")}.`);
107
- }
108
- export function getWorkspaceBootstrapPath(workspace) {
109
- const workspaceBaseName = workspace.packageName.split("/").pop() ?? workspace.packageName;
110
- return path.join(workspace.projectDir, `${workspaceBaseName}.php`);
111
- }
112
- export function buildWorkspacePhpPrefix(workspacePhpPrefix, slug) {
113
- return toSnakeCase(`${workspacePhpPrefix}_${slug}`);
114
- }
115
- export function isAddBlockTemplateId(value) {
116
- return ADD_BLOCK_TEMPLATE_IDS.includes(value);
117
- }
118
- export function quoteTsString(value) {
119
- return JSON.stringify(value);
120
- }
121
- /**
122
- * Apply a text transform to an existing file only when the contents change.
123
- */
124
- export async function patchFile(filePath, transform) {
125
- const currentSource = await fsp.readFile(filePath, "utf8");
126
- const nextSource = transform(currentSource);
127
- if (nextSource !== currentSource) {
128
- await fsp.writeFile(filePath, nextSource, "utf8");
129
- }
130
- }
131
- /**
132
- * Read a file when it exists and otherwise return `null`.
133
- */
134
- export async function readOptionalFile(filePath) {
135
- if (!fs.existsSync(filePath)) {
136
- return null;
137
- }
138
- return fsp.readFile(filePath, "utf8");
139
- }
140
- /**
141
- * Restore a file to its captured source, deleting it when the snapshot was `null`.
142
- */
143
- export async function restoreOptionalFile(filePath, source) {
144
- if (source === null) {
145
- await fsp.rm(filePath, { force: true });
146
- return;
147
- }
148
- await fsp.mkdir(path.dirname(filePath), { recursive: true });
149
- await fsp.writeFile(filePath, source, "utf8");
150
- }
151
- /**
152
- * Capture the current contents of a set of workspace files for rollback.
153
- */
154
- export async function snapshotWorkspaceFiles(filePaths) {
155
- const uniquePaths = Array.from(new Set(filePaths));
156
- return Promise.all(uniquePaths.map(async (filePath) => ({
157
- filePath,
158
- source: await readOptionalFile(filePath),
159
- })));
160
- }
161
- /**
162
- * Undo a partially applied workspace mutation from a captured snapshot.
163
- */
164
- export async function rollbackWorkspaceMutation(snapshot) {
165
- for (const targetPath of snapshot.targetPaths) {
166
- await fsp.rm(targetPath, { force: true, recursive: true });
167
- }
168
- for (const snapshotDir of snapshot.snapshotDirs) {
169
- await fsp.rm(snapshotDir, { force: true, recursive: true });
170
- }
171
- for (const { filePath, source } of snapshot.fileSources) {
172
- await restoreOptionalFile(filePath, source);
173
- }
174
- }
175
- export function resolveWorkspaceBlock(inventory, blockSlug) {
176
- const block = inventory.blocks.find((entry) => entry.slug === blockSlug);
177
- if (!block) {
178
- throw new Error(`Unknown workspace block "${blockSlug}". Choose one of: ${inventory.blocks.map((entry) => entry.slug).join(", ")}`);
179
- }
180
- return block;
181
- }
182
- export function assertValidHookAnchor(anchorBlockName) {
183
- const trimmed = anchorBlockName.trim();
184
- if (!trimmed) {
185
- throw new Error("`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
186
- }
187
- if (!HOOKED_BLOCK_ANCHOR_PATTERN.test(trimmed)) {
188
- throw new Error("`wp-typia add hooked-block` requires --anchor <anchor-block-name> to use the full `namespace/slug` block name format.");
189
- }
190
- return trimmed;
191
- }
192
- /**
193
- * Validate and normalize the editor plugin shell slot.
194
- *
195
- * @param slot Optional shell slot. Defaults to `sidebar`.
196
- * @returns The canonical editor plugin slot id.
197
- * @throws {Error} When the slot is not supported by the workspace scaffold.
198
- */
199
- export function assertValidEditorPluginSlot(slot = "sidebar") {
200
- const alias = resolveEditorPluginSlotAlias(slot);
201
- if (alias) {
202
- return alias;
203
- }
204
- throw new Error(`Editor plugin slot must be one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")}. Legacy aliases: PluginSidebar, PluginDocumentSettingPanel.`);
205
- }
206
- export function readWorkspaceBlockJson(projectDir, blockSlug) {
207
- const blockJsonPath = path.join(projectDir, "src", "blocks", blockSlug, "block.json");
208
- if (!fs.existsSync(blockJsonPath)) {
209
- throw new Error(`Missing ${path.relative(projectDir, blockJsonPath)} for workspace block "${blockSlug}".`);
210
- }
211
- let blockJson;
212
- try {
213
- blockJson = parseScaffoldBlockMetadata(JSON.parse(fs.readFileSync(blockJsonPath, "utf8")));
214
- }
215
- catch (error) {
216
- throw new Error(error instanceof Error
217
- ? `Failed to parse ${path.relative(projectDir, blockJsonPath)}: ${error.message}`
218
- : `Failed to parse ${path.relative(projectDir, blockJsonPath)}.`);
219
- }
220
- return {
221
- blockJson,
222
- blockJsonPath,
223
- };
224
- }
225
- export function getMutableBlockHooks(blockJson, blockJsonRelativePath) {
226
- const blockHooks = blockJson.blockHooks;
227
- if (blockHooks === undefined) {
228
- const nextHooks = {};
229
- blockJson.blockHooks = nextHooks;
230
- return nextHooks;
231
- }
232
- if (!blockHooks || typeof blockHooks !== "object" || Array.isArray(blockHooks)) {
233
- throw new Error(`${blockJsonRelativePath} must define blockHooks as an object when present.`);
234
- }
235
- return blockHooks;
236
- }
237
- /**
238
- * Ensure scaffold targets do not already exist on disk or in workspace inventory.
239
- *
240
- * @param options Collision checks to run before writing scaffold files.
241
- * @throws {Error} When a filesystem path or inventory entry already exists.
242
- */
243
- export function assertScaffoldDoesNotExist(options) {
244
- for (const collision of options.filesystemCollisions) {
245
- const targetPath = path.join(options.projectDir, collision.relativePath);
246
- if (fs.existsSync(targetPath)) {
247
- throw new Error(`${collision.label} already exists at ${path.relative(options.projectDir, targetPath)}. Choose a different name.`);
248
- }
249
- }
250
- if (options.inventoryCollision &&
251
- options.inventoryCollision.entries.some(options.inventoryCollision.exists)) {
252
- throw new Error(options.inventoryCollision.message);
253
- }
254
- }
255
- /**
256
- * Ensure a block variation 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 variation.
260
- * @param variationSlug Normalized variation slug that would be created.
261
- * @param inventory Current workspace inventory used for duplicate detection.
262
- * @throws {Error} When the variation file or inventory entry already exists.
263
- */
264
- export function assertVariationDoesNotExist(projectDir, blockSlug, variationSlug, inventory) {
265
- assertScaffoldDoesNotExist({
266
- filesystemCollisions: [
267
- {
268
- label: "A variation",
269
- relativePath: path.join("src", "blocks", blockSlug, "variations", `${variationSlug}.ts`),
270
- },
271
- ],
272
- inventoryCollision: {
273
- entries: inventory.variations,
274
- exists: (entry) => entry.block === blockSlug && entry.slug === variationSlug,
275
- message: `A variation inventory entry already exists for ${blockSlug}/${variationSlug}. Choose a different name.`,
276
- },
277
- projectDir,
278
- });
279
- }
280
- /**
281
- * Ensure a block style scaffold does not already exist.
282
- *
283
- * @param projectDir Absolute workspace root used to resolve scaffold paths.
284
- * @param blockSlug Existing workspace block slug that owns the style.
285
- * @param styleSlug Normalized style slug that would be created.
286
- * @param inventory Current workspace inventory used for duplicate detection.
287
- * @throws {Error} When the style file or inventory entry already exists.
288
- */
289
- export function assertBlockStyleDoesNotExist(projectDir, blockSlug, styleSlug, inventory) {
290
- assertScaffoldDoesNotExist({
291
- filesystemCollisions: [
292
- {
293
- label: "A block style",
294
- relativePath: path.join("src", "blocks", blockSlug, "styles", `${styleSlug}.ts`),
295
- },
296
- ],
297
- inventoryCollision: {
298
- entries: inventory.blockStyles,
299
- exists: (entry) => entry.block === blockSlug && entry.slug === styleSlug,
300
- message: `A block style inventory entry already exists for ${blockSlug}/${styleSlug}. Choose a different name.`,
301
- },
302
- projectDir,
303
- });
304
- }
305
- /**
306
- * Ensure a block transform scaffold does not already exist.
307
- *
308
- * @param projectDir Absolute workspace root used to resolve scaffold paths.
309
- * @param blockSlug Existing workspace block slug that owns the transform.
310
- * @param transformSlug Normalized transform slug that would be created.
311
- * @param inventory Current workspace inventory used for duplicate detection.
312
- * @throws {Error} When the transform file or inventory entry already exists.
313
- */
314
- export function assertBlockTransformDoesNotExist(projectDir, blockSlug, transformSlug, inventory) {
315
- assertScaffoldDoesNotExist({
316
- filesystemCollisions: [
317
- {
318
- label: "A block transform",
319
- relativePath: path.join("src", "blocks", blockSlug, "transforms", `${transformSlug}.ts`),
320
- },
321
- ],
322
- inventoryCollision: {
323
- entries: inventory.blockTransforms,
324
- exists: (entry) => entry.block === blockSlug && entry.slug === transformSlug,
325
- message: `A block transform inventory entry already exists for ${blockSlug}/${transformSlug}. Choose a different name.`,
326
- },
327
- projectDir,
328
- });
329
- }
330
- export function assertPatternDoesNotExist(projectDir, patternSlug, inventory) {
331
- assertScaffoldDoesNotExist({
332
- filesystemCollisions: [
333
- {
334
- label: "A pattern",
335
- relativePath: path.join("src", "patterns", `${patternSlug}.php`),
336
- },
337
- ],
338
- inventoryCollision: {
339
- entries: inventory.patterns,
340
- exists: (entry) => entry.slug === patternSlug,
341
- message: `A pattern inventory entry already exists for ${patternSlug}. Choose a different name.`,
342
- },
343
- projectDir,
344
- });
345
- }
346
- export function assertBindingSourceDoesNotExist(projectDir, bindingSourceSlug, inventory) {
347
- assertScaffoldDoesNotExist({
348
- filesystemCollisions: [
349
- {
350
- label: "A binding source",
351
- relativePath: path.join("src", "bindings", bindingSourceSlug),
352
- },
353
- ],
354
- inventoryCollision: {
355
- entries: inventory.bindingSources,
356
- exists: (entry) => entry.slug === bindingSourceSlug,
357
- message: `A binding source inventory entry already exists for ${bindingSourceSlug}. Choose a different name.`,
358
- },
359
- projectDir,
360
- });
361
- }
362
- export function assertRestResourceDoesNotExist(projectDir, restResourceSlug, inventory) {
363
- assertScaffoldDoesNotExist({
364
- filesystemCollisions: [
365
- {
366
- label: "A REST resource",
367
- relativePath: path.join("src", "rest", restResourceSlug),
368
- },
369
- {
370
- label: "A REST resource bootstrap",
371
- relativePath: path.join("inc", "rest", `${restResourceSlug}.php`),
372
- },
373
- ],
374
- inventoryCollision: {
375
- entries: inventory.restResources,
376
- exists: (entry) => entry.slug === restResourceSlug,
377
- message: `A REST resource inventory entry already exists for ${restResourceSlug}. Choose a different name.`,
378
- },
379
- projectDir,
380
- });
381
- }
382
- /**
383
- * Ensure a DataViews admin screen scaffold does not already exist on disk or in
384
- * the workspace inventory.
385
- *
386
- * @param projectDir Workspace root directory.
387
- * @param adminViewSlug Normalized admin screen slug.
388
- * @param inventory Parsed workspace inventory.
389
- * @throws {Error} When the directory, PHP bootstrap, or inventory entry already exists.
390
- */
391
- export function assertAdminViewDoesNotExist(projectDir, adminViewSlug, inventory) {
392
- assertScaffoldDoesNotExist({
393
- filesystemCollisions: [
394
- {
395
- label: "An admin view",
396
- relativePath: path.join("src", "admin-views", adminViewSlug),
397
- },
398
- {
399
- label: "An admin view bootstrap",
400
- relativePath: path.join("inc", "admin-views", `${adminViewSlug}.php`),
401
- },
402
- ],
403
- inventoryCollision: {
404
- entries: inventory.adminViews,
405
- exists: (entry) => entry.slug === adminViewSlug,
406
- message: `An admin view inventory entry already exists for ${adminViewSlug}. Choose a different name.`,
407
- },
408
- projectDir,
409
- });
410
- }
411
- /**
412
- * Ensure a workflow ability scaffold does not already exist on disk or in the
413
- * workspace inventory.
414
- *
415
- * The check covers the generated `src/abilities/<slug>` directory,
416
- * `inc/abilities/<slug>.php`, and any matching `inventory.abilities` entry.
417
- *
418
- * @param projectDir Workspace root directory.
419
- * @param abilitySlug Normalized workflow ability slug.
420
- * @param inventory Parsed workspace inventory.
421
- * @throws {Error} When the ability directory, PHP bootstrap, or inventory entry already exists.
422
- */
423
- export function assertAbilityDoesNotExist(projectDir, abilitySlug, inventory) {
424
- assertScaffoldDoesNotExist({
425
- filesystemCollisions: [
426
- {
427
- label: "An ability scaffold",
428
- relativePath: path.join("src", "abilities", abilitySlug),
429
- },
430
- {
431
- label: "An ability bootstrap",
432
- relativePath: path.join("inc", "abilities", `${abilitySlug}.php`),
433
- },
434
- ],
435
- inventoryCollision: {
436
- entries: inventory.abilities,
437
- exists: (entry) => entry.slug === abilitySlug,
438
- message: `An ability inventory entry already exists for ${abilitySlug}. Choose a different name.`,
439
- },
440
- projectDir,
441
- });
442
- }
443
- export function assertAiFeatureDoesNotExist(projectDir, aiFeatureSlug, inventory) {
444
- assertScaffoldDoesNotExist({
445
- filesystemCollisions: [
446
- {
447
- label: "An AI feature",
448
- relativePath: path.join("src", "ai-features", aiFeatureSlug),
449
- },
450
- {
451
- label: "An AI feature bootstrap",
452
- relativePath: path.join("inc", "ai-features", `${aiFeatureSlug}.php`),
453
- },
454
- ],
455
- inventoryCollision: {
456
- entries: inventory.aiFeatures,
457
- exists: (entry) => entry.slug === aiFeatureSlug,
458
- message: `An AI feature inventory entry already exists for ${aiFeatureSlug}. Choose a different name.`,
459
- },
460
- projectDir,
461
- });
462
- }
463
- /**
464
- * Ensure an editor plugin scaffold does not already exist on disk or in the
465
- * workspace inventory.
466
- *
467
- * @param projectDir Workspace root directory.
468
- * @param editorPluginSlug Normalized editor plugin slug.
469
- * @param inventory Parsed workspace inventory.
470
- * @throws {Error} When the directory or inventory entry already exists.
471
- */
472
- export function assertEditorPluginDoesNotExist(projectDir, editorPluginSlug, inventory) {
473
- assertScaffoldDoesNotExist({
474
- filesystemCollisions: [
475
- {
476
- label: "An editor plugin",
477
- relativePath: path.join("src", "editor-plugins", editorPluginSlug),
478
- },
479
- ],
480
- inventoryCollision: {
481
- entries: inventory.editorPlugins,
482
- exists: (entry) => entry.slug === editorPluginSlug,
483
- message: `An editor plugin inventory entry already exists for ${editorPluginSlug}. Choose a different name.`,
484
- },
485
- projectDir,
486
- });
487
- }
488
- /**
489
- * Returns help text for the canonical `wp-typia add` subcommands.
490
- */
491
- export function formatAddHelpText() {
492
- return `Usage:
493
- wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]
494
- wp-typia add block <name> [--template <${ADD_BLOCK_TEMPLATE_IDS.join("|")}>] [--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>] [--dry-run]
495
- wp-typia add variation <name> --block <block-slug> [--dry-run]
496
- wp-typia add style <name> --block <block-slug> [--dry-run]
497
- wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]
498
- wp-typia add pattern <name> [--dry-run]
499
- wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]
500
- wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]
501
- wp-typia add ability <name> [--dry-run]
502
- wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]
503
- wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <${HOOKED_BLOCK_POSITION_IDS.join("|")}> [--dry-run]
504
- wp-typia add editor-plugin <name> [--slot <${EDITOR_PLUGIN_SLOT_IDS.join("|")}>] [--dry-run]
505
-
506
- Notes:
507
- \`wp-typia add\` runs only inside official ${WORKSPACE_TEMPLATE_PACKAGE} workspaces scaffolded via \`wp-typia create <project-dir> --template workspace\`.
508
- Pass \`--dry-run\` to preview the workspace files that would change without writing them.
509
- Interactive add flows let you choose a template when \`--template\` is omitted; non-interactive runs default to \`basic\`.
510
- \`add admin-view\` scaffolds an opt-in DataViews-powered WordPress admin screen under \`src/admin-views/\`.
511
- Pass \`--source rest-resource:<slug>\` to reuse a list-capable REST resource.
512
- Pass \`--source core-data:postType/post\` or \`--source core-data:taxonomy/category\` to bind a WordPress-owned entity collection.
513
- Public installs currently gate this workflow until \`@wp-typia/dataviews\` is published to npm.
514
- \`query-loop\` is a create-time scaffold family. Use \`wp-typia create <project-dir> --template query-loop\` instead of \`wp-typia add block\`.
515
- \`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
516
- \`add style\` registers a Block Styles option for an existing generated block.
517
- \`add transform\` adds a block-to-block transform into an existing generated block.
518
- \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/\`.
519
- \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare an end-to-end bindable attribute on an existing generated block.
520
- \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`.
521
- \`add ability\` scaffolds typed workflow abilities under \`src/abilities/\` and server registration under \`inc/abilities/\`.
522
- \`add ai-feature\` scaffolds server-owned AI feature endpoints under \`src/ai-features/\` and PHP route glue under \`inc/ai-features/\`.
523
- \`add hooked-block\` patches an existing workspace block's \`block.json\` \`blockHooks\` metadata.
524
- \`add editor-plugin\` scaffolds a document-level editor extension under \`src/editor-plugins/\`; legacy aliases \`PluginSidebar\` and \`PluginDocumentSettingPanel\` resolve to \`sidebar\` and \`document-setting-panel\`.`;
525
- }
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";