@wp-typia/project-tools 0.22.10 → 0.23.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.
Files changed (76) hide show
  1. package/dist/runtime/cli-add-collision.d.ts +25 -0
  2. package/dist/runtime/cli-add-collision.js +76 -0
  3. package/dist/runtime/cli-add-help.js +11 -2
  4. package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
  5. package/dist/runtime/cli-add-kind-ids.js +3 -0
  6. package/dist/runtime/cli-add-types.d.ts +117 -0
  7. package/dist/runtime/cli-add-types.js +26 -0
  8. package/dist/runtime/cli-add-validation.d.ts +90 -1
  9. package/dist/runtime/cli-add-validation.js +304 -1
  10. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +74 -19
  11. package/dist/runtime/cli-add-workspace-admin-view-source.js +11 -2
  12. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +20 -2
  13. package/dist/runtime/cli-add-workspace-admin-view-templates.js +359 -3
  14. package/dist/runtime/cli-add-workspace-admin-view-types.d.ts +21 -0
  15. package/dist/runtime/cli-add-workspace-admin-view-types.js +22 -0
  16. package/dist/runtime/cli-add-workspace-ai-anchors.js +121 -31
  17. package/dist/runtime/cli-add-workspace-contract-source-emitters.d.ts +15 -0
  18. package/dist/runtime/cli-add-workspace-contract-source-emitters.js +42 -0
  19. package/dist/runtime/cli-add-workspace-contract.d.ts +15 -0
  20. package/dist/runtime/cli-add-workspace-contract.js +65 -0
  21. package/dist/runtime/cli-add-workspace-integration-env.d.ts +24 -0
  22. package/dist/runtime/cli-add-workspace-integration-env.js +391 -0
  23. package/dist/runtime/cli-add-workspace-post-meta-anchors.d.ts +23 -0
  24. package/dist/runtime/cli-add-workspace-post-meta-anchors.js +244 -0
  25. package/dist/runtime/cli-add-workspace-post-meta-source-emitters.d.ts +63 -0
  26. package/dist/runtime/cli-add-workspace-post-meta-source-emitters.js +179 -0
  27. package/dist/runtime/cli-add-workspace-post-meta.d.ts +15 -0
  28. package/dist/runtime/cli-add-workspace-post-meta.js +107 -0
  29. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +1 -0
  30. package/dist/runtime/cli-add-workspace-rest-anchors.js +285 -21
  31. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +90 -2
  32. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +302 -29
  33. package/dist/runtime/cli-add-workspace-rest.d.ts +15 -2
  34. package/dist/runtime/cli-add-workspace-rest.js +329 -21
  35. package/dist/runtime/cli-add-workspace.d.ts +15 -0
  36. package/dist/runtime/cli-add-workspace.js +15 -0
  37. package/dist/runtime/cli-add.d.ts +1 -1
  38. package/dist/runtime/cli-add.js +1 -1
  39. package/dist/runtime/cli-core.d.ts +2 -1
  40. package/dist/runtime/cli-core.js +2 -1
  41. package/dist/runtime/cli-doctor-environment.js +1 -3
  42. package/dist/runtime/cli-doctor-workspace-features.js +128 -10
  43. package/dist/runtime/cli-doctor-workspace-package.d.ts +25 -3
  44. package/dist/runtime/cli-doctor-workspace-package.js +35 -13
  45. package/dist/runtime/cli-doctor-workspace-shared.d.ts +2 -0
  46. package/dist/runtime/cli-doctor-workspace-shared.js +2 -0
  47. package/dist/runtime/cli-doctor-workspace.js +8 -3
  48. package/dist/runtime/cli-help.js +7 -0
  49. package/dist/runtime/cli-init-templates.js +11 -1
  50. package/dist/runtime/contract-artifacts.d.ts +14 -0
  51. package/dist/runtime/contract-artifacts.js +15 -0
  52. package/dist/runtime/index.d.ts +1 -1
  53. package/dist/runtime/index.js +1 -1
  54. package/dist/runtime/rest-resource-artifacts.d.ts +57 -1
  55. package/dist/runtime/rest-resource-artifacts.js +97 -1
  56. package/dist/runtime/template-render.d.ts +1 -1
  57. package/dist/runtime/template-render.js +1 -1
  58. package/dist/runtime/template-source-cache-markers.d.ts +37 -0
  59. package/dist/runtime/template-source-cache-markers.js +125 -0
  60. package/dist/runtime/template-source-cache.d.ts +1 -4
  61. package/dist/runtime/template-source-cache.js +16 -122
  62. package/dist/runtime/template-source-external.d.ts +4 -2
  63. package/dist/runtime/template-source-external.js +4 -2
  64. package/dist/runtime/template-source-remote.d.ts +8 -4
  65. package/dist/runtime/template-source-remote.js +8 -4
  66. package/dist/runtime/workspace-inventory-mutations.js +52 -3
  67. package/dist/runtime/workspace-inventory-parser.d.ts +3 -2
  68. package/dist/runtime/workspace-inventory-parser.js +126 -5
  69. package/dist/runtime/workspace-inventory-read.d.ts +9 -2
  70. package/dist/runtime/workspace-inventory-read.js +9 -2
  71. package/dist/runtime/workspace-inventory-templates.d.ts +16 -1
  72. package/dist/runtime/workspace-inventory-templates.js +74 -4
  73. package/dist/runtime/workspace-inventory-types.d.ts +51 -2
  74. package/dist/runtime/workspace-inventory.d.ts +2 -2
  75. package/dist/runtime/workspace-inventory.js +1 -1
  76. package/package.json +2 -2
@@ -82,6 +82,31 @@ export declare function assertBindingSourceDoesNotExist(projectDir: string, bind
82
82
  * @throws {Error} When REST resource files or inventory entry already exist.
83
83
  */
84
84
  export declare function assertRestResourceDoesNotExist(projectDir: string, restResourceSlug: string, inventory: WorkspaceInventory): void;
85
+ /**
86
+ * Ensure a post-meta contract scaffold does not already exist on disk or in
87
+ * inventory.
88
+ *
89
+ * Also prevents accidentally registering the same meta key for the same post
90
+ * type through a second generated contract.
91
+ *
92
+ * @param projectDir Absolute workspace root used to resolve scaffold paths.
93
+ * @param postMetaSlug Normalized post-meta contract slug.
94
+ * @param postType WordPress post type scope.
95
+ * @param metaKey WordPress meta key.
96
+ * @param inventory Current workspace inventory used for duplicate detection.
97
+ * @throws {Error} When post-meta files or inventory entries already exist.
98
+ */
99
+ export declare function assertPostMetaDoesNotExist(projectDir: string, postMetaSlug: string, postType: string, metaKey: string, inventory: WorkspaceInventory): void;
100
+ /**
101
+ * Ensure a standalone contract scaffold does not already exist on disk or in
102
+ * inventory.
103
+ *
104
+ * @param projectDir Absolute workspace root used to resolve scaffold paths.
105
+ * @param contractSlug Normalized contract slug that would be created.
106
+ * @param inventory Current workspace inventory used for duplicate detection.
107
+ * @throws {Error} When contract files or inventory entry already exist.
108
+ */
109
+ export declare function assertContractDoesNotExist(projectDir: string, contractSlug: string, inventory: WorkspaceInventory): void;
85
110
  /**
86
111
  * Ensure a DataViews admin screen scaffold does not already exist on disk or in
87
112
  * the workspace inventory.
@@ -127,6 +127,40 @@ const REST_RESOURCE_COLLISION_DESCRIPTOR = {
127
127
  message: ({ slug }) => `A REST resource inventory entry already exists for ${slug}. Choose a different name.`,
128
128
  },
129
129
  };
130
+ const POST_META_COLLISION_DESCRIPTOR = {
131
+ filesystemCollisions: [
132
+ {
133
+ label: "A post meta contract",
134
+ relativePath: ({ slug }) => path.join("src", "post-meta", slug),
135
+ },
136
+ {
137
+ label: "A post meta bootstrap",
138
+ relativePath: ({ slug }) => path.join("inc", "post-meta", `${slug}.php`),
139
+ },
140
+ ],
141
+ inventoryCollision: {
142
+ entries: (inventory) => inventory.postMeta,
143
+ exists: (entry, { slug }) => entry.slug === slug,
144
+ message: ({ slug }) => `A post meta inventory entry already exists for ${slug}. Choose a different name.`,
145
+ },
146
+ };
147
+ const CONTRACT_COLLISION_DESCRIPTOR = {
148
+ filesystemCollisions: [
149
+ {
150
+ label: "A standalone contract",
151
+ relativePath: ({ slug }) => path.join("src", "contracts", `${slug}.ts`),
152
+ },
153
+ {
154
+ label: "A standalone contract schema",
155
+ relativePath: ({ slug }) => path.join("src", "contracts", `${slug}.schema.json`),
156
+ },
157
+ ],
158
+ inventoryCollision: {
159
+ entries: (inventory) => inventory.contracts,
160
+ exists: (entry, { slug }) => entry.slug === slug,
161
+ message: ({ slug }) => `A standalone contract inventory entry already exists for ${slug}. Choose a different name.`,
162
+ },
163
+ };
130
164
  const ADMIN_VIEW_COLLISION_DESCRIPTOR = {
131
165
  filesystemCollisions: [
132
166
  {
@@ -296,6 +330,48 @@ export function assertRestResourceDoesNotExist(projectDir, restResourceSlug, inv
296
330
  projectDir,
297
331
  });
298
332
  }
333
+ /**
334
+ * Ensure a post-meta contract scaffold does not already exist on disk or in
335
+ * inventory.
336
+ *
337
+ * Also prevents accidentally registering the same meta key for the same post
338
+ * type through a second generated contract.
339
+ *
340
+ * @param projectDir Absolute workspace root used to resolve scaffold paths.
341
+ * @param postMetaSlug Normalized post-meta contract slug.
342
+ * @param postType WordPress post type scope.
343
+ * @param metaKey WordPress meta key.
344
+ * @param inventory Current workspace inventory used for duplicate detection.
345
+ * @throws {Error} When post-meta files or inventory entries already exist.
346
+ */
347
+ export function assertPostMetaDoesNotExist(projectDir, postMetaSlug, postType, metaKey, inventory) {
348
+ assertAddKindScaffoldDoesNotExist({
349
+ context: { metaKey, postType, slug: postMetaSlug },
350
+ descriptor: POST_META_COLLISION_DESCRIPTOR,
351
+ inventory,
352
+ projectDir,
353
+ });
354
+ if (inventory.postMeta.some((entry) => entry.postType === postType && entry.metaKey === metaKey)) {
355
+ throw new Error(`A post meta inventory entry already registers ${metaKey} for ${postType}. Choose a different meta key or post type.`);
356
+ }
357
+ }
358
+ /**
359
+ * Ensure a standalone contract scaffold does not already exist on disk or in
360
+ * inventory.
361
+ *
362
+ * @param projectDir Absolute workspace root used to resolve scaffold paths.
363
+ * @param contractSlug Normalized contract slug that would be created.
364
+ * @param inventory Current workspace inventory used for duplicate detection.
365
+ * @throws {Error} When contract files or inventory entry already exist.
366
+ */
367
+ export function assertContractDoesNotExist(projectDir, contractSlug, inventory) {
368
+ assertAddKindScaffoldDoesNotExist({
369
+ context: { slug: contractSlug },
370
+ descriptor: CONTRACT_COLLISION_DESCRIPTOR,
371
+ inventory,
372
+ projectDir,
373
+ });
374
+ }
299
375
  /**
300
376
  * Ensure a DataViews admin screen scaffold does not already exist on disk or in
301
377
  * the workspace inventory.
@@ -8,12 +8,16 @@ export function formatAddHelpText() {
8
8
  return `Usage:
9
9
  wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]
10
10
  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]
11
+ wp-typia add integration-env <name> [--wp-env] [--service <none|docker-compose>] [--dry-run]
11
12
  wp-typia add variation <name> --block <block-slug> [--dry-run]
12
13
  wp-typia add style <name> --block <block-slug> [--dry-run]
13
14
  wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]
14
15
  wp-typia add pattern <name> [--dry-run]
15
16
  wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]
16
- wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <${REST_RESOURCE_METHOD_IDS.join(",")}>] [--dry-run]
17
+ wp-typia add contract <name> [--type <ExportedTypeName>] [--dry-run]
18
+ wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <${REST_RESOURCE_METHOD_IDS.join(",")}>] [--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--dry-run]
19
+ 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>] [--query-type <Type>] [--body-type <Type>] [--response-type <Type>] [--dry-run]
20
+ wp-typia add post-meta <name> --post-type <post-type> [--type <ExportedTypeName>] [--meta-key <meta-key>] [--hide-from-rest] [--dry-run]
17
21
  wp-typia add ability <name> [--dry-run]
18
22
  wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]
19
23
  wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <${HOOKED_BLOCK_POSITION_IDS.join("|")}> [--dry-run]
@@ -27,13 +31,18 @@ Notes:
27
31
  Pass \`--source rest-resource:<slug>\` to reuse a list-capable REST resource.
28
32
  Pass \`--source core-data:postType/post\` or \`--source core-data:taxonomy/category\` to bind a WordPress-owned entity collection.
29
33
  Generated admin-view workspaces add \`@wp-typia/dataviews\` and the needed WordPress DataViews packages as opt-in dependencies.
34
+ \`add integration-env\` generates an opt-in local smoke starter under \`scripts/integration-smoke/\`, updates \`.env.example\`, and can add \`@wordpress/env\` plus \`.wp-env.json\` when \`--wp-env\` is passed.
35
+ Pass \`--service docker-compose\` to include a placeholder local service stack that can be adapted to project-specific dependencies.
30
36
  \`query-loop\` is a create-time scaffold family. Use \`wp-typia create <project-dir> --template query-loop\` instead of \`wp-typia add block\`.
31
37
  \`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
32
38
  \`add style\` registers a Block Styles option for an existing generated block.
33
39
  \`add transform\` adds a block-to-block transform into an existing generated block.
34
40
  \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/\`.
35
41
  \`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.
36
- \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`.
42
+ \`add contract\` registers a standalone TypeScript wire contract under \`src/contracts/\` and generates a stable JSON Schema artifact without creating PHP route glue.
43
+ \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`. Use \`--route-pattern\`, \`--permission-callback\`, \`--controller-class\`, and \`--controller-extends\` when an existing WordPress controller or permission model needs to own part of the generated route surface.
44
+ Pass \`--manual\` with \`add rest-resource\` to track an external REST route with typed schemas, OpenAPI, clients, and drift checks without generating PHP route/controller files.
45
+ \`add post-meta\` scaffolds a typed post meta contract under \`src/post-meta/\`, generates a schema artifact, and wires \`register_post_meta()\` helpers under \`inc/post-meta/\`.
37
46
  \`add ability\` scaffolds typed workflow abilities under \`src/abilities/\` and server registration under \`inc/abilities/\`.
38
47
  \`add ai-feature\` scaffolds server-owned AI feature endpoints under \`src/ai-features/\` and PHP route glue under \`inc/ai-features/\`.
39
48
  \`add hooked-block\` patches an existing workspace block's \`block.json\` \`blockHooks\` metadata.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Keep this order stable because it drives help output and command metadata.
6
6
  */
7
- 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"];
7
+ export declare const ADD_KIND_IDS: readonly ["admin-view", "block", "integration-env", "variation", "style", "transform", "pattern", "binding-source", "contract", "rest-resource", "post-meta", "ability", "ai-feature", "hooked-block", "editor-plugin"];
8
8
  /**
9
9
  * Union of supported top-level `wp-typia add` kind ids.
10
10
  */
@@ -7,12 +7,15 @@
7
7
  export const ADD_KIND_IDS = [
8
8
  "admin-view",
9
9
  "block",
10
+ "integration-env",
10
11
  "variation",
11
12
  "style",
12
13
  "transform",
13
14
  "pattern",
14
15
  "binding-source",
16
+ "contract",
15
17
  "rest-resource",
18
+ "post-meta",
16
19
  "ability",
17
20
  "ai-feature",
18
21
  "hooked-block",
@@ -9,6 +9,22 @@ export declare const REST_RESOURCE_METHOD_IDS: readonly ["list", "read", "create
9
9
  * Union of supported plugin-level REST resource method ids.
10
10
  */
11
11
  export type RestResourceMethodId = (typeof REST_RESOURCE_METHOD_IDS)[number];
12
+ /**
13
+ * Supported HTTP methods accepted by manual REST contract mode.
14
+ */
15
+ export declare const MANUAL_REST_CONTRACT_HTTP_METHOD_IDS: readonly ["DELETE", "GET", "PATCH", "POST", "PUT"];
16
+ /**
17
+ * Union of supported manual REST contract HTTP methods.
18
+ */
19
+ export type ManualRestContractHttpMethodId = (typeof MANUAL_REST_CONTRACT_HTTP_METHOD_IDS)[number];
20
+ /**
21
+ * Supported auth intent values accepted by manual REST contract mode.
22
+ */
23
+ export declare const MANUAL_REST_CONTRACT_AUTH_IDS: readonly ["authenticated", "public", "public-write-protected"];
24
+ /**
25
+ * Union of supported manual REST contract auth intents.
26
+ */
27
+ export type ManualRestContractAuthId = (typeof MANUAL_REST_CONTRACT_AUTH_IDS)[number];
12
28
  /**
13
29
  * Canonical editor-plugin shell surface ids accepted by
14
30
  * `wp-typia add editor-plugin --slot`.
@@ -34,6 +50,15 @@ export declare const EDITOR_PLUGIN_SLOT_ALIASES: {
34
50
  * @returns The canonical slot id, or `undefined` when unsupported.
35
51
  */
36
52
  export declare function resolveEditorPluginSlotAlias(slot: string): EditorPluginSlotId | undefined;
53
+ /**
54
+ * Optional local service starter ids accepted by
55
+ * `wp-typia add integration-env --service`.
56
+ */
57
+ export declare const INTEGRATION_ENV_SERVICE_IDS: readonly ["none", "docker-compose"];
58
+ /**
59
+ * Union of supported local service starter ids.
60
+ */
61
+ export type IntegrationEnvServiceId = (typeof INTEGRATION_ENV_SERVICE_IDS)[number];
37
62
  /**
38
63
  * Supported built-in block families accepted by `wp-typia add block --template`.
39
64
  */
@@ -118,19 +143,95 @@ export interface RunAddBindingSourceCommandOptions {
118
143
  bindingSourceName: string;
119
144
  cwd?: string;
120
145
  }
146
+ /**
147
+ * Options for `wp-typia add contract`.
148
+ *
149
+ * @property contractName Human-entered contract name normalized into a stable slug.
150
+ * @property cwd Working directory used to resolve the nearest official workspace.
151
+ * @property typeName Optional exported TypeScript type or interface name. Defaults
152
+ * to the PascalCase version of `contractName`.
153
+ */
154
+ export interface RunAddContractCommandOptions {
155
+ contractName: string;
156
+ cwd?: string;
157
+ typeName?: string;
158
+ }
159
+ /**
160
+ * Options for `wp-typia add post-meta`.
161
+ *
162
+ * @property cwd Working directory used to resolve the nearest official workspace.
163
+ * @property hideFromRest Whether to keep the generated meta key out of REST and
164
+ * editor responses. Defaults to REST/editor exposure being enabled.
165
+ * @property metaKey Optional WordPress meta key. Defaults to
166
+ * `_<phpPrefix>_<postMetaName>`.
167
+ * @property postMetaName Human-entered post-meta contract name normalized into
168
+ * a stable slug.
169
+ * @property postType WordPress post type key, 20 characters or fewer, that owns
170
+ * the generated meta key.
171
+ * @property typeName Optional exported TypeScript type or interface name.
172
+ * Defaults to `<PascalName>Meta`.
173
+ */
174
+ export interface RunAddPostMetaCommandOptions {
175
+ cwd?: string;
176
+ hideFromRest?: boolean;
177
+ metaKey?: string;
178
+ postMetaName: string;
179
+ postType: string;
180
+ typeName?: string;
181
+ }
121
182
  /**
122
183
  * Options for `wp-typia add rest-resource`.
123
184
  *
185
+ * Passing `manual: true` records a type-only external REST route contract. In
186
+ * manual mode wp-typia still owns TypeScript contracts, validators, OpenAPI,
187
+ * generated clients, and drift checks, but it does not create PHP route glue.
188
+ *
189
+ * @property auth Optional auth intent for manual mode. Defaults to public.
190
+ * @property bodyTypeName Optional exported TypeScript body type for manual
191
+ * mode. Defaults to `<PascalName>Request` for write methods.
192
+ * @property controllerClass Optional generated REST controller class reference.
193
+ * When present, route callbacks delegate through an instantiated controller.
194
+ * @property controllerExtends Optional base class for the generated controller
195
+ * wrapper when `controllerClass` is a global class name.
124
196
  * @property cwd Working directory used to resolve the nearest official workspace.
197
+ * @property manual Whether to scaffold a type-only external REST contract.
198
+ * @property method HTTP method for manual REST contract mode. Defaults to GET.
125
199
  * @property methods Optional comma-separated REST method list.
126
200
  * @property namespace Optional REST namespace, defaulting to the workspace namespace.
201
+ * @property permissionCallback Optional PHP callback used for generated REST
202
+ * route permission checks.
203
+ * @property pathPattern Route path pattern for manual mode, relative to the
204
+ * namespace. Defaults to `/<name>`.
205
+ * @property queryTypeName Optional exported TypeScript query type for manual
206
+ * mode. Defaults to `<PascalName>Query`.
127
207
  * @property restResourceName Human-entered resource name normalized into a slug.
208
+ * @property responseTypeName Optional exported TypeScript response type for
209
+ * manual mode. Defaults to `<PascalName>Response`.
210
+ * @property routePattern Optional generated item route pattern, relative to the
211
+ * namespace. Defaults to `/<name>/item`.
212
+ * @property secretFieldName Optional write-only secret field name for manual
213
+ * settings contracts. Requires a request body.
214
+ * @property secretStateFieldName Optional masked response boolean field for
215
+ * `secretFieldName`. Defaults to `has<PascalSecretField>`.
128
216
  */
129
217
  export interface RunAddRestResourceCommandOptions {
218
+ auth?: string;
219
+ bodyTypeName?: string;
220
+ controllerClass?: string;
221
+ controllerExtends?: string;
130
222
  cwd?: string;
223
+ manual?: boolean;
224
+ method?: string;
131
225
  methods?: string;
132
226
  namespace?: string;
227
+ permissionCallback?: string;
228
+ pathPattern?: string;
229
+ queryTypeName?: string;
133
230
  restResourceName: string;
231
+ responseTypeName?: string;
232
+ routePattern?: string;
233
+ secretFieldName?: string;
234
+ secretStateFieldName?: string;
134
235
  }
135
236
  /**
136
237
  * Options for `wp-typia add admin-view`.
@@ -201,6 +302,22 @@ export interface RunAddEditorPluginCommandOptions {
201
302
  editorPluginName: string;
202
303
  slot?: string;
203
304
  }
305
+ /**
306
+ * Options for `wp-typia add integration-env`.
307
+ *
308
+ * @property cwd Working directory used to resolve the nearest official workspace.
309
+ * Defaults to `process.cwd()`.
310
+ * @property integrationEnvName Human-entered environment name that will be
311
+ * normalized into script and documentation paths.
312
+ * @property service Optional local service starter. Defaults to `none`.
313
+ * @property withWpEnv Whether to add a local `@wordpress/env` preset and scripts.
314
+ */
315
+ export interface RunAddIntegrationEnvCommandOptions {
316
+ cwd?: string;
317
+ integrationEnvName: string;
318
+ service?: string;
319
+ withWpEnv?: boolean;
320
+ }
204
321
  /**
205
322
  * Options for `wp-typia add block`.
206
323
  *
@@ -11,6 +11,24 @@ export const REST_RESOURCE_METHOD_IDS = [
11
11
  "update",
12
12
  "delete",
13
13
  ];
14
+ /**
15
+ * Supported HTTP methods accepted by manual REST contract mode.
16
+ */
17
+ export const MANUAL_REST_CONTRACT_HTTP_METHOD_IDS = [
18
+ "DELETE",
19
+ "GET",
20
+ "PATCH",
21
+ "POST",
22
+ "PUT",
23
+ ];
24
+ /**
25
+ * Supported auth intent values accepted by manual REST contract mode.
26
+ */
27
+ export const MANUAL_REST_CONTRACT_AUTH_IDS = [
28
+ "authenticated",
29
+ "public",
30
+ "public-write-protected",
31
+ ];
14
32
  /**
15
33
  * Canonical editor-plugin shell surface ids accepted by
16
34
  * `wp-typia add editor-plugin --slot`.
@@ -38,6 +56,14 @@ export function resolveEditorPluginSlotAlias(slot) {
38
56
  }
39
57
  return EDITOR_PLUGIN_SLOT_ALIASES[trimmed];
40
58
  }
59
+ /**
60
+ * Optional local service starter ids accepted by
61
+ * `wp-typia add integration-env --service`.
62
+ */
63
+ export const INTEGRATION_ENV_SERVICE_IDS = [
64
+ "none",
65
+ "docker-compose",
66
+ ];
41
67
  /**
42
68
  * Supported built-in block families accepted by `wp-typia add block --template`.
43
69
  */
@@ -1,5 +1,5 @@
1
1
  import { type HookedBlockPositionId } from "./hooked-blocks.js";
2
- import { type AddBlockTemplateId, type EditorPluginSlotId, type RestResourceMethodId } from "./cli-add-types.js";
2
+ import { type AddBlockTemplateId, type EditorPluginSlotId, type IntegrationEnvServiceId, type ManualRestContractAuthId, type ManualRestContractHttpMethodId, type RestResourceMethodId } from "./cli-add-types.js";
3
3
  /**
4
4
  * Namespace format accepted by plugin-level REST resources.
5
5
  */
@@ -14,6 +14,16 @@ export declare const REST_RESOURCE_NAMESPACE_PATTERN: RegExp;
14
14
  * @throws {Error} When the slug is empty or contains unsupported characters.
15
15
  */
16
16
  export declare function assertValidGeneratedSlug(label: string, slug: string, usage: string): string;
17
+ /**
18
+ * Validate a source type name used by generated schema artifact workflows.
19
+ *
20
+ * @param label Human-readable field label used in error messages.
21
+ * @param value TypeScript identifier candidate from CLI input or defaults.
22
+ * @param usage CLI usage hint shown when the identifier is empty.
23
+ * @returns The trimmed, validated TypeScript identifier.
24
+ * @throws {Error} When the value is empty or not a TypeScript identifier.
25
+ */
26
+ export declare function assertValidTypeScriptIdentifier(label: string, value: string, usage: string): string;
17
27
  /**
18
28
  * Validate a REST resource namespace.
19
29
  *
@@ -31,6 +41,26 @@ export declare function assertValidRestResourceNamespace(namespace: string): str
31
41
  * @throws {Error} When the resolved namespace is invalid.
32
42
  */
33
43
  export declare function resolveRestResourceNamespace(workspaceNamespace: string, namespace?: string): string;
44
+ /**
45
+ * Validate a WordPress post type key used as post-meta scope.
46
+ *
47
+ * @param postType Raw post type key from CLI input.
48
+ * @returns The trimmed post type key.
49
+ * @throws {Error} When the key is empty or contains unsupported characters.
50
+ */
51
+ export declare function assertValidPostMetaPostType(postType: string): string;
52
+ /**
53
+ * Resolve a post-meta key from explicit input or the workspace slug default.
54
+ *
55
+ * @param options Optional explicit meta key plus workspace prefix and slug.
56
+ * @returns A validated post-meta key.
57
+ * @throws {Error} When the key is empty or contains whitespace/control characters.
58
+ */
59
+ export declare function resolvePostMetaKey({ metaKey, phpPrefix, slug, }: {
60
+ metaKey?: string;
61
+ phpPrefix: string;
62
+ slug: string;
63
+ }): string;
34
64
  /**
35
65
  * Parse and validate REST resource method ids from a comma-separated list.
36
66
  *
@@ -39,6 +69,57 @@ export declare function resolveRestResourceNamespace(workspaceNamespace: string,
39
69
  * @throws {Error} When any method is unsupported or the list is empty.
40
70
  */
41
71
  export declare function assertValidRestResourceMethods(methods?: string): RestResourceMethodId[];
72
+ /**
73
+ * Validate a PHP callable reference supplied to generated REST route metadata.
74
+ *
75
+ * @param label Human-readable field label for errors.
76
+ * @param callback Optional PHP function or `ClassName::method` callback string.
77
+ * @returns The trimmed callback when present.
78
+ * @throws {Error} When the callback cannot be emitted as a safe PHP callable string.
79
+ */
80
+ export declare function resolveOptionalPhpCallbackReference(label: string, callback?: string): string | undefined;
81
+ /**
82
+ * Validate a PHP class reference used by generated REST controller wrappers.
83
+ *
84
+ * @param label Human-readable field label for errors.
85
+ * @param classReference Optional PHP class name.
86
+ * @returns The trimmed class reference when present.
87
+ * @throws {Error} When the class reference cannot be emitted safely.
88
+ */
89
+ export declare function resolveOptionalPhpClassReference(label: string, classReference?: string): string | undefined;
90
+ /**
91
+ * Normalize and validate the HTTP method used by a manual REST contract.
92
+ *
93
+ * @param method Optional method input. Defaults to GET.
94
+ * @returns A canonical uppercase HTTP method.
95
+ * @throws {Error} When the method is unsupported.
96
+ */
97
+ export declare function assertValidManualRestContractHttpMethod(method?: string): ManualRestContractHttpMethodId;
98
+ /**
99
+ * Normalize and validate the auth intent used by a manual REST contract.
100
+ *
101
+ * @param auth Optional auth intent input. Defaults to public.
102
+ * @returns A canonical auth intent.
103
+ * @throws {Error} When the auth intent is unsupported.
104
+ */
105
+ export declare function assertValidManualRestContractAuth(auth?: string): ManualRestContractAuthId;
106
+ /**
107
+ * Check whether a generated REST item route keeps the generated `id` contract aligned.
108
+ *
109
+ * @param routePattern Route pattern relative to the namespace.
110
+ * @returns True when the pattern has no regex groups or uses only `(?P<id>...)`.
111
+ */
112
+ export declare function isGeneratedRestResourceRoutePatternCompatible(routePattern: string): boolean;
113
+ export declare function resolveManualRestContractPathPattern(slug: string, pathPattern?: string): string;
114
+ /**
115
+ * Normalize and validate a generated REST resource item route pattern.
116
+ *
117
+ * @param slug Generated resource slug used for the default item route path.
118
+ * @param routePattern Optional route path pattern, relative to the namespace.
119
+ * @returns A route pattern with a leading slash.
120
+ * @throws {Error} When the route pattern is empty or clearly not a route path.
121
+ */
122
+ export declare function resolveGeneratedRestResourceRoutePattern(slug: string, routePattern?: string): string;
42
123
  /**
43
124
  * Validate a hooked block insertion position.
44
125
  *
@@ -85,3 +166,11 @@ export declare function assertValidHookAnchor(anchorBlockName: string): string;
85
166
  * @throws {Error} When the slot is not supported by the workspace scaffold.
86
167
  */
87
168
  export declare function assertValidEditorPluginSlot(slot?: string): EditorPluginSlotId;
169
+ /**
170
+ * Validate and normalize the optional integration environment service starter.
171
+ *
172
+ * @param service Optional service starter id. Defaults to `none`.
173
+ * @returns The canonical integration environment service id.
174
+ * @throws {Error} When the service starter is unsupported.
175
+ */
176
+ export declare function assertValidIntegrationEnvService(service?: string): IntegrationEnvServiceId;