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/astro/index.d.ts +13 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +15 -0
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/modules.d.ts.map +1 -1
- package/dist/dispatch-BifB_3GO.js +955 -0
- package/dist/editor/index.js +16807 -15811
- package/dist/index.js +1 -1
- package/dist/init.d.ts +24 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +167 -147
- package/dist/local/dispatch.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/{plugin-CPb37kty.js → plugin-BdiBIiAv.js} +167 -139
- package/dist/runtime/wrap.d.ts +23 -0
- package/dist/runtime/wrap.d.ts.map +1 -1
- package/dist/runtime/wrap.js +344 -226
- package/dist/types/schema.d.ts +23 -12
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/runtime/wrap.ts +288 -33
- package/dist/dispatch-dIjAypRM.js +0 -934
package/dist/index.js
CHANGED
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()`
|
|
26
|
-
*
|
|
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:
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"
|
|
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
|
|
2
|
-
import { join as
|
|
3
|
-
import { fileURLToPath as
|
|
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,
|
|
12
|
-
for (const n of
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
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
|
|
20
|
-
if (
|
|
19
|
+
const o = r(e, "package.json"), n = {};
|
|
20
|
+
if (c(o))
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
23
|
-
Object.assign(n,
|
|
22
|
+
const s = JSON.parse(m(o, "utf-8"));
|
|
23
|
+
Object.assign(n, s.dependencies, s.devDependencies);
|
|
24
24
|
} catch {
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
return
|
|
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
|
|
30
|
-
function
|
|
31
|
-
let
|
|
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
|
-
|
|
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
|
|
39
|
-
if (!
|
|
40
|
-
const { framework:
|
|
41
|
-
|
|
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((
|
|
43
|
+
return n.sort((t, s) => t.name.localeCompare(s.name));
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function P(e, o, n) {
|
|
46
46
|
let t = m(e, "utf-8");
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
let
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
${
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
t = t.slice(0,
|
|
59
|
-
` +
|
|
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 =
|
|
61
|
+
t = p + `
|
|
62
62
|
` + t;
|
|
63
63
|
return f(e, t), !0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
|
|
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
|
-
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
136
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
185
|
+
`, K = `export default {
|
|
152
186
|
copy: "© My okno site",
|
|
153
187
|
links: [{ text: "Home", url: "/", external: false }],
|
|
154
188
|
}
|
|
155
189
|
`;
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
const
|
|
160
|
-
return
|
|
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
|
|
163
|
-
const n =
|
|
164
|
-
let
|
|
165
|
-
if (
|
|
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
|
-
|
|
201
|
+
s = JSON.parse(m(t, "utf-8"));
|
|
168
202
|
} catch {
|
|
169
203
|
}
|
|
170
|
-
return
|
|
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
|
|
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
|
|
210
|
+
function B() {
|
|
177
211
|
try {
|
|
178
|
-
const e = v(
|
|
179
|
-
return JSON.parse(m(
|
|
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
|
|
185
|
-
for (const
|
|
186
|
-
const n =
|
|
187
|
-
if (
|
|
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
|
|
229
|
+
function $(e) {
|
|
196
230
|
try {
|
|
197
|
-
const
|
|
198
|
-
return !!(
|
|
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
|
|
204
|
-
const n =
|
|
205
|
-
return M(
|
|
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
|
|
241
|
+
async function Q() {
|
|
208
242
|
let e = process.cwd();
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
const a = await
|
|
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
|
-
...
|
|
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 (
|
|
221
|
-
a !== "__here__" && (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 (
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
|
|
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
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
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.
|
|
238
|
-
|
|
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
|
|
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 (!
|
|
254
|
-
const
|
|
255
|
-
|
|
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
|
|
259
|
-
`), "okno is already set up"),
|
|
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
|
|
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 (
|
|
272
|
-
const a =
|
|
273
|
-
n = { framework: a, configPath: k(e,
|
|
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
|
|
276
|
-
if (!
|
|
277
|
-
const
|
|
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 (
|
|
286
|
-
|
|
315
|
+
if (o.isCancel(i)) return o.cancel("Cancelled.");
|
|
316
|
+
t = i;
|
|
287
317
|
}
|
|
288
|
-
const
|
|
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 (
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
|
|
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
|
|
303
|
-
|
|
304
|
-
const a =
|
|
305
|
-
|
|
306
|
-
a ? `✓ Installed okno (${a})` : `! Couldn't install okno automatically — run \`${
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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 (
|
|
328
|
-
const
|
|
329
|
-
|
|
345
|
+
if (u === "claude") {
|
|
346
|
+
const i = w(e);
|
|
347
|
+
i && l.push(`✓ Installed the connect-okno skill in ${i}`);
|
|
330
348
|
}
|
|
331
|
-
|
|
332
|
-
`), "Done"),
|
|
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
|
-
|
|
353
|
+
O as addAstroIntegration,
|
|
354
|
+
N as addPlugin,
|
|
336
355
|
y as detect,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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,
|
|
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"}
|
package/dist/next/index.js
CHANGED
|
@@ -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-
|
|
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;
|