kizlo 0.20.2 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/category/index.js +3 -3
- package/dist/category/schema.d.ts +1 -1
- package/dist/cli/commands/_setup.js +5 -1
- package/dist/cli/commands/dev.js +63 -20
- package/dist/cli/daemon/config.js +27 -3
- package/dist/cli/daemon/generate.js +8 -2
- package/dist/cli/daemon/watch.js +11 -3
- package/dist/cli/mcp/index.js +46 -0
- package/dist/cli/mcp/routes.js +42 -0
- package/dist/cli/mcp/schema.js +212 -0
- package/dist/cli/mcp/search.js +255 -0
- package/dist/cli/mcp/server.js +248 -0
- package/dist/cli/mcp/state.js +7 -0
- package/dist/cli/mcp/tools.js +116 -0
- package/dist/comment/index.js +4 -4
- package/dist/config.d.ts +17 -1
- package/dist/email/service.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/integrations/astro/integration.js +2 -0
- package/dist/integrations/nextjs/integration.js +2 -0
- package/dist/integrations/node/integration.js +2 -0
- package/dist/integrations/tanstack-start/integration.js +2 -0
- package/dist/kizlo.js +4 -3
- package/dist/menu/utils.js +2 -2
- package/dist/package.js +1 -1
- package/dist/page/index.js +4 -4
- package/dist/page/schema.d.ts +1 -1
- package/dist/post/index.js +4 -4
- package/dist/post/schema.d.ts +1 -1
- package/dist/procedures.d.ts +7 -7
- package/dist/seo/index.js +13 -11
- package/dist/seo/types.d.ts +4 -4
- package/dist/settings/service.d.ts +11 -11
- package/dist/settings/service.js +15 -15
- package/dist/shared/constants.js +3 -1
- package/dist/shared/integration.d.ts +9 -1
- package/dist/shared/integration.js +6 -3
- package/dist/tag/index.js +3 -3
- package/dist/tag/schema.d.ts +1 -1
- package/dist/wordpress/endpoint.d.ts +13 -3
- package/dist/wordpress/endpoint.js +24 -12
- package/dist/wordpress/generate.js +57 -9
- package/dist/wordpress/index.d.ts +1 -1
- package/dist/wordpress/introspection.js +26 -11
- package/dist/wordpress/types.d.ts +16 -2
- package/package.json +4 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WP_Error } from "./error.js";
|
|
2
|
-
import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry } from "./types.js";
|
|
2
|
+
import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry } from "./types.js";
|
|
3
3
|
import { WordPressTransport, WordPressTransportOptions, WordPressTransportResult } from "./transport.js";
|
|
4
4
|
import { buildWordPressRequest, createWordPressClient, wpEndpoint } from "./endpoint.js";
|
|
5
5
|
import { isWordPressResourceError } from "./utils.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import z from "zod/v4";
|
|
2
2
|
|
|
3
3
|
//#region src/wordpress/introspection.ts
|
|
4
|
-
const WORDPRESS_INTROSPECTION_VERSION = "1.
|
|
4
|
+
const WORDPRESS_INTROSPECTION_VERSION = "1.1";
|
|
5
5
|
const schema = z.lazy(() => z.object({
|
|
6
6
|
type: z.enum([
|
|
7
7
|
"string",
|
|
@@ -20,6 +20,19 @@ const schema = z.lazy(() => z.object({
|
|
|
20
20
|
default: z.unknown().optional(),
|
|
21
21
|
enum: z.array(z.unknown()).optional(),
|
|
22
22
|
format: z.string().optional(),
|
|
23
|
+
pattern: z.string().optional(),
|
|
24
|
+
minLength: z.number().optional(),
|
|
25
|
+
maxLength: z.number().optional(),
|
|
26
|
+
minItems: z.number().optional(),
|
|
27
|
+
maxItems: z.number().optional(),
|
|
28
|
+
minProperties: z.number().optional(),
|
|
29
|
+
maxProperties: z.number().optional(),
|
|
30
|
+
minimum: z.number().optional(),
|
|
31
|
+
maximum: z.number().optional(),
|
|
32
|
+
multipleOf: z.number().optional(),
|
|
33
|
+
uniqueItems: z.boolean().optional(),
|
|
34
|
+
exclusiveMinimum: z.boolean().optional(),
|
|
35
|
+
exclusiveMaximum: z.boolean().optional(),
|
|
23
36
|
properties: z.record(z.string(), schema).optional(),
|
|
24
37
|
items: schema.optional(),
|
|
25
38
|
$ref: z.string().min(1).optional(),
|
|
@@ -27,8 +40,7 @@ const schema = z.lazy(() => z.object({
|
|
|
27
40
|
anyOf: z.array(schema).min(1).optional(),
|
|
28
41
|
oneOf: z.array(schema).min(1).optional(),
|
|
29
42
|
additionalProperties: z.union([z.boolean(), schema]).optional(),
|
|
30
|
-
patternProperties: z.record(z.string(), schema).optional()
|
|
31
|
-
in: z.literal("path").optional()
|
|
43
|
+
patternProperties: z.record(z.string(), schema).optional()
|
|
32
44
|
}).loose());
|
|
33
45
|
const response = z.object({
|
|
34
46
|
description: z.string().optional(),
|
|
@@ -43,6 +55,16 @@ const response = z.object({
|
|
|
43
55
|
headers: schema.optional(),
|
|
44
56
|
body: schema.optional()
|
|
45
57
|
}).loose();
|
|
58
|
+
const objectSchema = schema.and(z.object({ type: z.literal("object") }));
|
|
59
|
+
const operationInput = z.object({
|
|
60
|
+
params: objectSchema.optional(),
|
|
61
|
+
query: objectSchema.optional(),
|
|
62
|
+
body: schema.and(z.object({ content_type: z.enum([
|
|
63
|
+
"application/json",
|
|
64
|
+
"multipart/form-data",
|
|
65
|
+
"application/x-www-form-urlencoded"
|
|
66
|
+
]).optional() })).optional()
|
|
67
|
+
}).loose();
|
|
46
68
|
const operation = z.object({
|
|
47
69
|
method: z.enum([
|
|
48
70
|
"GET",
|
|
@@ -57,14 +79,7 @@ const operation = z.object({
|
|
|
57
79
|
description: z.string().optional(),
|
|
58
80
|
deprecated: z.boolean().optional(),
|
|
59
81
|
errors: z.array(z.string().min(1)),
|
|
60
|
-
input:
|
|
61
|
-
type: z.literal("object"),
|
|
62
|
-
content_type: z.enum([
|
|
63
|
-
"application/json",
|
|
64
|
-
"multipart/form-data",
|
|
65
|
-
"application/x-www-form-urlencoded"
|
|
66
|
-
]).optional()
|
|
67
|
-
})),
|
|
82
|
+
input: operationInput,
|
|
68
83
|
responses: z.record(z.string().regex(/^(?:[1-5][0-9]{2}|default)$/), response).refine((value) => Object.keys(value).length > 0, "At least one response is required.")
|
|
69
84
|
}).loose();
|
|
70
85
|
const api = z.object({
|
|
@@ -21,8 +21,12 @@ interface WP_Endpoint<TInput$1, TResult$1> extends WP_EndpointDefinition {
|
|
|
21
21
|
* what the caller knows only at the moment of calling. Headers belong here rather than on the
|
|
22
22
|
* definition because a request can carry per-caller state (a guest cart token, the caller's geo)
|
|
23
23
|
* that the route it travels to has no way to declare.
|
|
24
|
+
*
|
|
25
|
+
* `searchParams` is the same idea for the URL, and is merged into the query the operation declares
|
|
26
|
+
* rather than replacing it. It is for the parameters WordPress answers for every route — `_embed`,
|
|
27
|
+
* `_fields` — which belong to no route's contract and so can never appear in a generated input.
|
|
24
28
|
*/
|
|
25
|
-
type WP_CallOptions = Pick<WP_RequestInput, "signal" | "timeout" | "headers">;
|
|
29
|
+
type WP_CallOptions = Pick<WP_RequestInput, "signal" | "timeout" | "headers" | "searchParams">;
|
|
26
30
|
/**
|
|
27
31
|
* The callable shape of an endpoint tree: every definition leaf becomes the request it runs. `any`
|
|
28
32
|
* passes through so the stub tree a project carries before its first generation stays callable.
|
|
@@ -162,6 +166,16 @@ type WP_RequestBuild = {
|
|
|
162
166
|
request: null;
|
|
163
167
|
error: WP_Error<"invalid_path_parameter">;
|
|
164
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* A call's input in the three parts a request is made of, mirroring the contract. Each part is
|
|
171
|
+
* optional because an operation only declares the ones it has, and `body` is `unknown` because a
|
|
172
|
+
* route is free to take a bare array rather than an object.
|
|
173
|
+
*/
|
|
174
|
+
interface WP_RequestParts {
|
|
175
|
+
params?: Record<string, unknown>;
|
|
176
|
+
query?: Record<string, unknown>;
|
|
177
|
+
body?: unknown;
|
|
178
|
+
}
|
|
165
179
|
type WP_RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
166
180
|
type WP_RequestContentType = "application/json" | "multipart/form-data" | "application/x-www-form-urlencoded";
|
|
167
181
|
type WP_ResponseContentType = "application/json" | "text/plain" | "text/html" | "application/xml" | "text/csv" | "application/octet-stream";
|
|
@@ -209,4 +223,4 @@ type WP_Failure<TError$1 extends string, TStatus extends number = number, THeade
|
|
|
209
223
|
type WP_TransportFailure<TError$1 extends string, THeaderName extends string = string> = WP_Failure<TError$1, 0, Record<string, never>, THeaderName>;
|
|
210
224
|
type WP_Result<TData$1, TError$1 extends string> = WP_Success<TData$1> | WP_Failure<TError$1>;
|
|
211
225
|
//#endregion
|
|
212
|
-
export { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry };
|
|
226
|
+
export { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kizlo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A headless WordPress framework for TypeScript.",
|
|
6
6
|
"keywords": [
|
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@clack/prompts": "^1.5.1",
|
|
109
|
-
"@kizlo/shared": "0.
|
|
109
|
+
"@kizlo/shared": "0.10.0",
|
|
110
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
110
111
|
"@orpc/client": "^1.14.3",
|
|
111
112
|
"@orpc/contract": "^1.14.3",
|
|
112
113
|
"@orpc/openapi": "^1.14.3",
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
"giget": "^3.0.0",
|
|
122
123
|
"jiti": "^2.7.0",
|
|
123
124
|
"magicast": "^0.5.3",
|
|
125
|
+
"minisearch": "^7.2.0",
|
|
124
126
|
"package-manager-detector": "^1.8.0",
|
|
125
127
|
"zod": "^4.3.6"
|
|
126
128
|
},
|