@1agh/maude 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/apps/studio/actions/agents.ts +18 -42
  2. package/apps/studio/actions/verbs.ts +49 -0
  3. package/apps/studio/actions.manifest.json +103 -19
  4. package/apps/studio/ai/create-claim.ts +1 -1
  5. package/apps/studio/bin/_asset-file.mjs +117 -0
  6. package/apps/studio/bin/_canvas-file.mjs +146 -0
  7. package/apps/studio/bin/_footage.mjs +123 -0
  8. package/apps/studio/bin/_pdf-playwright.mjs +14 -0
  9. package/apps/studio/bin/_png-playwright.mjs +15 -1
  10. package/apps/studio/bin/_pw-launch.mjs +98 -0
  11. package/apps/studio/bin/_retry-save.mjs +49 -0
  12. package/apps/studio/bin/_sync.mjs +145 -2
  13. package/apps/studio/bin/asset-rename.sh +12 -0
  14. package/apps/studio/bin/asset-trash.sh +12 -0
  15. package/apps/studio/bin/canvas-move.sh +12 -0
  16. package/apps/studio/bin/canvas-new.sh +12 -0
  17. package/apps/studio/bin/footage.sh +12 -0
  18. package/apps/studio/bin/generate.sh +7 -0
  19. package/apps/studio/bin/retry-save.sh +13 -0
  20. package/apps/studio/bridge/canvas-mode-store.ts +11 -2
  21. package/apps/studio/bridge/dgn-protocol.ts +8 -3
  22. package/apps/studio/bridge/occlusion.ts +45 -0
  23. package/apps/studio/canvas-theme-pill.tsx +182 -38
  24. package/apps/studio/client/export-center.jsx +32 -3
  25. package/apps/studio/client/home/HomeAccountBanner.jsx +61 -0
  26. package/apps/studio/client/home/HomeAccountsChip.jsx +404 -0
  27. package/apps/studio/client/home/HomeConnection.jsx +4 -3
  28. package/apps/studio/client/home/ProjectRows.jsx +514 -0
  29. package/apps/studio/client/home/home-accounts-model.js +148 -99
  30. package/apps/studio/client/home/home-api.js +4 -0
  31. package/apps/studio/client/home/home-app.jsx +127 -432
  32. package/apps/studio/client/home/home-icons.jsx +8 -0
  33. package/apps/studio/client/home/home-model.js +109 -0
  34. package/apps/studio/client/home/home.css +447 -111
  35. package/apps/studio/client/home/use-account-fix.js +123 -0
  36. package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
  37. package/apps/studio/client/v2/export/done-toast.jsx +2 -5
  38. package/apps/studio/client/v2/export/export-sheet.jsx +9 -2
  39. package/apps/studio/client/v2/export/export.css +9 -0
  40. package/apps/studio/client/v2/export/exports-model.js +16 -3
  41. package/apps/studio/client/v2/export/file-rows.jsx +81 -5
  42. package/apps/studio/client/v2/export/native-save.js +33 -0
  43. package/apps/studio/client/v2/export/sections/print-copy.js +3 -0
  44. package/apps/studio/client/v2/export/sections/print.jsx +37 -20
  45. package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
  46. package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
  47. package/apps/studio/collab/room.ts +21 -7
  48. package/apps/studio/dist/client.bundle.js +692 -692
  49. package/apps/studio/dist/comment-mount.js +2 -2
  50. package/apps/studio/dist/styles.css +1 -1
  51. package/apps/studio/exporters/ghostscript.ts +78 -1
  52. package/apps/studio/exporters/pdf-fonts.ts +31 -4
  53. package/apps/studio/generation/jobs.ts +6 -0
  54. package/apps/studio/http.ts +6 -2
  55. package/apps/studio/routes/agent.ts +6 -2
  56. package/apps/studio/routes/project-undo.ts +10 -0
  57. package/apps/studio/server.ts +25 -0
  58. package/apps/studio/shell/cli-yield.ts +48 -11
  59. package/apps/studio/whats-new.json +18 -0
  60. package/cli/commands/design.mjs +74 -16
  61. package/cli/lib/bash-guard.mjs +4 -4
  62. package/cli/lib/confine-read.mjs +2 -0
  63. package/cli/lib/design-help.gen.mjs +15 -2
  64. package/cli/lib/design-hook.mjs +1 -1
  65. package/cli/lib/desktop-locate.mjs +36 -8
  66. package/cli/lib/studio-locate.mjs +8 -2
  67. package/cli/lib/sub-verbs.mjs +13 -1
  68. package/package.json +8 -8
  69. package/plugins/flow/.claude-plugin/config.schema.json +11 -1
  70. package/apps/studio/client/home/HomeAccounts.jsx +0 -262
  71. package/apps/studio/client/home/HomeAccountsRow.jsx +0 -221
@@ -0,0 +1,404 @@
1
+ // client/home/HomeAccountsChip.jsx — 2.1.2 HB1 (canvas 17, artboards 15, 17, 18): accounts leave Home's
2
+ // main surface. One chip at the top right — "3 accounts", plus a dot and "1 needs sign-in" while a
3
+ // sign-in is missing or stopped working — opens "Accounts on this Mac": one line per account (its
4
+ // e-mail or host, where it is, how many projects, its state only when it isn't fine), the fix on the
5
+ // line that broke (Sign in / Sign in again, `useAccountFix`), Sign out… and GitHub in its "…", the old
6
+ // servers folded at the foot (no answer, no project) with Forget… per server and Forget all, each
7
+ // behind a question, and Add an account…. Forget only removes the saved sign-in (POST
8
+ // /_home/hub/signout), on the person's click — never on its own.
9
+ // Replaces the 2.0.5 face card (HomeAccounts.jsx) and the 2.1.1 accounts row (HomeAccountsRow.jsx).
10
+
11
+ import { useCallback, useEffect, useRef, useState } from 'react';
12
+
13
+ import { AcctFace, StateWord } from './HomeConnection.jsx';
14
+ import { cloudSignOut, hubSignOut, shellInvoke, shellListen } from './home-api.js';
15
+ import { forgetSpec, githubOf, slugOf } from './home-accounts-model.js';
16
+ import { HIcon } from './home-icons.jsx';
17
+ import { CONN_TONE } from './home-where-model.js';
18
+ import { WAITING_WORD } from './use-account-fix.js';
19
+ import { githubSignIn } from '../v2/onboarding/github-home.js';
20
+
21
+ const SIGNOUT_FAILED = 'Couldn’t sign out. Nothing changed — try again.';
22
+ const FORGET_FAILED = 'Couldn’t forget that server. Nothing changed — try again.';
23
+
24
+ /**
25
+ * @param {{ summary: ReturnType<typeof import('./home-accounts-model.js').homeAccountsSummary>,
26
+ * shell: object|null, native: boolean, open: boolean, onOpen: () => void,
27
+ * onClose: () => void, fixer: { busy: string|null, error: string|null,
28
+ * fix: (card: object) => unknown }, onAddCloud: () => void, onAddTeam: () => void,
29
+ * onChanged?: () => unknown }} props
30
+ */
31
+ export function HomeAccountsChip({
32
+ summary,
33
+ shell,
34
+ native,
35
+ open,
36
+ onOpen,
37
+ onClose,
38
+ fixer,
39
+ onAddCloud,
40
+ onAddTeam,
41
+ onChanged,
42
+ }) {
43
+ const [menu, setMenu] = useState(null); // the card key whose "…" is open, or 'add'
44
+ const [oldOpen, setOldOpen] = useState(false);
45
+ const [asking, setAsking] = useState(null); // { id, title, body, primary, cancel, run }
46
+ const [busy, setBusy] = useState(false);
47
+ const [error, setError] = useState(null);
48
+ const [ghCode, setGhCode] = useState(null);
49
+ const wrap = useRef(null);
50
+
51
+ const close = useCallback(() => {
52
+ setMenu(null);
53
+ setAsking(null);
54
+ setError(null);
55
+ onClose();
56
+ }, [onClose]);
57
+ useEffect(() => {
58
+ if (!open) return undefined;
59
+ const onKey = (e) => e.key === 'Escape' && close();
60
+ const onDown = (e) => wrap.current && !wrap.current.contains(e.target) && close();
61
+ window.addEventListener('keydown', onKey);
62
+ window.addEventListener('pointerdown', onDown);
63
+ return () => {
64
+ window.removeEventListener('keydown', onKey);
65
+ window.removeEventListener('pointerdown', onDown);
66
+ };
67
+ }, [open, close]);
68
+ // the GitHub device code arrives as a shell message while a sign-in from this list runs
69
+ useEffect(() => {
70
+ if (!open || !native) return undefined;
71
+ let off = () => {};
72
+ shellListen('github://device-code', (p) => setGhCode(p?.user_code ?? null)).then((u) => {
73
+ off = u;
74
+ });
75
+ return () => off();
76
+ }, [open, native]);
77
+
78
+ const { live, old } = summary;
79
+ // GitHub lives in the "…" of each profile's first line
80
+ const firstOf = new Set();
81
+ const seen = new Set();
82
+ for (const c of live)
83
+ if (!seen.has(c.profile)) {
84
+ seen.add(c.profile);
85
+ firstOf.add(c.key);
86
+ }
87
+
88
+ const runAsk = async () => {
89
+ const spec = asking;
90
+ setBusy(true);
91
+ setError(null);
92
+ const failed = await spec.run();
93
+ setBusy(false);
94
+ setAsking(null);
95
+ if (failed) setError(failed);
96
+ await onChanged?.();
97
+ };
98
+ const askSignOut = (card) => {
99
+ setMenu(null);
100
+ const s = card.signOut;
101
+ setAsking({
102
+ id: 'signout',
103
+ ...s.confirm,
104
+ run: async () => {
105
+ const r =
106
+ s.path === 'cloud-signout'
107
+ ? await cloudSignOut(s.profile)
108
+ : await hubSignOut(s.profile, s.url);
109
+ return r.ok && r.json?.ok ? null : r.json?.error || SIGNOUT_FAILED;
110
+ },
111
+ });
112
+ };
113
+ const askForget = (servers) => {
114
+ const spec = forgetSpec(servers);
115
+ setAsking({
116
+ ...spec,
117
+ run: async () => {
118
+ let failed = null;
119
+ for (const s of spec.servers) {
120
+ const r = await hubSignOut(s.profile, s.url);
121
+ if (!r.ok || !r.json?.ok) failed = r.json?.error || FORGET_FAILED;
122
+ }
123
+ return failed;
124
+ },
125
+ });
126
+ };
127
+ const ghSignIn = async (profile) => {
128
+ setMenu(null);
129
+ setError(null);
130
+ setBusy(true);
131
+ try {
132
+ await githubSignIn(profile, shellInvoke);
133
+ await onChanged?.();
134
+ } catch (e) {
135
+ setError(typeof e === 'string' ? e : 'GitHub sign-in didn’t finish. Try again.');
136
+ } finally {
137
+ setGhCode(null);
138
+ setBusy(false);
139
+ }
140
+ };
141
+
142
+ const forgettable = old.filter((c) => c.forget);
143
+ const shownError = error || fixer.error;
144
+
145
+ return (
146
+ <span className="island home-top-acct" ref={wrap}>
147
+ <button
148
+ type="button"
149
+ className="home-acchip"
150
+ data-testid="home-accounts-chip"
151
+ data-needs={summary.needs || undefined}
152
+ aria-haspopup="dialog"
153
+ aria-expanded={open}
154
+ onClick={() => (open ? close() : onOpen())}
155
+ >
156
+ <HIcon name="people" size={14} />
157
+ <span>{summary.word}</span>
158
+ {summary.needsWord ? (
159
+ <span className="home-acchip-needs" data-testid="home-accounts-chip-needs">
160
+ <i aria-hidden="true" />
161
+ {summary.needsWord}
162
+ </span>
163
+ ) : null}
164
+ <HIcon name="chevron" size={12} />
165
+ </button>
166
+ {open ? (
167
+ <div
168
+ className="home-accts"
169
+ role="dialog"
170
+ aria-label="Accounts on this Mac"
171
+ data-testid="home-accounts"
172
+ >
173
+ <p className="home-accts-h">Accounts on this Mac</p>
174
+ <ul className="home-accts-list">
175
+ {live.map((c) => {
176
+ const id = slugOf(c);
177
+ const bad = c.state === 'rejected' || c.state === 'missing';
178
+ const gh = native && firstOf.has(c.key) ? githubOf(shell, c.profile) : null;
179
+ const more = native && (c.signOut || gh);
180
+ return (
181
+ <li
182
+ key={c.key}
183
+ className={`home-acl${bad ? ' home-acl--bad' : ''}`}
184
+ data-kind={c.kind}
185
+ data-state={c.state}
186
+ data-testid={`home-account-card-${id}`}
187
+ >
188
+ <AcctFace face={c.face} state={c.state} size="md" />
189
+ <span className="home-acl-t">
190
+ <strong>{c.title}</strong>
191
+ <span>{c.sub}</span>
192
+ {c.state !== 'ok' ? (
193
+ <StateWord tone={CONN_TONE[c.state]} testid={`home-account-state-${id}`}>
194
+ {c.word}
195
+ </StateWord>
196
+ ) : null}
197
+ </span>
198
+ {c.fix ? (
199
+ <button
200
+ type="button"
201
+ className="btn btn--primary btn--sm home-acl-fix"
202
+ data-testid={`home-account-signin-${id}`}
203
+ disabled={!native || fixer.busy === c.key}
204
+ title={native ? undefined : 'Sign in from the Maude app on your Mac.'}
205
+ onClick={() => fixer.fix(c)}
206
+ >
207
+ {fixer.busy === c.key ? WAITING_WORD : c.fix.label}
208
+ </button>
209
+ ) : null}
210
+ {more ? (
211
+ <span className="home-acl-more">
212
+ <button
213
+ type="button"
214
+ className="icon-btn"
215
+ aria-label={`More for ${c.title}`}
216
+ aria-haspopup="menu"
217
+ aria-expanded={menu === c.key}
218
+ data-testid={`home-account-more-${id}`}
219
+ onClick={() => setMenu((m) => (m === c.key ? null : c.key))}
220
+ >
221
+ <HIcon name="more" size={16} />
222
+ </button>
223
+ {menu === c.key ? (
224
+ <span className="island home-acl-menu" role="menu">
225
+ {gh?.login ? (
226
+ <span
227
+ className="home-acl-menu-note"
228
+ data-testid={`home-account-github-${c.profile}`}
229
+ >
230
+ GitHub · {gh.login}
231
+ </span>
232
+ ) : null}
233
+ {gh?.signIn ? (
234
+ <button
235
+ type="button"
236
+ role="menuitem"
237
+ className="row-item"
238
+ data-testid={`home-account-github-signin-${c.profile}`}
239
+ disabled={busy}
240
+ onClick={() => ghSignIn(c.profile)}
241
+ >
242
+ Sign in with GitHub…
243
+ </button>
244
+ ) : null}
245
+ {c.signOut ? (
246
+ <button
247
+ type="button"
248
+ role="menuitem"
249
+ className="row-item"
250
+ data-testid={`home-account-signout-${id}`}
251
+ disabled={busy}
252
+ onClick={() => askSignOut(c)}
253
+ >
254
+ {c.signOut.label}
255
+ </button>
256
+ ) : null}
257
+ </span>
258
+ ) : null}
259
+ </span>
260
+ ) : null}
261
+ </li>
262
+ );
263
+ })}
264
+ </ul>
265
+ {old.length ? (
266
+ <div className="home-accts-old">
267
+ <button
268
+ type="button"
269
+ className="home-accts-oldh"
270
+ data-testid="home-accounts-old"
271
+ aria-expanded={oldOpen}
272
+ onClick={() => setOldOpen((o) => !o)}
273
+ >
274
+ <HIcon name={oldOpen ? 'chevron' : 'submenu'} size={12} />
275
+ <span>{summary.oldWord}</span>
276
+ <span className="home-accts-oldw">Not answering, no projects</span>
277
+ </button>
278
+ {oldOpen ? (
279
+ <ul className="home-accts-oldl">
280
+ {old.map((c) => {
281
+ const id = slugOf(c);
282
+ return (
283
+ <li key={c.key} data-testid={`home-accounts-old-row-${id}`}>
284
+ <HIcon name="server" size={12} />
285
+ <code>{c.forget?.host ?? c.title}</code>
286
+ {native && c.forget ? (
287
+ <button
288
+ type="button"
289
+ className="btn btn--ghost btn--sm"
290
+ data-testid={`home-accounts-old-forget-${id}`}
291
+ disabled={busy}
292
+ onClick={() => askForget([c.forget])}
293
+ >
294
+ Forget…
295
+ </button>
296
+ ) : null}
297
+ </li>
298
+ );
299
+ })}
300
+ {native && forgettable.length > 1 ? (
301
+ <li className="home-accts-oldall">
302
+ <button
303
+ type="button"
304
+ className="btn btn--ghost btn--sm"
305
+ data-testid="home-accounts-old-forget-all"
306
+ disabled={busy}
307
+ onClick={() => askForget(forgettable.map((c) => c.forget))}
308
+ >
309
+ Forget all {forgettable.length}…
310
+ </button>
311
+ </li>
312
+ ) : null}
313
+ </ul>
314
+ ) : null}
315
+ </div>
316
+ ) : null}
317
+ {ghCode ? (
318
+ <p className="home-accts-note" data-testid="home-accounts-github-code">
319
+ Enter <strong>{ghCode}</strong> on the GitHub page that opened.
320
+ </p>
321
+ ) : null}
322
+ {shownError ? (
323
+ <p className="home-accts-note" role="alert" data-testid="home-accounts-error">
324
+ {shownError}
325
+ </p>
326
+ ) : null}
327
+ {asking ? (
328
+ <div
329
+ className="home-accts-ask"
330
+ role="alertdialog"
331
+ aria-label={asking.title}
332
+ data-testid="home-accounts-confirm"
333
+ data-ask={asking.id}
334
+ >
335
+ <strong>{asking.title}</strong>
336
+ <span>{asking.body}</span>
337
+ <span className="home-accts-btns">
338
+ <button
339
+ type="button"
340
+ className="btn btn--sm"
341
+ data-testid={`home-accounts-${asking.id}-cancel`}
342
+ onClick={() => setAsking(null)}
343
+ >
344
+ {asking.cancel}
345
+ </button>
346
+ <button
347
+ type="button"
348
+ className={`btn btn--sm ${asking.id === 'signout' ? 'btn--danger' : 'btn--primary'}`}
349
+ data-testid={`home-accounts-${asking.id}-confirm`}
350
+ disabled={busy}
351
+ onClick={runAsk}
352
+ >
353
+ {asking.primary}
354
+ </button>
355
+ </span>
356
+ </div>
357
+ ) : null}
358
+ {native ? (
359
+ <div className="home-accts-foot">
360
+ <button
361
+ type="button"
362
+ className="home-accts-act"
363
+ data-testid="home-accounts-add"
364
+ aria-haspopup="menu"
365
+ aria-expanded={menu === 'add'}
366
+ onClick={() => setMenu((m) => (m === 'add' ? null : 'add'))}
367
+ >
368
+ <HIcon name="plus" size={12} /> Add an account…
369
+ </button>
370
+ {menu === 'add' ? (
371
+ <span className="home-accts-addm" role="menu">
372
+ <button
373
+ type="button"
374
+ role="menuitem"
375
+ className="row-item"
376
+ data-testid="home-accounts-add-cloud"
377
+ onClick={() => {
378
+ close();
379
+ onAddCloud?.();
380
+ }}
381
+ >
382
+ Add a Maude Cloud account…
383
+ </button>
384
+ <button
385
+ type="button"
386
+ role="menuitem"
387
+ className="row-item"
388
+ data-testid="home-accounts-add-team"
389
+ onClick={() => {
390
+ close();
391
+ onAddTeam?.();
392
+ }}
393
+ >
394
+ Connect to a team server…
395
+ </button>
396
+ </span>
397
+ ) : null}
398
+ </div>
399
+ ) : null}
400
+ </div>
401
+ ) : null}
402
+ </span>
403
+ );
404
+ }
@@ -6,7 +6,7 @@
6
6
  import { HIcon } from './home-icons.jsx';
7
7
 
8
8
  /** The broken-link glyph on a sign-in that stopped working (the project window's badge). */
9
- function BrokenLink({ size = 10 }) {
9
+ export function BrokenLink({ size = 10 }) {
10
10
  return (
11
11
  <svg
12
12
  width={size}
@@ -26,7 +26,7 @@ function BrokenLink({ size = 10 }) {
26
26
  }
27
27
 
28
28
  /** "Kept by Maude" — the mark, single colour. */
29
- function KeptGlyph({ size = 12 }) {
29
+ export function KeptGlyph({ size = 12 }) {
30
30
  return (
31
31
  <svg width={size} height={size} viewBox="0 0 16 16" aria-hidden="true">
32
32
  <rect x="1.5" y="1.5" width="13" height="13" rx="3.5" fill="currentColor" />
@@ -78,7 +78,8 @@ export function StateWord({ tone, children, testid }) {
78
78
  return (
79
79
  <span className="home-sw" data-tone={tone} data-testid={testid}>
80
80
  <i aria-hidden="true" />
81
- {children}
81
+ {/* 2.1.2: the word clips (…) on a narrow line instead of running under a button */}
82
+ <span className="home-sw-w">{children}</span>
82
83
  </span>
83
84
  );
84
85
  }