kizlo 0.20.0 → 0.20.2

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.
@@ -10,7 +10,8 @@ import * as p from "@clack/prompts";
10
10
  //#region src/cli/commands/_wiring.ts
11
11
  /** The kizlo.config.ts a scaffolded project gets: the Kizlo directory, the import-alias preference, and,
12
12
  * when local WordPress is chosen, `local: true` so `kizlo dev` and `kizlo test` boot the fixed
13
- * `.kizlo/local` install (both stacks on with defaults; the object form is for configuring them). The
13
+ * `.kizlo/local` install (both stacks on with defaults; the object form configures them and turns each
14
+ * on with its own `enable: true`). The
14
15
  * alias is always written (`""` for relative imports included) so it records a made decision a later
15
16
  * `kizlo init` reads back instead of prompting for it again. The alias is written in its canonical `@/`
16
17
  * form (never a bare `@`) so it reads like the imports it produces. */
@@ -1,5 +1,5 @@
1
1
  import { log } from "../daemon/logger.js";
2
- import { resolveConfig } from "../daemon/config.js";
2
+ import { resolveConfig, resolveWatchCredentials } from "../daemon/config.js";
3
3
  import { PartialContractError, generateOnce, reportGenerationError } from "../daemon/generate.js";
4
4
  import { testWordPressCredentials } from "./_test-wordpress.js";
5
5
  import path from "node:path";
@@ -38,18 +38,31 @@ const generate = defineCommand({
38
38
  async run({ args }) {
39
39
  const cwd = process.cwd();
40
40
  const strict = args.strict === true;
41
- let credentials;
41
+ let options;
42
42
  if (args.test) try {
43
- credentials = await testWordPressCredentials(cwd);
43
+ options = {
44
+ credentials: await testWordPressCredentials(cwd),
45
+ strict
46
+ };
44
47
  } catch (error) {
45
48
  log.error(error instanceof Error ? error.message : String(error));
46
49
  process.exitCode = 1;
47
50
  return;
48
51
  }
49
- const options = {
50
- credentials,
51
- strict
52
- };
52
+ else {
53
+ const credentials = await resolveWatchCredentials(cwd);
54
+ if (credentials) options = {
55
+ credentials,
56
+ strict
57
+ };
58
+ else {
59
+ log.info("No WordPress connection configured; generating the contract only, introspection skipped.");
60
+ options = {
61
+ skipIntrospection: true,
62
+ strict
63
+ };
64
+ }
65
+ }
53
66
  const cfg = await resolveConfig(cwd, { dir: args.dir });
54
67
  if (!cfg) {
55
68
  log.info("Nothing to generate. Set `dir` in kizlo.config.ts or pass --dir.");
@@ -66,6 +79,7 @@ const generate = defineCommand({
66
79
  process.exit(1);
67
80
  }
68
81
  if (result.contract === "none") {
82
+ if (result.introspection === "skipped") return;
69
83
  const file = path.resolve(cwd, cfg.introspectionPath);
70
84
  log.success(`WordPress introspection ${result.introspection === "generated" ? "written to" : "already current at"} ${file}`);
71
85
  return;
@@ -1,7 +1,9 @@
1
+ import { integrationEnv, resolveWordPressConnection, wordPressConnectionComplete } from "../../kizlo.js";
1
2
  import { DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL } from "../wp/constants.js";
2
3
  import { credentialsPath, findConfigDir } from "../wp/utils.js";
4
+ import { node } from "../../integrations/node/integration.js";
3
5
  import { log } from "./logger.js";
4
- import { detectPackageManager } from "../utils.js";
6
+ import { detectPackageManager, loadEnvFiles } from "../utils.js";
5
7
  import { WORDPRESS_TAG_PATTERN } from "../wp/version.js";
6
8
  import { importIgnoringVirtualModules } from "./jiti.js";
7
9
  import z from "zod/v4";
@@ -66,21 +68,31 @@ const configSchema = z.object({
66
68
  dev: removedKey("`dev` is no longer a config root key. Move it under `local.dev`."),
67
69
  test: removedKey("`test` is no longer a config root key. Move it under `local.test`.")
68
70
  });
69
- /** Normalize `local` (absent, `true`, `false`, or the object form) into one shape the resolvers read. */
71
+ /**
72
+ * Normalize `local` (absent, `true`, `false`, or the object form) into one shape the resolvers read.
73
+ * A stack is off unless its own `enable: true` is set; `local: true` is the shorthand that turns both on.
74
+ */
70
75
  function resolveLocal(fileConfig) {
71
76
  const local = fileConfig?.local;
72
77
  if (local === true) return {
73
78
  enabled: true,
79
+ devEnabled: true,
80
+ testEnabled: true,
74
81
  dev: {},
75
82
  test: {}
76
83
  };
77
84
  if (!local) return {
78
85
  enabled: false,
86
+ devEnabled: false,
87
+ testEnabled: false,
79
88
  dev: {},
80
89
  test: {}
81
90
  };
91
+ const enabled = local.enable !== false;
82
92
  return {
83
- enabled: local.enable !== false,
93
+ enabled,
94
+ devEnabled: enabled && local.dev?.enable === true,
95
+ testEnabled: enabled && local.test?.enable === true,
84
96
  name: local.name,
85
97
  worktrees: local.worktrees,
86
98
  dev: local.dev ?? {},
@@ -241,7 +253,7 @@ async function resolveTestConfig(cwd) {
241
253
  const inherit = test.inherit !== false;
242
254
  return {
243
255
  configDir,
244
- local: local.enabled && test.enable !== false,
256
+ local: local.testEnabled,
245
257
  project: stackProject(resolveStackName(configDir, {
246
258
  name: local.name,
247
259
  worktrees: local.worktrees
@@ -256,14 +268,27 @@ async function resolveTestConfig(cwd) {
256
268
  };
257
269
  }
258
270
  /**
259
- * Whether this project runs local WordPress under `kizlo dev`: local is enabled and the dev stack is
260
- * on (`local.dev.enable !== false`) in `kizlo.config.*`. When false, `kizlo dev` has nothing to boot and
261
- * runs the contract watcher alone, the path a project pointing at its own WordPress takes. Written by
262
- * `create`/`init` when local WordPress is chosen, so it's committed and survives `kizlo dev reset`.
271
+ * Whether this project runs local WordPress under `kizlo dev`: the `local` block is enabled and the dev
272
+ * stack is turned on with `local.dev.enable: true` (or `local: true`) in `kizlo.config.*`. When false,
273
+ * `kizlo dev` has nothing to boot and runs the contract watcher alone, the path a project pointing at its
274
+ * own WordPress takes. Written by `create`/`init` when local WordPress is chosen, so it's committed and
275
+ * survives `kizlo dev reset`.
263
276
  */
264
277
  async function usesLocalWordPress(cwd) {
265
- const local = resolveLocal(await loadConfigFile(findConfigDir(cwd)));
266
- return local.enabled && local.dev.enable !== false;
278
+ return resolveLocal(await loadConfigFile(findConfigDir(cwd))).devEnabled;
279
+ }
280
+ /**
281
+ * WordPress credentials for the dev/generate watcher, or `undefined` when there is nothing to introspect:
282
+ * the active profile is `local` but no local dev stack is enabled, or the active profile's connection
283
+ * envs are incomplete. Callers then generate the contract with introspection skipped rather than fetching
284
+ * from a WordPress that is not there. Unlike {@link resolveWordPressConnection}, this never throws.
285
+ */
286
+ async function resolveWatchCredentials(cwd) {
287
+ loadEnvFiles(cwd);
288
+ const env = integrationEnv([node()]);
289
+ if (env("mode")?.trim() === "local" && !await usesLocalWordPress(cwd)) return void 0;
290
+ if (!wordPressConnectionComplete(env)) return void 0;
291
+ return resolveWordPressConnection(env).credentials;
267
292
  }
268
293
  /**
269
294
  * Resolve the dev stack (`local.dev`) into concrete values for the `dev` command, applying defaults
@@ -293,4 +318,4 @@ async function resolveDevConfig(cwd) {
293
318
  }
294
319
 
295
320
  //#endregion
296
- export { CONFIG_FILES, DEFAULT_DEV_DB_PORT, DEFAULT_DEV_PORT, resolveConfig, resolveDevConfig, resolveStackName, resolveTestConfig, stackProject, usesLocalWordPress };
321
+ export { CONFIG_FILES, DEFAULT_DEV_DB_PORT, DEFAULT_DEV_PORT, resolveConfig, resolveDevConfig, resolveStackName, resolveTestConfig, resolveWatchCredentials, stackProject, usesLocalWordPress };
@@ -205,6 +205,7 @@ async function generateIntrospectionSource(cwd, options = {}) {
205
205
  * it under `generated/`, and a package that only ships procedures writes it at its own `dir.introspection`.
206
206
  */
207
207
  async function generateIntrospectionOnce(cfg, options = {}) {
208
+ if (options.skipIntrospection) return "skipped";
208
209
  const file = path.resolve(cfg.cwd, cfg.introspectionPath);
209
210
  const metaPath = path.resolve(cfg.cwd, cfg.introspectionMetaPath);
210
211
  const result = await fetchDocument(cfg.cwd, options, readWordPressMeta(metaPath, file)?.etag);
@@ -1,8 +1,5 @@
1
- import { integrationEnv, resolveWordPressConnection } from "../../kizlo.js";
2
- import { node } from "../../integrations/node/integration.js";
3
1
  import { log } from "./logger.js";
4
- import { loadEnvFiles } from "../utils.js";
5
- import { resolveConfig } from "./config.js";
2
+ import { resolveConfig, resolveWatchCredentials } from "./config.js";
6
3
  import { IntrospectionFetchError } from "../../wordpress/fetch-introspection.js";
7
4
  import { generateIntrospectionOnce, generateOnce, reportGenerationError } from "./generate.js";
8
5
  import { acquire, lockPath, release } from "./lock.js";
@@ -17,9 +14,9 @@ function debounce(fn, delay) {
17
14
  timer = setTimeout(() => void fn(...args), delay);
18
15
  });
19
16
  }
20
- async function regenerate(cfg, credentials) {
17
+ async function regenerate(cfg, options) {
21
18
  try {
22
- const result = await generateOnce(cfg, { credentials });
19
+ const result = await generateOnce(cfg, options);
23
20
  if (result.contract === "built") log.success("Contract updated");
24
21
  else if (result.contract === "empty" && cfg.server) log.warn(`No Kizlo server found in ${cfg.server.entry}`);
25
22
  } catch (error) {
@@ -27,13 +24,13 @@ async function regenerate(cfg, credentials) {
27
24
  }
28
25
  }
29
26
  /** Watches the server directory and regenerates the contract on change. Only called when a server is present. */
30
- async function watch(cfg, server, credentials) {
27
+ async function watch(cfg, server, options) {
31
28
  const watcher = new FSWatcher({
32
29
  persistent: true,
33
30
  ignoreInitial: true,
34
31
  ignored: path.resolve(cfg.cwd, server.contractDir)
35
32
  });
36
- const onChange = debounce(() => regenerate(cfg, credentials), 300);
33
+ const onChange = debounce(() => regenerate(cfg, options), 300);
37
34
  watcher.add(path.resolve(cfg.cwd, server.dir));
38
35
  watcher.on("all", () => void onChange());
39
36
  return watcher;
@@ -139,25 +136,26 @@ async function startWatcher(cwd, opts) {
139
136
  log.info("skipping the contract generation.");
140
137
  return;
141
138
  }
142
- loadEnvFiles(cwd);
143
- const { credentials } = resolveWordPressConnection(integrationEnv([node()]));
139
+ const credentials = await resolveWatchCredentials(cwd);
140
+ const options = credentials ? { credentials } : { skipIntrospection: true };
141
+ if (!credentials) log.info("No WordPress connection configured; running the contract watcher only, introspection skipped.");
144
142
  try {
145
- const result = await generateOnce(cfg, { credentials });
143
+ const result = await generateOnce(cfg, options);
146
144
  if (result.contract === "built") log.success("Contract generated");
147
145
  else if (result.contract === "empty" && cfg.server) log.warn(`No Kizlo server found in ${cfg.server.entry}`);
148
146
  else if (result.introspection === "generated") log.success("WordPress introspection generated");
149
147
  } catch (error) {
150
148
  reportGenerationError("Failed to generate the Kizlo contract:", error);
151
149
  }
152
- const watcher = cfg.server ? await watch(cfg, cfg.server, credentials) : void 0;
153
- const wordpressRefresh = refreshWordPress(cfg, credentials, opts?.stack);
150
+ const watcher = cfg.server ? await watch(cfg, cfg.server, options) : void 0;
151
+ const wordpressRefresh = credentials ? refreshWordPress(cfg, credentials, opts?.stack) : void 0;
154
152
  let stopped = false;
155
153
  handedOver = true;
156
154
  return () => {
157
155
  if (stopped) return;
158
156
  stopped = true;
159
157
  release(lock);
160
- clearInterval(wordpressRefresh);
158
+ if (wordpressRefresh) clearInterval(wordpressRefresh);
161
159
  watcher?.close();
162
160
  };
163
161
  } finally {
@@ -0,0 +1,15 @@
1
+ # Kizlo local WordPress — make same-site server requests reach Apache.
2
+ #
3
+ # WordPress builds internal, server-side requests (e.g. a plugin calling its own
4
+ # admin_url()) against the browser-facing URL, which carries the *published* host
5
+ # port — say http://localhost:8890. Inside the container that request loops back to
6
+ # localhost:8890, but Apache only listens on 80 (Docker maps the host port to 80),
7
+ # so the call fails with cURL error 7 and the plugin stalls.
8
+ #
9
+ # Listening on the published port as well makes localhost:<port> resolve inside the
10
+ # container exactly as it does from the browser. Apache keeps its port-80 listener
11
+ # for Docker's port mapping and the health check; this only adds a second one.
12
+ #
13
+ # WP_PORT is passed into the wordpress service by the CLI (and defaulted in the base
14
+ # Compose file), so Apache expands ${WP_PORT} from the container environment.
15
+ Listen ${WP_PORT}
@@ -0,0 +1,66 @@
1
+ import fs from "node:fs"
2
+ import { describe, expect, test } from "vitest"
3
+ import { parse } from "yaml"
4
+ import { APACHE_LISTEN_CONF, COMPOSE_FILE, UPLOADS_INI } from "../constants"
5
+
6
+ interface Service {
7
+ environment?: Record<string, string>
8
+ ports?: string[]
9
+ volumes?: string[]
10
+ }
11
+
12
+ const wordpress = (): Service => parse(fs.readFileSync(COMPOSE_FILE, "utf8")).services.wordpress
13
+
14
+ /** Parse a `key=value` INI (comments/blank lines dropped) into a lookup. */
15
+ function ini(file: string): Record<string, string> {
16
+ const out: Record<string, string> = {}
17
+ for (const line of fs.readFileSync(file, "utf8").split("\n")) {
18
+ const trimmed = line.trim()
19
+ if (!trimmed || trimmed.startsWith(";")) continue
20
+ const eq = trimmed.indexOf("=")
21
+ if (eq !== -1) out[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim()
22
+ }
23
+ return out
24
+ }
25
+
26
+ /** PHP size shorthand (`2G`, `2100M`, `512K`) to bytes. */
27
+ function bytes(size: string): number {
28
+ const match = /^(\d+)([KMG]?)$/i.exec(size)
29
+ if (!match) throw new Error(`not a PHP size: ${size}`)
30
+ const scale = { "": 1, K: 1024, M: 1024 ** 2, G: 1024 ** 3 }[match[2]?.toUpperCase() ?? ""] ?? 1
31
+ return Number(match[1]) * scale
32
+ }
33
+
34
+ describe("base compose wordpress service", () => {
35
+ test("receives the published port so Apache can listen on it", () => {
36
+ // Defaulted to the same value as the port mapping so a standalone `up` still parses.
37
+ // The `${...}` here are literal Compose interpolation tokens, not JS templates.
38
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal Compose interpolation
39
+ expect(wordpress().environment?.WP_PORT).toBe("${WP_PORT:-8080}")
40
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: literal Compose interpolation
41
+ expect(wordpress().ports).toContain("${WP_PORT:-8080}:80")
42
+ })
43
+
44
+ test("mounts both local-only config assets read-only", () => {
45
+ const volumes = wordpress().volumes ?? []
46
+ expect(volumes).toContain("./uploads.ini:/usr/local/etc/php/conf.d/zz-kizlo-uploads.ini:ro")
47
+ expect(volumes).toContain("./apache-listen.conf:/etc/apache2/conf-enabled/zz-kizlo-listen.conf:ro")
48
+ })
49
+ })
50
+
51
+ describe("uploads.ini", () => {
52
+ test("raises the upload ceiling to 2 GB", () => {
53
+ expect(ini(UPLOADS_INI).upload_max_filesize).toBe("2G")
54
+ })
55
+
56
+ test("allows POST overhead above the file limit for the multipart envelope", () => {
57
+ const values = ini(UPLOADS_INI)
58
+ expect(bytes(values.post_max_size ?? "")).toBeGreaterThan(bytes(values.upload_max_filesize ?? ""))
59
+ })
60
+ })
61
+
62
+ describe("apache-listen.conf", () => {
63
+ test("listens on the injected published port", () => {
64
+ expect(fs.readFileSync(APACHE_LISTEN_CONF, "utf8")).toMatch(/^\s*Listen\s+\$\{WP_PORT\}\s*$/m)
65
+ })
66
+ })
@@ -40,6 +40,11 @@ services:
40
40
  WORDPRESS_DB_NAME: ${MYSQL_DATABASE:-wordpress}
41
41
  WORDPRESS_DB_USER: ${MYSQL_USER:-wordpress}
42
42
  WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-wppass}
43
+ # Published host port, handed to Apache so `apache-listen.conf` can add a
44
+ # second listener on it (see that file). Defaulted here to match the port
45
+ # mapping above so a standalone `docker compose up` still parses the config;
46
+ # every path through the CLI supplies the resolved port as WP_PORT.
47
+ WP_PORT: ${WP_PORT:-8080}
43
48
  # The wordpress image eval()s WORDPRESS_CONFIG_EXTRA at runtime, and Compose
44
49
  # interpolates `$` in this file first — so every PHP variable below is written
45
50
  # `$$` to survive Compose and reach PHP as a literal `$`.
@@ -56,6 +61,11 @@ services:
56
61
  }
57
62
  volumes:
58
63
  - wp_data:/var/www/html
64
+ # Real PHP upload limits and the extra Apache listener, both shipped next to
65
+ # this file (relative binds resolve against the compose file's directory) and
66
+ # mounted read-only. In the base compose so dev and test stacks both get them.
67
+ - ./uploads.ini:/usr/local/etc/php/conf.d/zz-kizlo-uploads.ini:ro
68
+ - ./apache-listen.conf:/etc/apache2/conf-enabled/zz-kizlo-listen.conf:ro
59
69
  healthcheck:
60
70
  # wp-login.php always returns 200 unauthenticated; /wp-json can be gated to 401
61
71
  # by plugins, so it's not a reliable liveness probe.
@@ -0,0 +1,12 @@
1
+ ; Kizlo local WordPress — raise PHP's upload ceiling for large imports.
2
+ ;
3
+ ; PHP rejects an oversized request before WordPress (or an upload plugin) ever
4
+ ; sees it, so a WordPress hook that only changes the *displayed* limit is not
5
+ ; enough. These are the real server limits the local stacks enforce.
6
+ ;
7
+ ; post_max_size is deliberately larger than upload_max_filesize: a file upload
8
+ ; arrives as a multipart POST, so the whole request is a little bigger than the
9
+ ; file itself. 2100M leaves headroom above the 2G (2048M) file limit for that
10
+ ; envelope. Nothing else (memory_limit, execution time) is touched.
11
+ upload_max_filesize=2G
12
+ post_max_size=2100M
@@ -24,6 +24,10 @@ declare function kizloRelease(slug: string): string;
24
24
  declare const COMPOSE_FILE: string;
25
25
  /** PHP OPcache config, shipped alongside this module and bind-mounted into the local WordPress. */
26
26
  declare const OPCACHE_INI: string;
27
+ /** PHP upload-limit config, shipped alongside this module and bind-mounted into the local WordPress. */
28
+ declare const UPLOADS_INI: string;
29
+ /** Apache extra-listener config, shipped alongside this module and bind-mounted into the local WordPress. */
30
+ declare const APACHE_LISTEN_CONF: string;
27
31
  /** Linux-only entrypoint that retags www-data to the host user (see the script for why). */
28
32
  declare const REMAP_ENTRYPOINT: string;
29
33
  declare const CONFIG_FILES: string[];
@@ -54,4 +58,4 @@ declare const DEFAULT_PLUGINS: PluginSource[];
54
58
  declare const TEST_ADMIN: Omit<TestAdminUser, "id" | "applicationPassword">;
55
59
  declare const TEST_USER: Omit<TestUser, "id">;
56
60
  //#endregion
57
- export { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease };
61
+ export { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease };
@@ -30,6 +30,10 @@ const HERE = dirname(fileURLToPath(import.meta.url));
30
30
  const COMPOSE_FILE = resolve(HERE, "compose/docker-compose.yml");
31
31
  /** PHP OPcache config, shipped alongside this module and bind-mounted into the local WordPress. */
32
32
  const OPCACHE_INI = resolve(HERE, "compose/opcache.ini");
33
+ /** PHP upload-limit config, shipped alongside this module and bind-mounted into the local WordPress. */
34
+ const UPLOADS_INI = resolve(HERE, "compose/uploads.ini");
35
+ /** Apache extra-listener config, shipped alongside this module and bind-mounted into the local WordPress. */
36
+ const APACHE_LISTEN_CONF = resolve(HERE, "compose/apache-listen.conf");
33
37
  /** Linux-only entrypoint that retags www-data to the host user (see the script for why). */
34
38
  const REMAP_ENTRYPOINT = resolve(HERE, "compose/remap-entrypoint.sh");
35
39
  const CONFIG_FILES = [
@@ -81,4 +85,4 @@ const TEST_USER = {
81
85
  };
82
86
 
83
87
  //#endregion
84
- export { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease };
88
+ export { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease };
package/dist/config.d.ts CHANGED
@@ -20,8 +20,9 @@ type KizloDir = string | {
20
20
  };
21
21
  interface KizloDevConfig {
22
22
  /**
23
- * Run the dev stack. On by default when local WordPress is enabled; set `false` to keep local
24
- * WordPress on for `kizlo test` while `kizlo dev` runs the contract watcher alone.
23
+ * Run the dev stack under `kizlo dev`. Off unless set to `true`; `local: true` is the shorthand that
24
+ * turns both stacks on. Leave it off to keep the stack configured while `kizlo dev` runs the contract
25
+ * watcher alone (for example when only `kizlo test` boots local WordPress).
25
26
  */
26
27
  enable?: boolean;
27
28
  /** Published WP port (default 8080). */
@@ -59,8 +60,9 @@ interface KizloDevConfig {
59
60
  }
60
61
  interface KizloTestConfig {
61
62
  /**
62
- * Run the test stack. On by default when local WordPress is enabled; set `false` to keep local
63
- * WordPress on for `kizlo dev` while `kizlo test` just runs the project's own test script.
63
+ * Run the test stack under `kizlo test`. Off unless set to `true`; `local: true` is the shorthand that
64
+ * turns both stacks on. Leave it off and `kizlo test` just runs the project's own test script without
65
+ * booting local WordPress.
64
66
  */
65
67
  enable?: boolean;
66
68
  /**
@@ -91,8 +93,9 @@ interface KizloTestConfig {
91
93
  }
92
94
  interface KizloLocalConfig {
93
95
  /**
94
- * Enable local Docker WordPress (default `true` in this object form). Set `false` to keep the
95
- * stacks configured but off, the same as omitting `local` entirely.
96
+ * Master switch for local Docker WordPress (default `true` in this object form). Set `false` to keep
97
+ * the stacks configured but off, the same as omitting `local` entirely. Each stack is still off until
98
+ * its own `enable: true` — see {@link KizloDevConfig.enable} and {@link KizloTestConfig.enable}.
96
99
  */
97
100
  enable?: boolean;
98
101
  /**
@@ -131,9 +134,9 @@ interface KizloGlobalConfig {
131
134
  */
132
135
  alias?: string;
133
136
  /**
134
- * Local Docker WordPress, off unless set. `true` enables both the dev and test stacks with
135
- * defaults; the object form enables and configures them, and is where the stack name, the
136
- * per-branch `worktrees` toggle, and the two stacks live.
137
+ * Local Docker WordPress, off unless set. `true` enables both the dev and test stacks with defaults;
138
+ * the object form configures them, with each stack off until its own `enable: true`, and is where the
139
+ * stack name, the per-branch `worktrees` toggle, and the two stacks live.
137
140
  */
138
141
  local?: boolean | KizloLocalConfig;
139
142
  }
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ import { AnyMiddleware, ExtractMiddlewareContextOutput, InferMiddlewares, Middle
30
30
  import { AnyProcedure, AnyProcedureTree, BaseHandlerOptions, ExtractParams, ExtractProcedureByScope, InvocationScope, OpenapiPart, Procedure, ProcedureErrors, ProcedureHandler, ProcedureOptions, ProcedureTreeDepthTuple, ResolveParamsPart, ResolvedSchemaInput, ResolvedSchemaOutput, SchemaIO, buildProcedure, combineDetailed, createProcedure, handleUnexpectedError, schemaType } from "./shared/procedure.js";
31
31
  import { AnyIntegration, EnvReader, EnvRecord, EnvSource, ExtractIntegrationProcedures, InferIntegrationProcedures, Integration, IntegrationRequirements, KizloEnv, WordPressEnv, assertIntegrationEndpoints, assertIntegrationEnv, createIntegration, missingEndpoints, missingEnv, readEnv } from "./shared/integration.js";
32
32
  import { InferProcedureData, InferProcedureError, InferProcedureInput, InferProcedureResult, KizloErrorUnion, KizloResult, MaybeCallerOptions, ProcedureMethod, ResultClient, createResultClient } from "./shared/result.js";
33
- import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, RootProcedures, S2SClient, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection } from "./kizlo.js";
33
+ import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, RootProcedures, S2SClient, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection, wordPressConnectionComplete } from "./kizlo.js";
34
34
  import { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute } from "./brand/manifest.js";
35
35
  import "./brand/index.js";
36
36
  import { KizloClient, KizloClientConfig, createKizloClient } from "./client.js";
@@ -43,4 +43,4 @@ import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
43
43
  import { Identifier, parseIdentifier } from "./shared/identifier.js";
44
44
  import { createOrpcRouter } from "./shared/router.js";
45
45
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
46
- export { ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetSession, AuthUser, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, type Category, type CategoryCustomFields, CategoryCustomFieldsSchema, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CoreProcedures, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, EnvReader, EnvRecord, EnvSource, ErrorDefinition, EventHandler, EventHandlerFn, ExtractIntegrationProcedures, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, HeadlessSettings, HeadlessSettingsInput, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, InferProcedureData, InferProcedureError, InferProcedureInput, InferProcedureResult, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, KizloErrorUnion, KizloResult, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeCallerOptions, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, type Page, type PageCustomFields, PageCustomFieldsSchema, PersonSettings, PersonSettingsInput, PluginSource, type Post, type PostCustomFields, PostCustomFieldsSchema, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureMethod, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, ResultClient, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, SessionFn, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, type Tag, type TagCustomFields, TagCustomFieldsSchema, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UploadsSettings, UploadsSettingsInput, VerifyCaptchaFn, VerifyPreviewTokenFn, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapUrl, WPK_SitemapUrlImage, 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_Error, 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, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressEnv, WordPressTransport, WordPressTransportOptions, WordPressTransportResult, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createResultClient, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
46
+ export { ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetSession, AuthUser, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, type Category, type CategoryCustomFields, CategoryCustomFieldsSchema, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CoreProcedures, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, EnvReader, EnvRecord, EnvSource, ErrorDefinition, EventHandler, EventHandlerFn, ExtractIntegrationProcedures, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, HeadlessSettings, HeadlessSettingsInput, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, InferProcedureData, InferProcedureError, InferProcedureInput, InferProcedureResult, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, KizloErrorUnion, KizloResult, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeCallerOptions, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, type Page, type PageCustomFields, PageCustomFieldsSchema, PersonSettings, PersonSettingsInput, PluginSource, type Post, type PostCustomFields, PostCustomFieldsSchema, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureMethod, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, ResultClient, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, SessionFn, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, type Tag, type TagCustomFields, TagCustomFieldsSchema, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UploadsSettings, UploadsSettingsInput, VerifyCaptchaFn, VerifyPreviewTokenFn, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapUrl, WPK_SitemapUrlImage, 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_Error, 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, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressEnv, WordPressTransport, WordPressTransportOptions, WordPressTransportResult, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createResultClient, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wordPressConnectionComplete, wpEndpoint, xmlResponse };
package/dist/index.js CHANGED
@@ -34,8 +34,8 @@ import { TagCustomFieldsSchema } from "./tag/schema.js";
34
34
  import { CORE_PROCEDURES } from "./procedures.js";
35
35
  import { assertIntegrationEndpoints, assertIntegrationEnv, createIntegration, missingEndpoints, missingEnv, readEnv } from "./shared/integration.js";
36
36
  import { createEventHandler, createWebhookRouter } from "./webhook/index.js";
37
- import { Kizlo, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection } from "./kizlo.js";
37
+ import { Kizlo, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection, wordPressConnectionComplete } from "./kizlo.js";
38
38
  import { SITEMAP_BASE, SITEMAP_INDEX_SLUG, createSitemapRedirectRoute, createSitemapRoute } from "./seo/sitemap.js";
39
39
  import { createMiddleware } from "./shared/middleware.js";
40
40
 
41
- export { COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CategoryCustomFieldsSchema, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, PageCustomFieldsSchema, PostCustomFieldsSchema, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, TagCustomFieldsSchema, WEB_MANIFEST_ROUTE, WP_Error, WordPressTransport, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createResultClient, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
41
+ export { COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CategoryCustomFieldsSchema, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, PageCustomFieldsSchema, PostCustomFieldsSchema, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, TagCustomFieldsSchema, WEB_MANIFEST_ROUTE, WP_Error, WordPressTransport, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createResultClient, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wordPressConnectionComplete, wpEndpoint, xmlResponse };
package/dist/kizlo.d.ts CHANGED
@@ -52,6 +52,12 @@ interface CreateKizloOptions<TIntegrations extends readonly AnyIntegration[] = [
52
52
  * Kizlo's active WordPress connection from the canonical `mode` value.
53
53
  */
54
54
  declare function integrationEnv(integrations: readonly AnyIntegration[]): EnvReader;
55
+ /**
56
+ * Whether the active profile carries a full WordPress connection, without throwing. The dev/generate
57
+ * flow uses this to decide whether introspection can be fetched at all; {@link resolveWordPressConnection}
58
+ * throws for the request path that must have a connection.
59
+ */
60
+ declare function wordPressConnectionComplete(env: EnvReader): boolean;
55
61
  declare function resolveWordPressConnection(env: EnvReader): {
56
62
  credentials: WordPressCredentials;
57
63
  };
@@ -65,4 +71,4 @@ declare function resolveKizloConfig<TIntegrations extends readonly AnyIntegratio
65
71
  */
66
72
  declare function createKizlo<TIntegrations extends readonly AnyIntegration[] = []>(options?: CreateKizloOptions<TIntegrations>): Kizlo<TIntegrations>;
67
73
  //#endregion
68
- export { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, RootProcedures, S2SClient, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection };
74
+ export { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, RootProcedures, S2SClient, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection, wordPressConnectionComplete };
package/dist/kizlo.js CHANGED
@@ -8,7 +8,7 @@ import { isTypescriptObject } from "./shared/utils.js";
8
8
  import { Context } from "./context.js";
9
9
  import { CORE_PROCEDURES } from "./procedures.js";
10
10
  import { isContractGeneration } from "./shared/contract-generation.js";
11
- import { assertIntegrationEndpoints, assertIntegrationEnv, readEnv } from "./shared/integration.js";
11
+ import { assertIntegrationEndpoints, assertIntegrationEnv, missingEnv, readEnv } from "./shared/integration.js";
12
12
  import { createWebhookRouter } from "./webhook/index.js";
13
13
  import { tryCatch } from "@kizlo/shared";
14
14
  import { ORPCError, createRouterClient } from "@orpc/server";
@@ -161,6 +161,20 @@ function requireEnvValue(name, env) {
161
161
  if (isContractGeneration()) return "";
162
162
  throw new KizloError("MISSING_ENV_VALUE", { message: `Kizlo requires the "${name}" environment value. Provide it through an integration or an explicit createKizlo option.` });
163
163
  }
164
+ /** The three connection values a WordPress request needs, scoped to the active profile by {@link integrationEnv}. */
165
+ const WORDPRESS_CONNECTION_VALUES = [
166
+ "wordpressUrl",
167
+ "wordpressUsername",
168
+ "wordpressPassword"
169
+ ];
170
+ /**
171
+ * Whether the active profile carries a full WordPress connection, without throwing. The dev/generate
172
+ * flow uses this to decide whether introspection can be fetched at all; {@link resolveWordPressConnection}
173
+ * throws for the request path that must have a connection.
174
+ */
175
+ function wordPressConnectionComplete(env) {
176
+ return missingEnv(env, WORDPRESS_CONNECTION_VALUES).length === 0;
177
+ }
164
178
  function resolveWordPressConnection(env) {
165
179
  return { credentials: {
166
180
  url: requireEnvValue("wordpressUrl", env),
@@ -194,4 +208,4 @@ function createKizlo(options) {
194
208
  }
195
209
 
196
210
  //#endregion
197
- export { Kizlo, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection };
211
+ export { Kizlo, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPressConnection, wordPressConnectionComplete };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.20.0";
2
+ var version = "0.20.2";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/test.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DevPluginSource, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, JsonValue, LocalPlugin, PluginSource, SeedContext, SettleContext, TestAdminUser, TestCredentials, TestUser, defineFixture, isLocalPlugin } from "./cli/wp/types.js";
2
- import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
2
+ import { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
3
  import { DockerStack, DockerStatus, RunResult, Stack, StackStatus, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, runningProjectContainers, stackStatus, stopProjectContainers, wpCli, wpEval } from "./cli/wp/docker.js";
4
4
  import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource, settleFixtures } from "./cli/wp/utils.js";
5
5
  import { TestAuthAdapterUser, toTestUser } from "./test/users.js";
@@ -8,4 +8,4 @@ import { CAPTCHA_TEST_TOKEN_PASS, captchaMock } from "./test/captcha.js";
8
8
  import { menuFixture } from "./menu/fixture.js";
9
9
  import { postFixture } from "./post/fixture.js";
10
10
  import { coreFixtures } from "./test/fixtures.js";
11
- export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, DevPluginSource, DockerStack, DockerStatus, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, INTROSPECTION_META_REL, JsonValue, LOCAL_DIR_REL, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, SettleContext, Stack, StackStatus, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
11
+ export { APACHE_LISTEN_CONF, CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, DevPluginSource, DockerStack, DockerStatus, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, INTROSPECTION_META_REL, JsonValue, LOCAL_DIR_REL, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, SettleContext, Stack, StackStatus, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, UPLOADS_INI, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
package/dist/test.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineFixture, isLocalPlugin } from "./cli/wp/types.js";
2
- import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
2
+ import { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
3
  import { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, runningProjectContainers, stackStatus, stopProjectContainers, wpCli, wpEval } from "./cli/wp/docker.js";
4
4
  import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource, settleFixtures } from "./cli/wp/utils.js";
5
5
  import { testAuthAdapter } from "./test/auth.js";
@@ -9,4 +9,4 @@ import { postFixture } from "./post/fixture.js";
9
9
  import { coreFixtures } from "./test/fixtures.js";
10
10
  import { toTestUser } from "./test/users.js";
11
11
 
12
- export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
12
+ export { APACHE_LISTEN_CONF, CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizlo",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "type": "module",
5
5
  "description": "A headless WordPress framework for TypeScript.",
6
6
  "keywords": [