@oalo-ai/cli 0.9.1 → 0.10.1

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/man/oalo.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH OALO 1 "" "oalo 0.9.1" "OALO CLI"
1
+ .TH OALO 1 "" "oalo 0.10.1" "OALO CLI"
2
2
  .SH NAME
3
3
  oalo \- wire a local app into your Oalo workspace
4
4
  .SH SYNOPSIS
@@ -2302,6 +2302,123 @@ Built\-in presets: qa\-grind (ralph), bugfix (race), audit (read\-only swarm), f
2302
2302
  Add project\-specific packs as JSON files in .oalo/workflows/<name>.json.
2303
2303
  .PP
2304
2304
  Exit codes: 0 all stages passed; 1 a stage failed or stopped for human action; 2 bad arguments.
2305
+ .SS design
2306
+ Open Oalo Design Studio, iterate on artboards from the CLI, pull the locked Design Language for coding agents, or adopt it in emails, widgets, and chatbots.
2307
+ .PP
2308
+ \fBoalo design [open|new] ["<prompt>"] [\-\-model gemini_pro|gemini_fast|gemini_claude_mix|claude] [\-\-archetype <id>] [\-\-no\-browser] [\-\-json]\fR
2309
+ .br
2310
+ \fBoalo design sessions [\-\-limit <n>] [\-\-json]\fR
2311
+ .br
2312
+ \fBoalo design inspect [<session_id>] [\-\-json]\fR
2313
+ .br
2314
+ \fBoalo design inspire <image_path> [\-\-session <id>] [\-\-label "<name>"] [\-\-model <preset>] [\-\-json]\fR
2315
+ .br
2316
+ \fBoalo design iterate <artboard_id> "<instruction>" [\-\-session <id>] [\-\-model <preset>] [\-\-open] [\-\-json]\fR
2317
+ .br
2318
+ \fBoalo design fork <artboard_id> ["<instruction>"] [\-\-count 3] [\-\-session <id>] [\-\-model <preset>] [\-\-open] [\-\-json]\fR
2319
+ .br
2320
+ \fBoalo design crossbreed <artboard_a> <artboard_b> ["<instruction>"] [\-\-session <id>] [\-\-model <preset>] [\-\-open] [\-\-json]\fR
2321
+ .br
2322
+ \fBoalo design nudge <artboard_id> [\-\-hue <0..360>] [\-\-accent\-hue <0..360>] [\-\-warmth <\-1..1>] [\-\-mode light|dark] [\-\-font <pairing_id>] [\-\-radius sharp|sm|md|lg|pill] [\-\-density airy|balanced|compact] [\-\-json]\fR
2323
+ .br
2324
+ \fBoalo design critique <artboard_id> [\-\-model <preset>] [\-\-json]\fR
2325
+ .br
2326
+ \fBoalo design lock <artboard_id> [\-\-name "<name>"] [\-\-pull] [\-\-dir <path>] [\-\-agents\-md] [\-\-json]\fR
2327
+ .br
2328
+ \fBoalo design show [\-\-format summary|md|css|dart|json] [\-\-json]\fR
2329
+ .br
2330
+ \fBoalo design pull [\-\-dir <path>] [\-\-agents\-md] [\-\-no\-rules] [\-\-json]\fR
2331
+ .br
2332
+ \fBoalo design apply [\-\-email on|off] [\-\-widgets on|off] [\-\-chat all|<bot_ids>] [\-\-detach\-chat <bot_ids>] [\-\-json]\fR
2333
+ .br
2334
+ .TP
2335
+ \fB\-\-model <preset>\fR
2336
+ Model preset (gemini_pro default, gemini_fast, gemini_claude_mix, claude).
2337
+ .TP
2338
+ \fB\-\-archetype <id>\fR
2339
+ Screen archetype (auto, local_booking, saas_dashboard, consumer_mobile, editorial_landing, commerce_storefront).
2340
+ .TP
2341
+ \fB\-\-session <id>\fR
2342
+ Target session id (auto\-resolved from the artboard or latest session when omitted).
2343
+ .TP
2344
+ \fB\-\-count <1..4>\fR
2345
+ fork: number of child variations to generate (default 3).
2346
+ .TP
2347
+ \fB\-\-label <name>\fR
2348
+ inspire: optional label for the uploaded inspiration screenshot.
2349
+ .TP
2350
+ \fB\-\-hue <0..360>\fR
2351
+ nudge: deterministic brand hue angle in OKLCH.
2352
+ .TP
2353
+ \fB\-\-accent\-hue <0..360>\fR
2354
+ nudge: secondary accent hue angle.
2355
+ .TP
2356
+ \fB\-\-warmth <\-1..1>\fR
2357
+ nudge: neutral surface warmth (\-1 cool slate to +1 warm cream).
2358
+ .TP
2359
+ \fB\-\-mode light|dark\fR
2360
+ nudge: switch between light and dark surface polarity.
2361
+ .TP
2362
+ \fB\-\-font <pairing_id>\fR
2363
+ nudge: curated Google Font pairing id (e.g. fraunces\-jakarta, space\-ibm).
2364
+ .TP
2365
+ \fB\-\-radius <scale>\fR
2366
+ nudge: corner radius scale (sharp, sm, md, lg, pill).
2367
+ .TP
2368
+ \fB\-\-density <scale>\fR
2369
+ nudge: layout spacing density (airy, balanced, compact).
2370
+ .TP
2371
+ \fB\-\-name <name>\fR
2372
+ lock: custom name for the locked Design Language.
2373
+ .TP
2374
+ \fB\-\-pull\fR
2375
+ lock: immediately write .oalo/design/* and update CLAUDE.md locally after locking.
2376
+ .TP
2377
+ \fB\-\-open\fR
2378
+ iterate/fork/crossbreed: open the live Design Studio canvas URL in your browser.
2379
+ .TP
2380
+ \fB\-\-no\-browser\fR
2381
+ open/new: print the Design Studio canvas URL without launching a browser.
2382
+ .TP
2383
+ \fB\-\-no\-generate\fR
2384
+ open/new: create the session without immediately starting 4\-way generation.
2385
+ .TP
2386
+ \fB\-\-format <fmt>\fR
2387
+ show: summary, md, css, dart, or json.
2388
+ .TP
2389
+ \fB\-\-dir <path>\fR
2390
+ pull/lock \-\-pull: target project directory (default current directory).
2391
+ .TP
2392
+ \fB\-\-agents\-md\fR
2393
+ pull/lock \-\-pull: also write/update the bounded Design System section in AGENTS.md.
2394
+ .TP
2395
+ \fB\-\-no\-rules\fR
2396
+ pull/lock \-\-pull: write .oalo/design/* files only, without editing CLAUDE.md/AGENTS.md.
2397
+ .TP
2398
+ \fB\-\-email on|off\fR
2399
+ apply: opt\-in or opt\-out email template styling.
2400
+ .TP
2401
+ \fB\-\-widgets on|off\fR
2402
+ apply: opt\-in or opt\-out hosted /w/* and AI widget styling.
2403
+ .TP
2404
+ \fB\-\-chat all|<ids>\fR
2405
+ apply: apply Design Language style to all or specific chatbot ids.
2406
+ .TP
2407
+ \fB\-\-detach\-chat <ids>\fR
2408
+ apply: detach Design Language metadata from specific chatbot ids.
2409
+ .TP
2410
+ \fB\-\-json\fR
2411
+ Print structured JSON.
2412
+ .IP \(bu 2
2413
+ \fBoalo design "<prompt>"\fR creates a session, starts 4\-way live streaming generation, and opens the Design Studio infinite canvas in your browser.
2414
+ .IP \(bu 2
2415
+ Every terminal iteration command (iterate, fork, crossbreed, nudge, inspire) streams straight into the open web canvas in real time.
2416
+ .IP \(bu 2
2417
+ \fBoalo design pull\fR (or \fBoalo design lock <artboard_id> \-\-pull\fR) writes .oalo/design/{DESIGN.md,design\-tokens.json,theme.css,theme.dart} and updates CLAUDE.md so local coding agents (Claude Code, Codex, Cursor, OpenCode, \fBoalo build\fR) use your locked Design Language in new builds.
2418
+ .IP \(bu 2
2419
+ External agents connected via \fBoalo mcp\fR can also call the \fBget_design_system\fR MCP tool directly.
2420
+ .PP
2421
+ Exit codes: 0 ok; 1 no active design system, artboard not found, or server error; 2 not connected or invalid arguments.
2305
2422
  .SH BOT SETTINGS
2306
2423
  Read with \fBoalo bots settings <bot>\fR, changed with \fBoalo bots settings <bot> set key=value\fR, explained with \fBoalo bots settings \-\-explain <key>\fR. A change to a published bot needs \-\-yes.
2307
2424
  .SS knowledge
@@ -2548,7 +2665,7 @@ data (/api/sync/v1). From \fBoalo login\fR (read\-only), dashboard \-> Account \
2548
2665
  Server\-side only. Carries no end\-user identity, so it reads and writes EVERY member's rows. Never ship one inside a mobile or web app.
2549
2666
  .TP
2550
2667
  \fBcli\fR
2551
- control (the build surface). From \fBoalo login\fR, or dashboard \-> Account \-> CLI & agents. Used by whoami, tail, call, run, emit, data, db, metrics, dashboards, usage, inbox, crm, products, channels, incidents, tokens, docs, apps, setup, build, migrate, dockerfile, deploy, env, logs, secrets, loops, flows, pull, status, lint, push, qa, rehearse, bots, sources, machines, mcp.
2668
+ control (the build surface). From \fBoalo login\fR, or dashboard \-> Account \-> CLI & agents. Used by whoami, tail, call, run, emit, data, db, metrics, dashboards, usage, inbox, crm, products, channels, incidents, tokens, docs, apps, setup, build, migrate, dockerfile, deploy, env, logs, secrets, loops, flows, pull, status, lint, push, qa, rehearse, bots, sources, machines, design, mcp.
2552
2669
  .br
2553
2670
  Acts as you, with exactly your permissions. No read\-only mode. Treat it like a password.
2554
2671
  .SH ENVIRONMENT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oalo-ai/cli",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Wire a local app into your OALO workspace: link a token, generate typed bindings, and serve the build surface over MCP.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oalo",
3
3
  "description": "Work on an Oalo workspace from Claude Code: edit chat flows, loops and code tools, deploy and migrate apps, inspect and self-heal runtime errors, and run test conversations with a bot.",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "author": { "name": "Oalo" },
6
6
  "mcpServers": {
7
7
  "oalo": {
@@ -80,9 +80,14 @@ export async function coordInstall(flags) {
80
80
  // re-applies that in case a build came from elsewhere.
81
81
  if (process.platform === "darwin") spawnSync("codesign", ["--force", "--sign", "-", tmp], { stdio: "ignore" });
82
82
  const check = spawnSync(tmp, ["--version"], { encoding: "utf8" });
83
- if (check.status !== 0 || check.stdout.trim() !== rel.version) {
83
+ const gotVer = (check.stdout || "").trim();
84
+ if (check.status !== 0 || gotVer !== rel.version) {
84
85
  rmSync(tmp, { force: true });
85
- console.error(`oalo coord install: the downloaded build didn't start (${(check.stderr || check.error?.message || "").trim()}); nothing was installed`);
86
+ const detail =
87
+ check.status !== 0
88
+ ? (check.stderr || check.error?.message || `exit ${check.status}`).trim()
89
+ : `version mismatch: expected ${rel.version}, got ${gotVer || "(empty)"}`;
90
+ console.error(`oalo coord install: the downloaded build failed self-check (${detail}); nothing was installed`);
86
91
  process.exit(1);
87
92
  }
88
93
  renameSync(tmp, bin);
@@ -0,0 +1,746 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { basename, extname, join, resolve as resolvePath } from "node:path";
3
+ import { spawn } from "node:child_process";
4
+ import { OaloChannel } from "../channel.js";
5
+ import { resolve as resolveConfig, controlPlane, HOW_TO_CONNECT } from "../config.js";
6
+ import { dim } from "../events.js";
7
+
8
+ const CLAUDE_START = "<!-- OALO_DESIGN_SYSTEM_START -->";
9
+ const CLAUDE_END = "<!-- OALO_DESIGN_SYSTEM_END -->";
10
+
11
+ const VALID_MODELS = ["gemini_pro", "gemini_fast", "gemini_claude_mix", "claude"];
12
+ const SUBCOMMANDS = [
13
+ "open",
14
+ "new",
15
+ "sessions",
16
+ "inspect",
17
+ "inspire",
18
+ "iterate",
19
+ "fork",
20
+ "crossbreed",
21
+ "nudge",
22
+ "critique",
23
+ "lock",
24
+ "show",
25
+ "pull",
26
+ "apply",
27
+ ];
28
+
29
+ /**
30
+ * `oalo design`: open Oalo Design Studio, iterate on artboards from the
31
+ * terminal, inspect/pull the locked Design Language for local coding agents,
32
+ * or optionally adopt it in emails, widgets, and chatbots.
33
+ */
34
+ export async function design(flags, rest, opts = {}) {
35
+ const rawSub = rest[1];
36
+ const sub = SUBCOMMANDS.includes(rawSub) ? rawSub : "open";
37
+ const trailingArgs = sub === rawSub ? rest.slice(2) : rest.slice(1);
38
+
39
+ const cfg = resolveConfig(flags);
40
+ const { url, token } = controlPlane(cfg);
41
+ if (!url || !token) return fail(`oalo design needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2, flags);
42
+
43
+ const ch = (opts.channel || ((o) => new OaloChannel(o)))({ url, token });
44
+ const openFn = opts.openBrowser || openBrowser;
45
+
46
+ try {
47
+ await ch.connect();
48
+
49
+ switch (sub) {
50
+ case "sessions":
51
+ return await runSessions(ch, flags);
52
+ case "inspect":
53
+ return await runInspect(ch, url, trailingArgs, flags);
54
+ case "inspire":
55
+ return await runInspire(ch, trailingArgs, flags);
56
+ case "iterate":
57
+ return await runIterate(ch, url, trailingArgs, flags, openFn);
58
+ case "fork":
59
+ return await runFork(ch, url, trailingArgs, flags, openFn);
60
+ case "crossbreed":
61
+ return await runCrossbreed(ch, url, trailingArgs, flags, openFn);
62
+ case "nudge":
63
+ return await runNudge(ch, trailingArgs, flags);
64
+ case "critique":
65
+ return await runCritique(ch, trailingArgs, flags);
66
+ case "lock":
67
+ return await runLock(ch, trailingArgs, flags);
68
+ case "show":
69
+ return await runShow(ch, flags);
70
+ case "pull":
71
+ return await runPull(ch, flags);
72
+ case "apply":
73
+ return await runApply(ch, flags);
74
+ default:
75
+ return await runOpen(ch, url, sub, trailingArgs, flags, openFn);
76
+ }
77
+ } catch (e) {
78
+ return fail(e.message, 1, flags);
79
+ } finally {
80
+ ch.close();
81
+ }
82
+ }
83
+
84
+ async function runOpen(ch, baseUrl, sub, trailingArgs, flags, openFn) {
85
+ const prompt = trailingArgs.join(" ").trim();
86
+ const modelPreset = validateModel(flags.model, flags);
87
+ if (modelPreset === false) return;
88
+ const archetype = flags.archetype ? String(flags.archetype).trim() : undefined;
89
+
90
+ let session = null;
91
+ let generated = false;
92
+
93
+ if (sub === "new" || prompt) {
94
+ const created = await ch.call("design:sessions:create", {
95
+ ...(prompt ? { prompt } : {}),
96
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
97
+ ...(archetype ? { archetype } : {}),
98
+ });
99
+ session = created.session;
100
+
101
+ if (prompt && session?.id && !flags["no-generate"]) {
102
+ await ch.call("design:generate", {
103
+ session_id: session.id,
104
+ prompt,
105
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
106
+ ...(archetype ? { archetype } : {}),
107
+ });
108
+ generated = true;
109
+ }
110
+ } else {
111
+ const listed = await ch.call("design:sessions:list", { limit: 1 });
112
+ session = listed.sessions?.[0] || null;
113
+ }
114
+
115
+ const canvasUrl = buildCanvasUrl(baseUrl, session?.id);
116
+
117
+ if (!flags["no-browser"] && !flags.json) {
118
+ openFn(canvasUrl);
119
+ }
120
+
121
+ if (flags.json) {
122
+ console.log(JSON.stringify({ url: canvasUrl, session, generated }, null, 2));
123
+ return;
124
+ }
125
+
126
+ console.log(`Oalo Design Studio:\n\n ${canvasUrl}\n`);
127
+ if (generated) {
128
+ console.log(dim("Streaming 4 design directions live in the canvas."));
129
+ } else if (session?.id) {
130
+ console.log(dim(`Opened latest session "${session.title || session.id}". Start fresh with: oalo design "<prompt>"`));
131
+ }
132
+ console.log(dim("Inspect artboards from CLI: oalo design inspect"));
133
+ console.log(dim("Once locked, run `oalo design pull` in any local app repo to sync tokens + CLAUDE.md."));
134
+ }
135
+
136
+ async function runSessions(ch, flags) {
137
+ const limit = flags.limit ? Math.max(1, Number(flags.limit) || 20) : 20;
138
+ const res = await ch.call("design:sessions:list", { limit });
139
+ const sessions = res.sessions || [];
140
+
141
+ if (flags.json) {
142
+ console.log(JSON.stringify(res, null, 2));
143
+ return;
144
+ }
145
+
146
+ if (!sessions.length) {
147
+ console.log('No Design Studio sessions yet. Start one with: oalo design "your brand idea"');
148
+ return;
149
+ }
150
+
151
+ console.log(`Design Studio sessions (${sessions.length}):`);
152
+ for (const s of sessions) {
153
+ const lockTag = s.locked_artboard_id ? ` [locked: ${s.locked_artboard_id}]` : "";
154
+ console.log(` ${s.id} ${s.title || "(untitled)"} (${s.artboard_count ?? 0} artboards, ${s.model_preset || "gemini_pro"})${lockTag}`);
155
+ }
156
+ console.log(dim("Inspect artboards in a session: oalo design inspect <session_id>"));
157
+ }
158
+
159
+ async function runInspect(ch, baseUrl, trailingArgs, flags) {
160
+ const sessionId = await resolveSessionId(ch, trailingArgs[0] || flags.session);
161
+ if (!sessionId) {
162
+ return fail('No Design Studio session found. Create one with: oalo design "<prompt>"', 1, flags);
163
+ }
164
+
165
+ const res = await ch.call("design:sessions:get", { id: sessionId });
166
+ const s = res.session;
167
+
168
+ if (flags.json) {
169
+ console.log(JSON.stringify(res, null, 2));
170
+ return;
171
+ }
172
+
173
+ console.log(`Session ${s.id}: ${s.title || "(untitled)"}`);
174
+ console.log(` canvas: ${buildCanvasUrl(baseUrl, s.id)}`);
175
+ console.log(` model: ${s.model_preset || "gemini_pro"} archetype: ${s.archetype || "auto"}`);
176
+ if (s.inspirations?.length) {
177
+ console.log(` inspirations: ${s.inspirations.map((i) => i.label || i.id).join(", ")}`);
178
+ }
179
+
180
+ const boards = s.artboards || [];
181
+ if (!boards.length) {
182
+ console.log(" artboards: (none yet)");
183
+ return;
184
+ }
185
+
186
+ console.log(`\nArtboards (${boards.length}):`);
187
+ for (const a of boards) {
188
+ const c = a.tokens?.colors || {};
189
+ const t = a.tokens?.typography || {};
190
+ const parents = a.parent_ids?.length ? ` from [${a.parent_ids.join(", ")}]` : "";
191
+ const locked = s.locked_artboard_id === a.id ? " [LOCKED]" : "";
192
+ console.log(` ${a.id} ${a.title || "(untitled)"} [${a.lens || "-"} / ${a.status || "-"}]${parents}${locked}`);
193
+ console.log(` palette: bg ${c.bg || "-"} | surface ${c.surface || "-"} | text ${c.text || "-"} | accent ${c.accent || "-"}`);
194
+ console.log(` fonts: ${t.pairing_name || `${t.display_font || "-"} + ${t.body_font || "-"}`}`);
195
+ }
196
+ console.log(dim('\nIterate: oalo design iterate <artboard_id> "make the hero warmer and airier"'));
197
+ console.log(dim("Lock winner: oalo design lock <artboard_id> --pull"));
198
+ }
199
+
200
+ async function runInspire(ch, trailingArgs, flags) {
201
+ const imageArg = trailingArgs[0];
202
+ if (!imageArg) {
203
+ return fail("usage: oalo design inspire <image_path> [--session <id>] [--label <name>] [--model <preset>] [--json]", 2, flags);
204
+ }
205
+
206
+ const filePath = resolvePath(imageArg);
207
+ if (!existsSync(filePath)) {
208
+ return fail(`image file not found: ${filePath}`, 2, flags);
209
+ }
210
+
211
+ const modelPreset = validateModel(flags.model, flags);
212
+ if (modelPreset === false) return;
213
+
214
+ const sessionId = await resolveSessionId(ch, flags.session);
215
+ if (!sessionId) {
216
+ return fail('No Design Studio session found. Create one first with: oalo design "<prompt>"', 1, flags);
217
+ }
218
+
219
+ const mime = mimeForPath(filePath);
220
+ const b64 = readFileSync(filePath).toString("base64");
221
+ const dataUrl = `data:${mime};base64,${b64}`;
222
+ const label = typeof flags.label === "string" && flags.label.trim() ? flags.label.trim() : basename(filePath);
223
+
224
+ const res = await ch.call("design:inspiration:add", {
225
+ session_id: sessionId,
226
+ label,
227
+ data_url: dataUrl,
228
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
229
+ });
230
+
231
+ if (flags.json) {
232
+ console.log(JSON.stringify(res, null, 2));
233
+ return;
234
+ }
235
+
236
+ const ins = res.inspiration || {};
237
+ console.log(`Uploaded inspiration "${ins.label || label}" to session ${sessionId} (${ins.id || "ok"}):`);
238
+ if (ins.analysis && Object.keys(ins.analysis).length) {
239
+ const a = ins.analysis;
240
+ if (a.mood || a.aesthetic) console.log(` mood: ${a.mood || a.aesthetic}`);
241
+ if (Array.isArray(a.palette) && a.palette.length) console.log(` palette: ${a.palette.join(", ")}`);
242
+ if (a.typography) console.log(` typography: ${typeof a.typography === "string" ? a.typography : JSON.stringify(a.typography)}`);
243
+ }
244
+ }
245
+
246
+ async function runIterate(ch, baseUrl, trailingArgs, flags, openFn) {
247
+ const artboardId = trailingArgs[0];
248
+ const instruction = trailingArgs.slice(1).join(" ").trim();
249
+ if (!artboardId || !instruction) {
250
+ return fail('usage: oalo design iterate <artboard_id> "<instruction>" [--session <id>] [--model <preset>] [--open] [--json]', 2, flags);
251
+ }
252
+
253
+ const modelPreset = validateModel(flags.model, flags);
254
+ if (modelPreset === false) return;
255
+
256
+ const sessionId = await resolveSessionForArtboard(ch, artboardId, flags.session);
257
+ if (!sessionId) {
258
+ return fail(`Could not find session for artboard ${artboardId}. Pass --session <session_id>.`, 1, flags);
259
+ }
260
+
261
+ const res = await ch.call("design:iterate", {
262
+ session_id: sessionId,
263
+ artboard_id: artboardId,
264
+ instruction,
265
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
266
+ ...(flags.archetype ? { archetype: String(flags.archetype).trim() } : {}),
267
+ });
268
+
269
+ const canvasUrl = buildCanvasUrl(baseUrl, sessionId);
270
+ if (flags.open && !flags.json) openFn(canvasUrl);
271
+
272
+ if (flags.json) {
273
+ console.log(JSON.stringify({ session_id: sessionId, url: canvasUrl, ...res }, null, 2));
274
+ return;
275
+ }
276
+
277
+ const created = res.artboards || [];
278
+ console.log(`Refining ${artboardId} in session ${sessionId}:`);
279
+ for (const a of created) console.log(` -> ${a.id} (${a.status || "queued"})`);
280
+ console.log(dim(`Watch live in canvas: ${canvasUrl}`));
281
+ }
282
+
283
+ async function runFork(ch, baseUrl, trailingArgs, flags, openFn) {
284
+ const artboardId = trailingArgs[0];
285
+ const instruction = trailingArgs.slice(1).join(" ").trim();
286
+ if (!artboardId) {
287
+ return fail('usage: oalo design fork <artboard_id> ["<instruction>"] [--count 3] [--session <id>] [--model <preset>] [--open] [--json]', 2, flags);
288
+ }
289
+
290
+ const modelPreset = validateModel(flags.model, flags);
291
+ if (modelPreset === false) return;
292
+
293
+ const count = flags.count ? Math.max(1, Math.min(4, Number(flags.count) || 3)) : 3;
294
+ const sessionId = await resolveSessionForArtboard(ch, artboardId, flags.session);
295
+ if (!sessionId) {
296
+ return fail(`Could not find session for artboard ${artboardId}. Pass --session <session_id>.`, 1, flags);
297
+ }
298
+
299
+ const res = await ch.call("design:fork", {
300
+ session_id: sessionId,
301
+ artboard_id: artboardId,
302
+ count,
303
+ ...(instruction ? { instruction } : {}),
304
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
305
+ ...(flags.archetype ? { archetype: String(flags.archetype).trim() } : {}),
306
+ });
307
+
308
+ const canvasUrl = buildCanvasUrl(baseUrl, sessionId);
309
+ if (flags.open && !flags.json) openFn(canvasUrl);
310
+
311
+ if (flags.json) {
312
+ console.log(JSON.stringify({ session_id: sessionId, url: canvasUrl, ...res }, null, 2));
313
+ return;
314
+ }
315
+
316
+ const created = res.artboards || [];
317
+ console.log(`Forked ${created.length} child variation(s) from ${artboardId}:`);
318
+ for (const a of created) console.log(` -> ${a.id} [${a.lens || "-"}] (${a.status || "queued"})`);
319
+ console.log(dim(`Watch live in canvas: ${canvasUrl}`));
320
+ }
321
+
322
+ async function runCrossbreed(ch, baseUrl, trailingArgs, flags, openFn) {
323
+ const parentA = trailingArgs[0];
324
+ const parentB = trailingArgs[1];
325
+ const instruction = trailingArgs.slice(2).join(" ").trim();
326
+ if (!parentA || !parentB) {
327
+ return fail('usage: oalo design crossbreed <artboard_a> <artboard_b> ["<instruction>"] [--session <id>] [--model <preset>] [--open] [--json]', 2, flags);
328
+ }
329
+
330
+ const modelPreset = validateModel(flags.model, flags);
331
+ if (modelPreset === false) return;
332
+
333
+ const sessionId = await resolveSessionForArtboard(ch, parentA, flags.session);
334
+ if (!sessionId) {
335
+ return fail(`Could not find session for artboard ${parentA}. Pass --session <session_id>.`, 1, flags);
336
+ }
337
+
338
+ const res = await ch.call("design:crossbreed", {
339
+ session_id: sessionId,
340
+ parent_a_id: parentA,
341
+ parent_b_id: parentB,
342
+ ...(instruction ? { instruction } : {}),
343
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
344
+ ...(flags.archetype ? { archetype: String(flags.archetype).trim() } : {}),
345
+ });
346
+
347
+ const canvasUrl = buildCanvasUrl(baseUrl, sessionId);
348
+ if (flags.open && !flags.json) openFn(canvasUrl);
349
+
350
+ if (flags.json) {
351
+ console.log(JSON.stringify({ session_id: sessionId, url: canvasUrl, ...res }, null, 2));
352
+ return;
353
+ }
354
+
355
+ const child = res.artboard || {};
356
+ console.log(`Crossbreeding ${parentA} + ${parentB} -> ${child.id || "(queued)"}`);
357
+ console.log(dim(`Watch live in canvas: ${canvasUrl}`));
358
+ }
359
+
360
+ async function runNudge(ch, trailingArgs, flags) {
361
+ const artboardId = trailingArgs[0];
362
+ if (!artboardId) {
363
+ return fail("usage: oalo design nudge <artboard_id> [--hue <0..360>] [--accent-hue <0..360>] [--warmth <-1..1>] [--mode light|dark] [--font <pairing_id>] [--radius sharp|sm|md|lg|pill] [--density airy|balanced|compact] [--json]", 2, flags);
364
+ }
365
+
366
+ const intent = {};
367
+ if (flags.hue !== undefined) intent.brand_hue = Number(flags.hue);
368
+ if (flags["accent-hue"] !== undefined) intent.accent_hue = Number(flags["accent-hue"]);
369
+ if (flags.warmth !== undefined) intent.warmth = Number(flags.warmth);
370
+ if (flags.chroma !== undefined) intent.chroma = Number(flags.chroma);
371
+ if (flags.mode !== undefined) {
372
+ const m = String(flags.mode).trim().toLowerCase();
373
+ if (!["light", "dark"].includes(m)) return fail("--mode must be light or dark", 2, flags);
374
+ intent.mode = m;
375
+ }
376
+ if (flags.font !== undefined) intent.font_pairing_id = String(flags.font).trim();
377
+ if (flags.radius !== undefined) intent.radius = String(flags.radius).trim();
378
+ if (flags.density !== undefined) intent.density = String(flags.density).trim();
379
+ if (flags.shadow !== undefined) intent.shadow = String(flags.shadow).trim();
380
+
381
+ if (Object.keys(intent).length === 0) {
382
+ return fail("pass at least one token flag: --hue, --accent-hue, --warmth, --mode, --font, --radius, --density, or --shadow", 2, flags);
383
+ }
384
+
385
+ const res = await ch.call("design:artboard:nudge", { artboard_id: artboardId, intent });
386
+ if (flags.json) {
387
+ console.log(JSON.stringify(res, null, 2));
388
+ return;
389
+ }
390
+
391
+ const a = res.artboard || {};
392
+ const c = a.tokens?.colors || {};
393
+ const t = a.tokens?.typography || {};
394
+ console.log(`Nudged artboard ${a.id || artboardId} (${a.title || ""}):`);
395
+ console.log(` palette: bg ${c.bg || "-"} | surface ${c.surface || "-"} | text ${c.text || "-"} | accent ${c.accent || "-"}`);
396
+ console.log(` fonts: ${t.pairing_name || `${t.display_font || "-"} + ${t.body_font || "-"}`}`);
397
+ }
398
+
399
+ async function runCritique(ch, trailingArgs, flags) {
400
+ const artboardId = trailingArgs[0];
401
+ if (!artboardId) {
402
+ return fail("usage: oalo design critique <artboard_id> [--model <preset>] [--json]", 2, flags);
403
+ }
404
+
405
+ const modelPreset = validateModel(flags.model, flags);
406
+ if (modelPreset === false) return;
407
+
408
+ const res = await ch.call("design:artboard:critique", {
409
+ artboard_id: artboardId,
410
+ ...(modelPreset ? { model_preset: modelPreset } : {}),
411
+ });
412
+
413
+ if (flags.json) {
414
+ console.log(JSON.stringify(res, null, 2));
415
+ return;
416
+ }
417
+
418
+ const q = res.critique || {};
419
+ console.log(`QA Critic for ${artboardId}: ${q.score ?? "-"}/100 (${q.verdict || "reviewed"})`);
420
+ for (const chk of q.checks || []) {
421
+ console.log(` [${chk.passed ? "OK" : "FIX"}] ${chk.label}`);
422
+ }
423
+ if (q.issues?.length) {
424
+ console.log("\nIssues:");
425
+ for (const iss of q.issues) {
426
+ console.log(` [${String(iss.severity || "medium").toUpperCase()}] (${iss.area}) ${iss.summary}`);
427
+ }
428
+ }
429
+ if (q.suggested_prompt) {
430
+ console.log(`\nSuggested polish pass:\n oalo design iterate ${artboardId} ${JSON.stringify(q.suggested_prompt)}`);
431
+ }
432
+ }
433
+
434
+ async function runLock(ch, trailingArgs, flags) {
435
+ const artboardId = trailingArgs[0];
436
+ if (!artboardId) {
437
+ return fail('usage: oalo design lock <artboard_id> [--name "<name>"] [--pull] [--dir <path>] [--agents-md] [--json]', 2, flags);
438
+ }
439
+
440
+ const name = typeof flags.name === "string" && flags.name.trim() ? flags.name.trim() : undefined;
441
+ const res = await ch.call("design:lock", {
442
+ artboard_id: artboardId,
443
+ ...(name ? { name } : {}),
444
+ });
445
+ const sys = res.design_system;
446
+
447
+ let localFiles = [];
448
+ if (flags.pull && sys) {
449
+ const rootDir = resolvePath(typeof flags.dir === "string" && flags.dir.trim() ? flags.dir.trim() : ".");
450
+ localFiles = writeLocalDesignFiles(rootDir, sys, {
451
+ writeRules: !flags["no-rules"],
452
+ writeAgentsMd: Boolean(flags["agents-md"]),
453
+ });
454
+ }
455
+
456
+ if (flags.json) {
457
+ console.log(JSON.stringify({ design_system: sys, local_files: localFiles }, null, 2));
458
+ return;
459
+ }
460
+
461
+ console.log(`Locked Design Language "${sys?.name || artboardId}" (${sys?.id || "ok"}).`);
462
+ if (localFiles.length) {
463
+ console.log("Synced locally:");
464
+ for (const f of localFiles) console.log(` ${f}`);
465
+ } else {
466
+ console.log(dim("Pull into any local repo for coding agents: oalo design pull"));
467
+ console.log(dim("Optionally adopt in emails/widgets/chat: oalo design apply --email on --widgets on"));
468
+ }
469
+ }
470
+
471
+ async function runShow(ch, flags) {
472
+ const res = await ch.call("design:system:get", {});
473
+ const sys = res.design_system;
474
+ const adoption = res.adoption || null;
475
+
476
+ if (!sys) {
477
+ if (flags.json) {
478
+ console.log(JSON.stringify({ design_system: null, adoption }, null, 2));
479
+ return;
480
+ }
481
+ console.log("No Design Language locked yet. Run `oalo design` to create and lock one in Design Studio.");
482
+ return;
483
+ }
484
+
485
+ const format = String(flags.format || "summary").toLowerCase();
486
+ if (flags.json || format === "json") {
487
+ console.log(JSON.stringify({ design_system: sys, adoption }, null, 2));
488
+ return;
489
+ }
490
+ if (format === "md") {
491
+ console.log(sys.design_md || "");
492
+ return;
493
+ }
494
+ if (format === "css") {
495
+ console.log(sys.theme_css || "");
496
+ return;
497
+ }
498
+ if (format === "dart") {
499
+ console.log(sys.flutter_theme_dart || "");
500
+ return;
501
+ }
502
+
503
+ const c = sys.tokens?.colors || {};
504
+ const t = sys.tokens?.typography || {};
505
+ console.log(`Active Design Language: ${sys.name} (${sys.id})`);
506
+ console.log(` palette: bg ${c.bg || "-"} | surface ${c.surface || "-"} | text ${c.text || "-"} | accent ${c.accent || "-"}`);
507
+ console.log(` typography: ${t.pairing_name || `${t.display_font || ""} + ${t.body_font || ""}`}`);
508
+ if (adoption) {
509
+ const adoptedBots = (adoption.bots || []).filter((b) => b.adopted).map((b) => b.name);
510
+ console.log(` surfaces: emails=${adoption.email ? "adopted" : "off"}, widgets=${adoption.widgets ? "adopted" : "off"}, chat=${adoptedBots.length ? adoptedBots.join(", ") : "none"}`);
511
+ }
512
+ console.log(dim("Pull into this repo for coding agents: oalo design pull"));
513
+ }
514
+
515
+ async function runPull(ch, flags) {
516
+ const res = await ch.call("design:system:get", {});
517
+ const sys = res.design_system;
518
+ if (!sys) {
519
+ return fail("No Design Language is locked in this workspace yet. Lock one in Oalo Design Studio (`oalo design`) first.", 1, flags);
520
+ }
521
+
522
+ const rootDir = resolvePath(typeof flags.dir === "string" && flags.dir.trim() ? flags.dir.trim() : ".");
523
+ const written = writeLocalDesignFiles(rootDir, sys, {
524
+ writeRules: !flags["no-rules"],
525
+ writeAgentsMd: Boolean(flags["agents-md"]),
526
+ });
527
+
528
+ if (flags.json) {
529
+ console.log(JSON.stringify({ design_system: { id: sys.id, name: sys.name }, files: written }, null, 2));
530
+ return;
531
+ }
532
+
533
+ console.log(`Pulled Design Language "${sys.name}" (${sys.id}):`);
534
+ for (const f of written) console.log(` ${f}`);
535
+ console.log(dim("Coding agents in this folder (Claude Code, Codex, Cursor, OpenCode, `oalo build`) will now follow this Design Language."));
536
+ }
537
+
538
+ async function runApply(ch, flags) {
539
+ const targets = {};
540
+ if (flags.email !== undefined) {
541
+ const v = parseBool(flags.email);
542
+ if (v === null) return fail("--email must be on or off", 2, flags);
543
+ targets.email = v;
544
+ }
545
+ if (flags.widgets !== undefined) {
546
+ const v = parseBool(flags.widgets);
547
+ if (v === null) return fail("--widgets must be on or off", 2, flags);
548
+ targets.widgets = v;
549
+ }
550
+ if (flags.chat !== undefined) {
551
+ const raw = String(flags.chat).trim();
552
+ if (raw === "all" || raw === "true" || raw === "on") {
553
+ targets.chat = true;
554
+ } else {
555
+ const ids = parseIdList(raw);
556
+ if (!ids.length) return fail("--chat must be 'all' or a comma-separated list of bot ids", 2, flags);
557
+ targets.chat_bot_ids = ids;
558
+ }
559
+ }
560
+ if (flags["detach-chat"] !== undefined) {
561
+ const ids = parseIdList(String(flags["detach-chat"]));
562
+ if (!ids.length) return fail("--detach-chat must be a comma-separated list of bot ids", 2, flags);
563
+ targets.detach_chat_bot_ids = ids;
564
+ }
565
+
566
+ if (Object.keys(targets).length === 0) {
567
+ return fail("pass at least one surface flag: --email on|off, --widgets on|off, --chat all|<bot_ids>, or --detach-chat <bot_ids>", 2, flags);
568
+ }
569
+
570
+ const res = await ch.call("design:system:apply", targets);
571
+ if (flags.json) {
572
+ console.log(JSON.stringify(res, null, 2));
573
+ return;
574
+ }
575
+
576
+ const a = res.adoption || {};
577
+ const adoptedBots = (a.bots || []).filter((b) => b.adopted).map((b) => `${b.name} (#${b.id})`);
578
+ console.log("Updated Design Language surface adoption:");
579
+ console.log(` emails: ${a.email ? "adopted" : "off"}`);
580
+ console.log(` widgets: ${a.widgets ? "adopted" : "off"}`);
581
+ console.log(` chat: ${adoptedBots.length ? adoptedBots.join(", ") : "none"}`);
582
+ }
583
+
584
+ async function resolveSessionId(ch, explicitId) {
585
+ if (typeof explicitId === "string" && explicitId.trim()) return explicitId.trim();
586
+ const listed = await ch.call("design:sessions:list", { limit: 1 });
587
+ return listed.sessions?.[0]?.id || null;
588
+ }
589
+
590
+ async function resolveSessionForArtboard(ch, artboardId, explicitSessionId) {
591
+ if (typeof explicitSessionId === "string" && explicitSessionId.trim()) return explicitSessionId.trim();
592
+ const listed = await ch.call("design:sessions:list", { limit: 10 });
593
+ for (const s of listed.sessions || []) {
594
+ try {
595
+ const detail = await ch.call("design:sessions:get", { id: s.id });
596
+ if ((detail.session?.artboards || []).some((a) => a.id === artboardId)) {
597
+ return s.id;
598
+ }
599
+ } catch {
600
+ /* skip unreadable session */
601
+ }
602
+ }
603
+ return null;
604
+ }
605
+
606
+ function buildCanvasUrl(baseUrl, sessionId) {
607
+ const cleanBase = baseUrl.replace(/\/$/, "");
608
+ return sessionId
609
+ ? `${cleanBase}/?panel=design&session=${encodeURIComponent(sessionId)}`
610
+ : `${cleanBase}/?panel=design`;
611
+ }
612
+
613
+ function validateModel(raw, flags) {
614
+ if (raw === undefined) return undefined;
615
+ const preset = String(raw).trim();
616
+ if (!VALID_MODELS.includes(preset)) {
617
+ fail(`--model must be one of ${VALID_MODELS.join(", ")} (got ${preset})`, 2, flags);
618
+ return false;
619
+ }
620
+ return preset;
621
+ }
622
+
623
+ function mimeForPath(filePath) {
624
+ switch (extname(filePath).toLowerCase()) {
625
+ case ".jpg":
626
+ case ".jpeg":
627
+ return "image/jpeg";
628
+ case ".webp":
629
+ return "image/webp";
630
+ case ".gif":
631
+ return "image/gif";
632
+ default:
633
+ return "image/png";
634
+ }
635
+ }
636
+
637
+ export function writeLocalDesignFiles(rootDir, sys, opts = {}) {
638
+ const designDir = join(rootDir, ".oalo", "design");
639
+ mkdirSync(designDir, { recursive: true });
640
+
641
+ const dtcg = {
642
+ $schema: "https://tr.designtokens.org/format/",
643
+ name: sys.name || "Brand Design System",
644
+ color: Object.fromEntries(
645
+ Object.entries(sys.tokens?.colors || {}).map(([k, v]) => [k, { $type: "color", $value: v }]),
646
+ ),
647
+ typography: sys.tokens?.typography || {},
648
+ radius: sys.tokens?.radius || {},
649
+ density: sys.tokens?.density || {},
650
+ shadows: sys.tokens?.shadows || {},
651
+ accessibility: sys.tokens?.accessibility || {},
652
+ };
653
+
654
+ const files = [
655
+ [join(designDir, "DESIGN.md"), sys.design_md || ""],
656
+ [join(designDir, "design-tokens.json"), JSON.stringify(dtcg, null, 2) + "\n"],
657
+ [join(designDir, "theme.css"), sys.theme_css || ""],
658
+ [join(designDir, "theme.dart"), sys.flutter_theme_dart || ""],
659
+ ];
660
+
661
+ const written = [];
662
+ for (const [path, content] of files) {
663
+ writeFileSync(path, content, "utf8");
664
+ written.push(path);
665
+ }
666
+
667
+ if (opts.writeRules !== false) {
668
+ const claudePath = join(rootDir, "CLAUDE.md");
669
+ upsertBoundedBlock(claudePath, sys.design_md || "");
670
+ written.push(claudePath);
671
+
672
+ const agentsPath = join(rootDir, "AGENTS.md");
673
+ if (opts.writeAgentsMd || existsSync(agentsPath)) {
674
+ upsertBoundedBlock(agentsPath, sys.design_md || "");
675
+ written.push(agentsPath);
676
+ }
677
+ }
678
+
679
+ return written;
680
+ }
681
+
682
+ export function upsertBoundedBlock(filePath, designMd) {
683
+ const block = [
684
+ CLAUDE_START,
685
+ "## Locked Brand Design System (Oalo Design Studio)",
686
+ "Follow these exact tokens and craft rules in every web app, Flutter app, widget, and email you build in this repo (full tokens in `.oalo/design/theme.css` and `.oalo/design/theme.dart`):",
687
+ "",
688
+ designMd.trim(),
689
+ CLAUDE_END,
690
+ ].join("\n");
691
+
692
+ const existing = existsSync(filePath) ? readFileSync(filePath, "utf8") : "";
693
+ let next;
694
+ if (existing.includes(CLAUDE_START) && existing.includes(CLAUDE_END)) {
695
+ const re = new RegExp(`${escapeRe(CLAUDE_START)}[\\s\\S]*?${escapeRe(CLAUDE_END)}`);
696
+ next = existing.replace(re, block);
697
+ } else if (existing.trim()) {
698
+ next = `${existing.trimEnd()}\n\n${block}\n`;
699
+ } else {
700
+ next = `${block}\n`;
701
+ }
702
+ writeFileSync(filePath, next, "utf8");
703
+ }
704
+
705
+ function escapeRe(s) {
706
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
707
+ }
708
+
709
+ function parseBool(v) {
710
+ if (v === true) return true;
711
+ if (v === false) return false;
712
+ const s = String(v).trim().toLowerCase();
713
+ if (["on", "true", "yes", "1"].includes(s)) return true;
714
+ if (["off", "false", "no", "0"].includes(s)) return false;
715
+ return null;
716
+ }
717
+
718
+ function parseIdList(raw) {
719
+ return raw
720
+ .split(",")
721
+ .map((s) => s.trim())
722
+ .filter(Boolean)
723
+ .map((s) => (/^\d+$/.test(s) ? Number(s) : s));
724
+ }
725
+
726
+ function openBrowser(url) {
727
+ const [cmd, args] =
728
+ process.platform === "darwin"
729
+ ? ["open", [url]]
730
+ : process.platform === "win32"
731
+ ? ["cmd", ["/c", "start", "", url]]
732
+ : ["xdg-open", [url]];
733
+ try {
734
+ const child = spawn(cmd, args, { stdio: "ignore", detached: true });
735
+ child.on("error", () => {});
736
+ child.unref();
737
+ } catch {
738
+ /* headless shell; URL is already printed */
739
+ }
740
+ }
741
+
742
+ function fail(msg, code, flags) {
743
+ if (flags?.json) console.log(JSON.stringify({ error: msg }));
744
+ else console.error(msg);
745
+ process.exitCode = code;
746
+ }
@@ -1,25 +1,25 @@
1
1
  {
2
- "version": "0.9.1",
2
+ "version": "0.10.1",
3
3
  "targets": {
4
4
  "darwin-arm64": {
5
5
  "file": "oalo-coord-darwin-arm64.gz",
6
- "sha256": "c7221f4c21ea649c018e6df4a03b3fedab79f83efc5cad2b625533a847f4084b",
7
- "bytes": 24877357
6
+ "sha256": "c119af7acdf2584adb8f3512174f5160e14fd785b42d719cd4178cea77a86dcc",
7
+ "bytes": 24879534
8
8
  },
9
9
  "darwin-x64": {
10
10
  "file": "oalo-coord-darwin-x64.gz",
11
- "sha256": "162190e941cca9cdea1375513442f8dc65401d38a68025599efec90a0c470ea9",
12
- "bytes": 27015849
11
+ "sha256": "35ebb0a882bc92ed14a73b61097c76fb0f53308d8e85eed42a408f6a84768440",
12
+ "bytes": 27017383
13
13
  },
14
14
  "linux-x64": {
15
15
  "file": "oalo-coord-linux-x64.gz",
16
- "sha256": "d70d6b7fbd1a21ee401e867bac4c89c1324c8daef7180c63603f83ae88091601",
17
- "bytes": 36908210
16
+ "sha256": "d99e4d79176a3af66c730bbe3740ffee1aa8368315eb0941bdca3455562820d9",
17
+ "bytes": 36909806
18
18
  },
19
19
  "linux-arm64": {
20
20
  "file": "oalo-coord-linux-arm64.gz",
21
- "sha256": "181b13cd8d19e9aca9a3305206b910eebd50c48609b4b440508c452169fc36cb",
22
- "bytes": 37148904
21
+ "sha256": "d05e16d33904a04f18b1314d46a31906b4f39c6fc52fc4c2f742faae5a44f0a9",
22
+ "bytes": 37150409
23
23
  }
24
24
  }
25
25
  }
package/src/help.js CHANGED
@@ -19,7 +19,7 @@ export const TOKENS = [
19
19
  kind: "cli",
20
20
  where: "`oalo login`, or dashboard -> Account -> CLI & agents",
21
21
  plane: "control (the build surface)",
22
- usedBy: ["whoami", "tail", "call", "run", "emit", "data", "db", "metrics", "dashboards", "usage", "inbox", "crm", "products", "channels", "incidents", "tokens", "docs", "apps", "setup", "build", "migrate", "dockerfile", "deploy", "env", "logs", "secrets", "loops", "flows", "pull", "status", "lint", "push", "qa", "rehearse", "bots", "sources", "machines", "mcp"],
22
+ usedBy: ["whoami", "tail", "call", "run", "emit", "data", "db", "metrics", "dashboards", "usage", "inbox", "crm", "products", "channels", "incidents", "tokens", "docs", "apps", "setup", "build", "migrate", "dockerfile", "deploy", "env", "logs", "secrets", "loops", "flows", "pull", "status", "lint", "push", "qa", "rehearse", "bots", "sources", "machines", "design", "mcp"],
23
23
  warning: "Acts as you, with exactly your permissions. No read-only mode. Treat it like a password.",
24
24
  },
25
25
  ];
@@ -1379,6 +1379,60 @@ export const COMMANDS = [
1379
1379
  ],
1380
1380
  exits: { 0: "all stages passed", 1: "a stage failed or stopped for human action", 2: "bad arguments" },
1381
1381
  },
1382
+ {
1383
+ name: "design",
1384
+ summary: "Open Oalo Design Studio, iterate on artboards from the CLI, pull the locked Design Language for coding agents, or adopt it in emails, widgets, and chatbots.",
1385
+ usage: [
1386
+ 'oalo design [open|new] ["<prompt>"] [--model gemini_pro|gemini_fast|gemini_claude_mix|claude] [--archetype <id>] [--no-browser] [--json]',
1387
+ "oalo design sessions [--limit <n>] [--json]",
1388
+ "oalo design inspect [<session_id>] [--json]",
1389
+ 'oalo design inspire <image_path> [--session <id>] [--label "<name>"] [--model <preset>] [--json]',
1390
+ 'oalo design iterate <artboard_id> "<instruction>" [--session <id>] [--model <preset>] [--open] [--json]',
1391
+ 'oalo design fork <artboard_id> ["<instruction>"] [--count 3] [--session <id>] [--model <preset>] [--open] [--json]',
1392
+ 'oalo design crossbreed <artboard_a> <artboard_b> ["<instruction>"] [--session <id>] [--model <preset>] [--open] [--json]',
1393
+ "oalo design nudge <artboard_id> [--hue <0..360>] [--accent-hue <0..360>] [--warmth <-1..1>] [--mode light|dark] [--font <pairing_id>] [--radius sharp|sm|md|lg|pill] [--density airy|balanced|compact] [--json]",
1394
+ "oalo design critique <artboard_id> [--model <preset>] [--json]",
1395
+ 'oalo design lock <artboard_id> [--name "<name>"] [--pull] [--dir <path>] [--agents-md] [--json]',
1396
+ "oalo design show [--format summary|md|css|dart|json] [--json]",
1397
+ "oalo design pull [--dir <path>] [--agents-md] [--no-rules] [--json]",
1398
+ "oalo design apply [--email on|off] [--widgets on|off] [--chat all|<bot_ids>] [--detach-chat <bot_ids>] [--json]",
1399
+ ],
1400
+ flags: [
1401
+ { flag: "--model <preset>", desc: "Model preset (gemini_pro default, gemini_fast, gemini_claude_mix, claude)." },
1402
+ { flag: "--archetype <id>", desc: "Screen archetype (auto, local_booking, saas_dashboard, consumer_mobile, editorial_landing, commerce_storefront)." },
1403
+ { flag: "--session <id>", desc: "Target session id (auto-resolved from the artboard or latest session when omitted)." },
1404
+ { flag: "--count <1..4>", desc: "fork: number of child variations to generate (default 3)." },
1405
+ { flag: "--label <name>", desc: "inspire: optional label for the uploaded inspiration screenshot." },
1406
+ { flag: "--hue <0..360>", desc: "nudge: deterministic brand hue angle in OKLCH." },
1407
+ { flag: "--accent-hue <0..360>", desc: "nudge: secondary accent hue angle." },
1408
+ { flag: "--warmth <-1..1>", desc: "nudge: neutral surface warmth (-1 cool slate to +1 warm cream)." },
1409
+ { flag: "--mode light|dark", desc: "nudge: switch between light and dark surface polarity." },
1410
+ { flag: "--font <pairing_id>", desc: "nudge: curated Google Font pairing id (e.g. fraunces-jakarta, space-ibm)." },
1411
+ { flag: "--radius <scale>", desc: "nudge: corner radius scale (sharp, sm, md, lg, pill)." },
1412
+ { flag: "--density <scale>", desc: "nudge: layout spacing density (airy, balanced, compact)." },
1413
+ { flag: "--name <name>", desc: "lock: custom name for the locked Design Language." },
1414
+ { flag: "--pull", desc: "lock: immediately write .oalo/design/* and update CLAUDE.md locally after locking." },
1415
+ { flag: "--open", desc: "iterate/fork/crossbreed: open the live Design Studio canvas URL in your browser." },
1416
+ { flag: "--no-browser", desc: "open/new: print the Design Studio canvas URL without launching a browser." },
1417
+ { flag: "--no-generate", desc: "open/new: create the session without immediately starting 4-way generation." },
1418
+ { flag: "--format <fmt>", desc: "show: summary, md, css, dart, or json." },
1419
+ { flag: "--dir <path>", desc: "pull/lock --pull: target project directory (default current directory)." },
1420
+ { flag: "--agents-md", desc: "pull/lock --pull: also write/update the bounded Design System section in AGENTS.md." },
1421
+ { flag: "--no-rules", desc: "pull/lock --pull: write .oalo/design/* files only, without editing CLAUDE.md/AGENTS.md." },
1422
+ { flag: "--email on|off", desc: "apply: opt-in or opt-out email template styling." },
1423
+ { flag: "--widgets on|off", desc: "apply: opt-in or opt-out hosted /w/* and AI widget styling." },
1424
+ { flag: "--chat all|<ids>", desc: "apply: apply Design Language style to all or specific chatbot ids." },
1425
+ { flag: "--detach-chat <ids>", desc: "apply: detach Design Language metadata from specific chatbot ids." },
1426
+ { flag: "--json", desc: "Print structured JSON." },
1427
+ ],
1428
+ notes: [
1429
+ "`oalo design \"<prompt>\"` creates a session, starts 4-way live streaming generation, and opens the Design Studio infinite canvas in your browser.",
1430
+ "Every terminal iteration command (iterate, fork, crossbreed, nudge, inspire) streams straight into the open web canvas in real time.",
1431
+ "`oalo design pull` (or `oalo design lock <artboard_id> --pull`) writes .oalo/design/{DESIGN.md,design-tokens.json,theme.css,theme.dart} and updates CLAUDE.md so local coding agents (Claude Code, Codex, Cursor, OpenCode, `oalo build`) use your locked Design Language in new builds.",
1432
+ "External agents connected via `oalo mcp` can also call the `get_design_system` MCP tool directly.",
1433
+ ],
1434
+ exits: { 0: "ok", 1: "no active design system, artboard not found, or server error", 2: "not connected or invalid arguments" },
1435
+ },
1382
1436
  ];
1383
1437
 
1384
1438
  /**
package/src/index.js CHANGED
@@ -49,6 +49,7 @@ import { race } from "./commands/race.js";
49
49
  import { review } from "./commands/review.js";
50
50
  import { swarm } from "./commands/swarm.js";
51
51
  import { auto } from "./commands/auto.js";
52
+ import { design } from "./commands/design.js";
52
53
  import { existsSync } from "node:fs";
53
54
  import { overview, commandHelp, helpJson, COMMANDS } from "./help.js";
54
55
  import { parse } from "./args.js";
@@ -238,6 +239,9 @@ async function dispatch(cmd) {
238
239
  case "auto":
239
240
  await auto(flags, rest);
240
241
  break;
242
+ case "design":
243
+ await design(flags, rest);
244
+ break;
241
245
  case "db":
242
246
  await db(flags, rest);
243
247
  break;