okno 1.0.0-beta.37 → 1.0.0-beta.39

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { o as a } from "./plugin-CPb37kty.js";
1
+ import { o as a } from "./plugin-BdiBIiAv.js";
2
2
  export {
3
3
  a as okno
4
4
  };
package/dist/init.d.ts CHANGED
@@ -22,11 +22,31 @@ export interface AppDir {
22
22
  * by name for a stable prompt. Empty when the root has no app subdirs (the plain
23
23
  * single-project case — the caller then proceeds on the root as before). */
24
24
  export declare function detectApps(cwd: string): AppDir[];
25
- /** Add `okno()` as the first entry of the config's `plugins: [...]` array and
26
- * import it, via a format-preserving string edit (works for tabs OR spaces — we
27
- * never reformat). Returns false (→ manual fallback) if there's no `plugins`
28
- * array to extend, e.g. a bare `defineConfig({})`. Idempotent. */
25
+ /** Add `okno()` to the config's `plugins: [...]`. `plugins:` skips an
26
+ * `integrations:` array, so this targets the right one in an Astro config too. */
29
27
  export declare function addPlugin(configPath: string): boolean;
28
+ /**
29
+ * Astro owns its HTML and bypasses Vite's `transformIndexHtml`, so the Vite plugin
30
+ * can't inject the production editor boot into Astro pages. The `okno/astro`
31
+ * integration can (via `injectScript`) — and it registers the Vite plugin itself.
32
+ * So for Astro we add `integrations: [okno()]` (from "okno/astro") instead of the
33
+ * bare Vite plugin. Returns false (caller falls back to a printed instruction) if
34
+ * the config shape is unexpected.
35
+ */
36
+ export declare function addAstroIntegration(configPath: string): boolean;
37
+ /**
38
+ * Wire the PRODUCTION editor boot so a deployed site ships the on-demand editor
39
+ * loader with no hand-written `import "okno/boot"`:
40
+ * - vite (plain Vite / Solid): nothing — the plugin injects boot at build via
41
+ * `transformIndexHtml` (their HTML flows through Vite's index.html pipeline).
42
+ * - astro: nothing here — the `okno/astro` integration injects it (see
43
+ * {@link addAstroIntegration}).
44
+ * - sveltekit: create `src/hooks.client.ts` — runs once on the client for every
45
+ * route, so its `import "okno/boot"` side effect installs the gate everywhere.
46
+ * - nuxt: create `plugins/okno.client.ts` — Nuxt auto-loads client plugins.
47
+ * Idempotent (never overwrites an existing file). Returns a note line or null.
48
+ */
49
+ export declare function wireBoot(cwd: string, framework: Framework): string | null;
30
50
  export type ScaffoldMode = "starter" | "empty";
31
51
  /**
32
52
  * Scaffold okno/ if there's no okno/ yet. Two modes:
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAkBA,KAAK,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEpE,UAAU,QAAQ;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,yEAAyE;IACzE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,oFAAoF;IACpF,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;CACzB;AAiBD,kEAAkE;AAClE,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CA0B5C;AAED;6DAC6D;AAC7D,MAAM,WAAW,MAAM;IACtB;yEACqE;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACpB;AAKD;;;;6EAI6E;AAC7E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBhD;AAED;;;mEAGmE;AACnE,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CA8BrD;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,YAAwB,GAAG,OAAO,CAmB7E;AAoGD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWrD;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAgB/E;AA2DD,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA8L7C"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAqBA,KAAK,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEpE,UAAU,QAAQ;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,yEAAyE;IACzE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,oFAAoF;IACpF,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;CACzB;AAiBD,kEAAkE;AAClE,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CA0B5C;AAED;6DAC6D;AAC7D,MAAM,WAAW,MAAM;IACtB;yEACqE;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACpB;AAKD;;;;6EAI6E;AAC7E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBhD;AAsCD;mFACmF;AACnF,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAoBzE;AA0BD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,YAAwB,GAAG,OAAO,CAmB7E;AAoGD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWrD;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAgB/E;AA2DD,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA6K7C"}
package/dist/init.js CHANGED
@@ -1,6 +1,6 @@
1
- import { existsSync as l, readFileSync as m, readdirSync as I, writeFileSync as f, mkdirSync as g } from "node:fs";
2
- import { join as i, basename as $, dirname as v } from "node:path";
3
- import { fileURLToPath as j } from "node:url";
1
+ import { existsSync as c, readFileSync as m, readdirSync as R, mkdirSync as h, writeFileSync as f } from "node:fs";
2
+ import { join as r, basename as T, dirname as v } from "node:path";
3
+ import { fileURLToPath as I } from "node:url";
4
4
  import { spawnSync as M } from "node:child_process";
5
5
  const d = {
6
6
  astro: ["astro.config.mjs", "astro.config.ts", "astro.config.js"],
@@ -8,68 +8,102 @@ const d = {
8
8
  nuxt: ["nuxt.config.ts", "nuxt.config.js"],
9
9
  vite: ["vite.config.ts", "vite.config.js", "vite.config.mjs"]
10
10
  };
11
- function k(e, t) {
12
- for (const n of t) {
13
- const o = i(e, n);
14
- if (l(o)) return o;
11
+ function k(e, o) {
12
+ for (const n of o) {
13
+ const t = r(e, n);
14
+ if (c(t)) return t;
15
15
  }
16
16
  return null;
17
17
  }
18
18
  function y(e) {
19
- const t = i(e, "package.json"), n = {};
20
- if (l(t))
19
+ const o = r(e, "package.json"), n = {};
20
+ if (c(o))
21
21
  try {
22
- const r = JSON.parse(m(t, "utf-8"));
23
- Object.assign(n, r.dependencies, r.devDependencies);
22
+ const s = JSON.parse(m(o, "utf-8"));
23
+ Object.assign(n, s.dependencies, s.devDependencies);
24
24
  } catch {
25
25
  }
26
- const o = (r) => r in n;
27
- return o("astro") || k(e, d.astro) ? { framework: "astro", configPath: k(e, d.astro), pluginsAt: "vite" } : o("nuxt") ? { framework: "nuxt", configPath: k(e, d.nuxt), pluginsAt: "vite" } : o("@sveltejs/kit") ? { framework: "sveltekit", configPath: k(e, d.vite), pluginsAt: "top" } : o("vite") ? { framework: "vite", configPath: k(e, d.vite), pluginsAt: "top" } : { framework: "unknown", configPath: null, pluginsAt: "top" };
26
+ const t = (s) => s in n;
27
+ return t("astro") || k(e, d.astro) ? { framework: "astro", configPath: k(e, d.astro), pluginsAt: "vite" } : t("nuxt") ? { framework: "nuxt", configPath: k(e, d.nuxt), pluginsAt: "vite" } : t("@sveltejs/kit") ? { framework: "sveltekit", configPath: k(e, d.vite), pluginsAt: "top" } : t("vite") ? { framework: "vite", configPath: k(e, d.vite), pluginsAt: "top" } : { framework: "unknown", configPath: null, pluginsAt: "top" };
28
28
  }
29
- const R = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".git", ".output", ".nuxt", ".svelte-kit", ".vercel", "okno"]);
30
- function T(e) {
31
- let t;
29
+ const E = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".git", ".output", ".nuxt", ".svelte-kit", ".vercel", "okno"]);
30
+ function _(e) {
31
+ let o;
32
32
  try {
33
- t = I(e, { withFileTypes: !0 }).filter((o) => o.isDirectory() && !o.name.startsWith(".") && !R.has(o.name)).map((o) => o.name);
33
+ o = R(e, { withFileTypes: !0 }).filter((t) => t.isDirectory() && !t.name.startsWith(".") && !E.has(t.name)).map((t) => t.name);
34
34
  } catch {
35
35
  return [];
36
36
  }
37
37
  const n = [];
38
- for (const o of t) {
39
- if (!l(i(e, o, "package.json"))) continue;
40
- const { framework: r } = y(i(e, o));
41
- r !== "unknown" && n.push({ name: o, framework: r });
38
+ for (const t of o) {
39
+ if (!c(r(e, t, "package.json"))) continue;
40
+ const { framework: s } = y(r(e, t));
41
+ s !== "unknown" && n.push({ name: t, framework: s });
42
42
  }
43
- return n.sort((o, r) => o.name.localeCompare(r.name));
43
+ return n.sort((t, s) => t.name.localeCompare(s.name));
44
44
  }
45
- function S(e) {
45
+ function P(e, o, n) {
46
46
  let t = m(e, "utf-8");
47
- if (/from\s*["']okno\/vite["']/.test(t)) return !0;
48
- const n = t.match(/\bplugins\s*:\s*\[/);
49
- if (!n || n.index === void 0) return !1;
50
- const o = n.index + n[0].length, r = t.slice(o);
51
- let p;
52
- const u = r.match(/^[^\S\n]*\n(\s*)/);
53
- u ? p = `
54
- ${u[1]}okno(),` : r.trimStart().startsWith("]") ? p = "okno()" : p = "okno(), ", t = t.slice(0, o) + p + t.slice(o);
55
- const h = 'import { okno } from "okno/vite"', s = [...t.matchAll(/^import .*$/gm)];
56
- if (s.length) {
57
- const a = s[s.length - 1], c = a.index + a[0].length;
58
- t = t.slice(0, c) + `
59
- ` + h + t.slice(c);
47
+ if (new RegExp(`from\\s*["']${n}["']`).test(t)) return !0;
48
+ const s = t.match(new RegExp(`\\b${o}\\s*:\\s*\\[`));
49
+ if (!s || s.index === void 0) return !1;
50
+ const u = s.index + s[0].length, l = t.slice(u);
51
+ let i;
52
+ const a = l.match(/^[^\S\n]*\n(\s*)/);
53
+ a ? i = `
54
+ ${a[1]}okno(),` : l.trimStart().startsWith("]") ? i = "okno()" : i = "okno(), ", t = t.slice(0, u) + i + t.slice(u);
55
+ const p = `import { okno } from "${n}"`, g = [...t.matchAll(/^import .*$/gm)];
56
+ if (g.length) {
57
+ const b = g[g.length - 1], S = b.index + b[0].length;
58
+ t = t.slice(0, S) + `
59
+ ` + p + t.slice(S);
60
60
  } else
61
- t = h + `
61
+ t = p + `
62
62
  ` + t;
63
63
  return f(e, t), !0;
64
64
  }
65
- function _(e, t = "starter") {
66
- const n = i(e, "okno"), o = i(n, "schema.ts");
67
- return l(o) ? !1 : (g(n, { recursive: !0 }), t === "empty" ? (f(o, O), !0) : (g(i(n, "pages"), { recursive: !0 }), g(i(n, "globals"), { recursive: !0 }), f(o, E), f(i(n, "pages", "home.ts"), N), f(i(n, "globals", "meta.ts"), D), f(i(n, "globals", "navbar.ts"), F), f(i(n, "globals", "footer.ts"), H), !0));
65
+ function N(e) {
66
+ return P(e, "plugins", "okno/vite");
68
67
  }
69
- const O = `import type { Schema } from "okno"
68
+ function O(e) {
69
+ return P(e, "integrations", "okno/astro");
70
+ }
71
+ function D(e, o) {
72
+ const n = (s, u) => {
73
+ const l = r(e, s);
74
+ return c(l) ? `• Editor boot already wired (${s})` : (h(v(l), { recursive: !0 }), f(l, u), `✓ Wired the production editor boot in ${s}`);
75
+ }, t = '// okno editor boot: loads the editor on demand (press "e" / ?okno) in a\n// production build. Auto-added by `okno init`; safe to keep in git.\n';
76
+ switch (o) {
77
+ case "sveltekit":
78
+ return n("src/hooks.client.ts", `${t}import "okno/boot"
79
+ `);
80
+ case "nuxt":
81
+ return n(
82
+ "plugins/okno.client.ts",
83
+ `${t}import "okno/boot"
84
+ export default defineNuxtPlugin(() => {})
85
+ `
86
+ );
87
+ default:
88
+ return null;
89
+ }
90
+ }
91
+ function x(e, o, n) {
92
+ if (e.configPath) {
93
+ const s = e.configPath.replace(o + "/", ""), u = m(e.configPath, "utf-8");
94
+ e.framework === "astro" ? /from\s*["']okno\/astro["']/.test(u) ? n.push(`• Integration already in ${s}`) : O(e.configPath) ? n.push(`✓ Added the okno() integration to ${s}`) : n.push(`! Add \`integrations: [okno()]\` (from "okno/astro") to ${s} yourself`) : /from\s*["']okno\/vite["']/.test(u) ? n.push(`• Plugin already in ${s}`) : N(e.configPath) ? n.push(`✓ Added okno() to ${s}`) : n.push("! Add okno() to your config's plugins array yourself");
95
+ }
96
+ const t = D(o, e.framework);
97
+ t && n.push(t);
98
+ }
99
+ function F(e, o = "starter") {
100
+ const n = r(e, "okno"), t = r(n, "schema.ts");
101
+ return c(t) ? !1 : (h(n, { recursive: !0 }), o === "empty" ? (f(t, H), !0) : (h(r(n, "pages"), { recursive: !0 }), h(r(n, "globals"), { recursive: !0 }), f(t, V), f(r(n, "pages", "home.ts"), J), f(r(n, "globals", "meta.ts"), L), f(r(n, "globals", "navbar.ts"), W), f(r(n, "globals", "footer.ts"), K), !0));
102
+ }
103
+ const H = `import type { Schema } from "okno"
70
104
 
71
105
  export default {} satisfies Schema
72
- `, E = `import type { Schema } from "okno"
106
+ `, V = `import type { Schema } from "okno"
73
107
 
74
108
  export default {
75
109
  pages: {
@@ -132,15 +166,15 @@ export default {
132
166
  },
133
167
  },
134
168
  } satisfies Schema
135
- `, N = `export default {}
136
- `, D = `export default {
169
+ `, J = `export default {}
170
+ `, L = `export default {
137
171
  title: "My okno site",
138
172
  description: "Built with okno — a Git-backed CMS with live editing.",
139
173
  shareImage: null,
140
174
  favicon: null,
141
175
  touchicon: null,
142
176
  }
143
- `, F = `export default {
177
+ `, W = `export default {
144
178
  logo: null,
145
179
  links: [
146
180
  { text: "Home", url: "/", external: false },
@@ -148,43 +182,43 @@ export default {
148
182
  ],
149
183
  cta: { text: "Get started", url: "/", external: false },
150
184
  }
151
- `, H = `export default {
185
+ `, K = `export default {
152
186
  copy: "© My okno site",
153
187
  links: [{ text: "Home", url: "/", external: false }],
154
188
  }
155
189
  `;
156
- function b(e) {
157
- const t = v(j(import.meta.url)), n = i(t, "..", "skills", "connect-okno", "SKILL.md");
158
- if (!l(n)) return null;
159
- const o = i(".claude", "skills", "connect-okno", "SKILL.md"), r = i(e, o);
160
- return l(r) ? null : (g(v(r), { recursive: !0 }), f(r, m(n, "utf-8")), o);
190
+ function w(e) {
191
+ const o = v(I(import.meta.url)), n = r(o, "..", "skills", "connect-okno", "SKILL.md");
192
+ if (!c(n)) return null;
193
+ const t = r(".claude", "skills", "connect-okno", "SKILL.md"), s = r(e, t);
194
+ return c(s) ? null : (h(v(s), { recursive: !0 }), f(s, m(n, "utf-8")), t);
161
195
  }
162
- function x(e, t) {
163
- const n = t === "claude" ? ".mcp.json" : i(".cursor", "mcp.json"), o = i(e, n);
164
- let r = { mcpServers: {} };
165
- if (l(o))
196
+ function A(e, o) {
197
+ const n = o === "claude" ? ".mcp.json" : r(".cursor", "mcp.json"), t = r(e, n);
198
+ let s = { mcpServers: {} };
199
+ if (c(t))
166
200
  try {
167
- r = JSON.parse(m(o, "utf-8"));
201
+ s = JSON.parse(m(t, "utf-8"));
168
202
  } catch {
169
203
  }
170
- return r.mcpServers ??= {}, r.mcpServers.okno = { command: "npx", args: ["okno", "mcp"] }, g(i(o, ".."), { recursive: !0 }), f(o, JSON.stringify(r, null, 2) + `
204
+ return s.mcpServers ??= {}, s.mcpServers.okno = { command: "npx", args: ["okno", "mcp"] }, h(r(t, ".."), { recursive: !0 }), f(t, JSON.stringify(s, null, 2) + `
171
205
  `), n;
172
206
  }
173
207
  function C(e) {
174
- return l(i(e, "bun.lock")) || l(i(e, "bun.lockb")) ? "bun" : l(i(e, "pnpm-lock.yaml")) ? "pnpm" : l(i(e, "yarn.lock")) ? "yarn" : "npm";
208
+ return c(r(e, "bun.lock")) || c(r(e, "bun.lockb")) ? "bun" : c(r(e, "pnpm-lock.yaml")) ? "pnpm" : c(r(e, "yarn.lock")) ? "yarn" : "npm";
175
209
  }
176
- function V() {
210
+ function B() {
177
211
  try {
178
- const e = v(j(import.meta.url));
179
- return JSON.parse(m(i(e, "..", "package.json"), "utf-8")).version ?? "";
212
+ const e = v(I(import.meta.url));
213
+ return JSON.parse(m(r(e, "..", "package.json"), "utf-8")).version ?? "";
180
214
  } catch {
181
215
  return "";
182
216
  }
183
217
  }
184
- function J(e) {
185
- for (const t of [".mcp.json", i(".cursor", "mcp.json")]) {
186
- const n = i(e, t);
187
- if (l(n))
218
+ function G(e) {
219
+ for (const o of [".mcp.json", r(".cursor", "mcp.json")]) {
220
+ const n = r(e, o);
221
+ if (c(n))
188
222
  try {
189
223
  if (JSON.parse(m(n, "utf-8"))?.mcpServers?.okno) return !0;
190
224
  } catch {
@@ -192,56 +226,52 @@ function J(e) {
192
226
  }
193
227
  return !1;
194
228
  }
195
- function A(e) {
229
+ function $(e) {
196
230
  try {
197
- const t = JSON.parse(m(i(e, "package.json"), "utf-8"));
198
- return !!(t.dependencies?.okno || t.devDependencies?.okno);
231
+ const o = JSON.parse(m(r(e, "package.json"), "utf-8"));
232
+ return !!(o.dependencies?.okno || o.devDependencies?.okno);
199
233
  } catch {
200
234
  return !1;
201
235
  }
202
236
  }
203
- function w(e, t) {
204
- const n = V(), o = n ? `okno@${n}` : "okno", r = t === "npm" ? ["install", o] : ["add", o], p = `${t} ${r.join(" ")}`;
205
- return M(t, r, { cwd: e, stdio: "inherit", shell: process.platform === "win32" }).status === 0 ? p : null;
237
+ function j(e, o) {
238
+ const n = B(), t = n ? `okno@${n}` : "okno", s = o === "npm" ? ["install", t] : ["add", t], u = `${o} ${s.join(" ")}`;
239
+ return M(o, s, { cwd: e, stdio: "inherit", shell: process.platform === "win32" }).status === 0 ? u : null;
206
240
  }
207
- async function B() {
241
+ async function Q() {
208
242
  let e = process.cwd();
209
- const t = await import("@clack/prompts");
210
- if (t.intro("okno init"), y(e).framework === "unknown" && !l(i(e, "okno", "schema.ts"))) {
211
- const s = T(e);
212
- if (s.length) {
213
- const a = await t.select({
243
+ const o = await import("@clack/prompts");
244
+ if (o.intro("okno init"), y(e).framework === "unknown" && !c(r(e, "okno", "schema.ts"))) {
245
+ const i = _(e);
246
+ if (i.length) {
247
+ const a = await o.select({
214
248
  message: "Which app do you want to add okno to?",
215
249
  options: [
216
- ...s.map((c) => ({ value: c.name, label: c.name, hint: c.framework })),
250
+ ...i.map((p) => ({ value: p.name, label: p.name, hint: p.framework })),
217
251
  { value: "__here__", label: "This directory", hint: "install at the repo root" }
218
252
  ]
219
253
  });
220
- if (t.isCancel(a)) return t.cancel("Cancelled.");
221
- a !== "__here__" && (e = i(e, a), t.log.step(`Targeting ${$(e)}/`));
254
+ if (o.isCancel(a)) return o.cancel("Cancelled.");
255
+ a !== "__here__" && (e = r(e, a), o.log.step(`Targeting ${T(e)}/`));
222
256
  }
223
257
  }
224
258
  let n = y(e);
225
- if (l(i(e, "okno", "schema.ts"))) {
226
- const s = [];
227
- if (A(e))
228
- s.push("• okno already installed");
259
+ if (c(r(e, "okno", "schema.ts"))) {
260
+ const i = [];
261
+ if ($(e))
262
+ i.push("• okno already installed");
229
263
  else {
230
264
  const a = C(e);
231
- t.log.step(`Installing okno with ${a}…`);
232
- const c = w(e, a);
233
- s.push(
234
- c ? `✓ Installed okno (${c})` : `! Couldn't install okno — run \`${a === "npm" ? "npm install" : `${a} add`} okno\` yourself`
265
+ o.log.step(`Installing okno with ${a}…`);
266
+ const p = j(e, a);
267
+ i.push(
268
+ p ? `✓ Installed okno (${p})` : `! Couldn't install okno — run \`${a === "npm" ? "npm install" : `${a} add`} okno\` yourself`
235
269
  );
236
270
  }
237
- if (n.configPath) {
238
- const a = n.configPath.replace(e + "/", "");
239
- /from\s*["']okno\/vite["']/.test(m(n.configPath, "utf-8")) ? s.push(`• Plugin already in ${a}`) : S(n.configPath) ? s.push(`✓ Added okno() to ${a}`) : s.push("! Add okno() to your config's plugins array yourself");
240
- }
241
- if (s.push("• okno/ already scaffolded — left it alone"), J(e))
242
- s.push("• MCP already configured");
271
+ if (x(n, e, i), i.push("• okno/ already scaffolded — left it alone"), G(e))
272
+ i.push("• MCP already configured");
243
273
  else {
244
- const a = await t.select({
274
+ const a = await o.select({
245
275
  message: "Add the okno MCP server for your AI editor? (optional)",
246
276
  options: [
247
277
  { value: "skip", label: "Skip", hint: "default — add later with `okno mcp`" },
@@ -250,16 +280,16 @@ async function B() {
250
280
  ],
251
281
  initialValue: "skip"
252
282
  });
253
- if (!t.isCancel(a) && a !== "skip" && (s.push(`✓ Registered the okno MCP server in ${x(e, a)}`), a === "claude")) {
254
- const c = b(e);
255
- c && s.push(`✓ Installed the connect-okno skill in ${c}`);
283
+ if (!o.isCancel(a) && a !== "skip" && (i.push(`✓ Registered the okno MCP server in ${A(e, a)}`), a === "claude")) {
284
+ const p = w(e);
285
+ p && i.push(`✓ Installed the connect-okno skill in ${p}`);
256
286
  }
257
287
  }
258
- return t.note(s.join(`
259
- `), "okno is already set up"), t.outro("Run your dev server and press “e” (or visit ?okno) to open the editor.");
288
+ return o.note(i.join(`
289
+ `), "okno is already set up"), o.outro("Run your dev server and press “e” (or visit ?okno) to open the editor.");
260
290
  }
261
291
  if (n.framework === "unknown") {
262
- const s = await t.select({
292
+ const i = await o.select({
263
293
  message: "Which framework is this project?",
264
294
  options: [
265
295
  { value: "astro", label: "Astro" },
@@ -268,13 +298,13 @@ async function B() {
268
298
  { value: "nuxt", label: "Nuxt" }
269
299
  ]
270
300
  });
271
- if (t.isCancel(s)) return t.cancel("Cancelled.");
272
- const a = s, c = a === "astro" || a === "nuxt" ? "vite" : "top", P = d[a] ?? d.vite;
273
- n = { framework: a, configPath: k(e, P), pluginsAt: c };
301
+ if (o.isCancel(i)) return o.cancel("Cancelled.");
302
+ const a = i, p = a === "astro" || a === "nuxt" ? "vite" : "top", g = d[a] ?? d.vite;
303
+ n = { framework: a, configPath: k(e, g), pluginsAt: p };
274
304
  }
275
- let o = "starter";
276
- if (!l(i(e, "okno", "schema.ts"))) {
277
- const s = await t.select({
305
+ let t = "starter";
306
+ if (!c(r(e, "okno", "schema.ts"))) {
307
+ const i = await o.select({
278
308
  message: "Scaffold a Starter, or an empty schema?",
279
309
  options: [
280
310
  { value: "starter", label: "Starter", hint: "Home + Meta/Navbar/Footer globals, ready to edit" },
@@ -282,10 +312,10 @@ async function B() {
282
312
  ],
283
313
  initialValue: "starter"
284
314
  });
285
- if (t.isCancel(s)) return t.cancel("Cancelled.");
286
- o = s;
315
+ if (o.isCancel(i)) return o.cancel("Cancelled.");
316
+ t = i;
287
317
  }
288
- const p = await t.select({
318
+ const u = await o.select({
289
319
  message: "Set up the okno MCP server for your AI editor? (optional)",
290
320
  options: [
291
321
  { value: "skip", label: "Skip", hint: "default — add later with `okno mcp`" },
@@ -294,49 +324,39 @@ async function B() {
294
324
  ],
295
325
  initialValue: "skip"
296
326
  });
297
- if (t.isCancel(p)) return t.cancel("Cancelled.");
298
- const u = [];
299
- if (A(e))
300
- u.push("• okno already a dependency — skipped install");
327
+ if (o.isCancel(u)) return o.cancel("Cancelled.");
328
+ const l = [];
329
+ if ($(e))
330
+ l.push("• okno already a dependency — skipped install");
301
331
  else {
302
- const s = C(e);
303
- t.log.step(`Installing okno with ${s}…`);
304
- const a = w(e, s);
305
- u.push(
306
- a ? `✓ Installed okno (${a})` : `! Couldn't install okno automatically — run \`${s === "npm" ? "npm install" : `${s} add`} okno\` yourself`
332
+ const i = C(e);
333
+ o.log.step(`Installing okno with ${i}…`);
334
+ const a = j(e, i);
335
+ l.push(
336
+ a ? `✓ Installed okno (${a})` : `! Couldn't install okno automatically — run \`${i === "npm" ? "npm install" : `${i} add`} okno\` yourself`
307
337
  );
308
338
  }
309
- let h = !1;
310
- if (n.configPath && (h = S(n.configPath)), h)
311
- u.push(`✓ Added okno() to ${n.configPath.replace(e + "/", "")}`);
312
- else {
313
- const s = n.pluginsAt === "vite" ? `import { okno } from "okno/vite"
314
- // inside defineConfig:
315
- // vite: { plugins: [okno()] }` : `import { okno } from "okno/vite"
316
- // inside defineConfig:
317
- // plugins: [okno()]`;
318
- u.push(`! Couldn't edit your config automatically — add okno() yourself:
319
- ${s}`);
320
- }
321
- if (_(e, o) ? u.push(
322
- o === "starter" ? "✓ Scaffolded the okno Starter (Home + Meta/Navbar/Footer globals)" : "✓ Scaffolded an empty okno/ (schema only — nothing else)"
323
- ) : u.push("• okno/ already exists — left it alone"), p !== "skip") {
324
- const s = x(e, p);
325
- u.push(`✓ Registered the okno MCP server in ${s}`);
339
+ if (x(n, e, l), F(e, t) ? l.push(
340
+ t === "starter" ? "✓ Scaffolded the okno Starter (Home + Meta/Navbar/Footer globals)" : "✓ Scaffolded an empty okno/ (schema only — nothing else)"
341
+ ) : l.push("• okno/ already exists — left it alone"), u !== "skip") {
342
+ const i = A(e, u);
343
+ l.push(`✓ Registered the okno MCP server in ${i}`);
326
344
  }
327
- if (p === "claude") {
328
- const s = b(e);
329
- s && u.push(`✓ Installed the connect-okno skill in ${s}`);
345
+ if (u === "claude") {
346
+ const i = w(e);
347
+ i && l.push(`✓ Installed the connect-okno skill in ${i}`);
330
348
  }
331
- t.note(u.join(`
332
- `), "Done"), t.outro("Run your dev server and press “e” (or visit ?okno) to open the editor.");
349
+ o.note(l.join(`
350
+ `), "Done"), o.outro("Run your dev server and press “e” (or visit ?okno) to open the editor.");
333
351
  }
334
352
  export {
335
- S as addPlugin,
353
+ O as addAstroIntegration,
354
+ N as addPlugin,
336
355
  y as detect,
337
- T as detectApps,
338
- B as runInit,
339
- _ as scaffold,
340
- x as writeMcpConfig,
341
- b as writeSkill
356
+ _ as detectApps,
357
+ Q as runInit,
358
+ F as scaffold,
359
+ D as wireBoot,
360
+ A as writeMcpConfig,
361
+ w as writeSkill
342
362
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/local/dispatch.ts"],"names":[],"mappings":"AAqDA,4EAA4E;AAC5E,MAAM,WAAW,QAAQ;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IACpB,+BAA+B;IAC/B,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACzB,8DAA8D;IAC9D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACxC;AAED;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,YAAY,CAAA;CAC3B;AAED,kFAAkF;AAClF,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA6X1F"}
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/local/dispatch.ts"],"names":[],"mappings":"AAqDA,4EAA4E;AAC5E,MAAM,WAAW,QAAQ;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IACpB,+BAA+B;IAC/B,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACzB,8DAA8D;IAC9D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACxC;AAED;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,YAAY,CAAA;CAC3B;AAED,kFAAkF;AAClF,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA0Y1F"}
@@ -1,7 +1,7 @@
1
1
  import { join as c, relative as v, sep as O, resolve as g, dirname as R } from "node:path";
2
2
  import { existsSync as w, watch as E, readFileSync as M, mkdirSync as P, cpSync as A } from "node:fs";
3
3
  import { fileURLToPath as C } from "node:url";
4
- import { s as m, b as J, a as I, c as D, d as U, e as K, g as L, I as T, f as F, h as V, i as $, j as B, k as G } from "../dispatch-dIjAypRM.js";
4
+ import { s as m, b as J, a as I, c as D, d as U, e as K, g as L, I as T, f as F, h as V, i as $, j as B, k as G } from "../dispatch-BifB_3GO.js";
5
5
  import { mkdir as z, writeFile as f } from "node:fs/promises";
6
6
  const H = (n) => n.replaceAll(T, "__oknoSetImages(undefined)"), W = (n) => {
7
7
  let t = n;