@1agh/maude 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/studio/access/request.ts +1 -0
- package/apps/studio/actions/agents.ts +45 -42
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/sync.ts +4 -0
- package/apps/studio/actions/verbs.ts +49 -0
- package/apps/studio/actions.manifest.json +162 -20
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/ai/create-claim.ts +1 -1
- package/apps/studio/bin/_asset-file.mjs +117 -0
- package/apps/studio/bin/_canvas-file.mjs +146 -0
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/bin/_footage.mjs +123 -0
- package/apps/studio/bin/_pdf-playwright.mjs +14 -0
- package/apps/studio/bin/_png-playwright.mjs +15 -1
- package/apps/studio/bin/_pw-launch.mjs +98 -0
- package/apps/studio/bin/_retry-save.mjs +49 -0
- package/apps/studio/bin/_sync.mjs +145 -2
- package/apps/studio/bin/asset-rename.sh +12 -0
- package/apps/studio/bin/asset-trash.sh +12 -0
- package/apps/studio/bin/canvas-move.sh +12 -0
- package/apps/studio/bin/canvas-new.sh +12 -0
- package/apps/studio/bin/footage.sh +12 -0
- package/apps/studio/bin/generate.sh +7 -0
- package/apps/studio/bin/retry-save.sh +13 -0
- package/apps/studio/bridge/canvas-mode-store.ts +11 -2
- package/apps/studio/bridge/dgn-protocol.ts +8 -3
- package/apps/studio/bridge/occlusion.ts +45 -0
- package/apps/studio/canvas-theme-pill.tsx +169 -26
- package/apps/studio/client/app.jsx +16 -4
- package/apps/studio/client/export-center.jsx +32 -3
- package/apps/studio/client/home/HomeAccountBanner.jsx +61 -0
- package/apps/studio/client/home/HomeAccountsChip.jsx +404 -0
- package/apps/studio/client/home/HomeConnection.jsx +112 -0
- package/apps/studio/client/home/ProjectRows.jsx +514 -0
- package/apps/studio/client/home/home-accounts-model.js +234 -76
- package/apps/studio/client/home/home-api.js +10 -2
- package/apps/studio/client/home/home-app.jsx +151 -394
- package/apps/studio/client/home/home-icons.jsx +8 -0
- package/apps/studio/client/home/home-model.js +149 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +621 -53
- package/apps/studio/client/home/use-account-fix.js +123 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
- package/apps/studio/client/v2/export/done-toast.jsx +2 -5
- package/apps/studio/client/v2/export/export-sheet.jsx +9 -2
- package/apps/studio/client/v2/export/export.css +9 -0
- package/apps/studio/client/v2/export/exports-model.js +16 -3
- package/apps/studio/client/v2/export/file-rows.jsx +81 -5
- package/apps/studio/client/v2/export/native-save.js +33 -0
- package/apps/studio/client/v2/export/sections/print-copy.js +3 -0
- package/apps/studio/client/v2/export/sections/print.jsx +37 -20
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +138 -43
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +91 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/menu-runner.js +7 -2
- package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +40 -26
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/room.ts +21 -7
- package/apps/studio/dist/client.bundle.js +886 -886
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/exporters/ghostscript.ts +78 -1
- package/apps/studio/exporters/pdf-fonts.ts +31 -4
- package/apps/studio/generation/jobs.ts +6 -0
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +9 -3
- package/apps/studio/http.ts +14 -2
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/routes/agent.ts +6 -2
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/project-undo.ts +10 -0
- package/apps/studio/routes/sync.ts +22 -4
- package/apps/studio/server.ts +25 -0
- package/apps/studio/shell/api-key.ts +11 -0
- package/apps/studio/shell/cli-yield.ts +48 -11
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/action-stage.ts +18 -1
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-plane.ts +226 -19
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +68 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +16 -1
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +18 -2
- package/apps/studio/sync/status.ts +11 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/whats-new.json +36 -0
- package/cli/commands/design.mjs +74 -16
- package/cli/lib/bash-guard.mjs +23 -4
- package/cli/lib/confine-read.mjs +2 -0
- package/cli/lib/design-help.gen.mjs +15 -2
- package/cli/lib/design-hook.mjs +1 -1
- package/cli/lib/desktop-locate.mjs +36 -8
- package/cli/lib/studio-locate.mjs +8 -2
- package/cli/lib/sub-verbs.mjs +13 -1
- package/package.json +9 -8
- package/apps/studio/client/home/HomeAccounts.jsx +0 -262
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// client/home/home-accounts-model.js —
|
|
1
|
+
// client/home/home-accounts-model.js — what Home's accounts chip lists (2.1.2 HB1, canvas 17
|
|
2
|
+
// artboards 15–18; the cards came with 2.1.1 B4, the sign-outs with 2.0.5 W4b). PURE.
|
|
2
3
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// cloud
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// (Michal's rule: no dead buttons). A profile without a login offers "Sign in with GitHub…"
|
|
12
|
-
// (the existing `home_github_sign_in`).
|
|
4
|
+
// One card per account: a Maude Cloud account by its e-mail, a server of your own by its account or
|
|
5
|
+
// host; never a Maude Cloud cell (its projects are the Maude Cloud account's).
|
|
6
|
+
// Sign out cloud → POST /_home/cloud/signout {profile} (that profile's cloud.json only)
|
|
7
|
+
// server → POST /_home/hub/signout {profile, url}; asks first
|
|
8
|
+
// GitHub the login last signed in on the profile (profiles.json). Home has no GitHub sign-out
|
|
9
|
+
// of its own — it lives in the project's account card — so no button for it (Michal's
|
|
10
|
+
// rule: no dead buttons). A profile without a login offers "Sign in with GitHub…".
|
|
11
|
+
// Forget an old server (no answer, no project) — the same hub sign-out, on the person's click.
|
|
13
12
|
// Add / switch: "Add a Maude Cloud account…" is Home's own sign-in, which never re-signs a profile
|
|
14
13
|
// that holds a credential (`home_cloud_sign_in_prepare` makes a fresh one — that IS the switch);
|
|
15
|
-
// "Connect to a team server…" is the
|
|
14
|
+
// "Connect to a team server…" is the team-server sheet. A browser has no shell: facts only.
|
|
16
15
|
|
|
17
|
-
import { accountFace } from './home-model.js';
|
|
16
|
+
import { accountFace, isCloudHubUrl, normHubUrl } from './home-model.js';
|
|
17
|
+
import { CONN_WORDS, cloudState } from './home-where-model.js';
|
|
18
18
|
|
|
19
19
|
const hostOf = (url) => {
|
|
20
20
|
try {
|
|
@@ -42,80 +42,238 @@ function signOutSpec(path, name, extra) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const projectsWord = (n) => (n === 0 ? 'No projects' : `${n} ${n === 1 ? 'project' : 'projects'}`);
|
|
46
|
+
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
+
* 2.1.1 B4 (artboard 14) — the accounts row on top of Home: one card per account the projects (or the
|
|
49
|
+
* sign-ins) name, with its state and, when the person can fix it in one click, the button.
|
|
50
|
+
* cloud a Maude Cloud account, by its e-mail. Listed when signed in, when its sign-in was refused,
|
|
51
|
+
* or when a project is on it but no sign-in is left ("Sign-in missing").
|
|
52
|
+
* server a server of your own, by its account (or host). Listed per saved sign-in, and for a server
|
|
53
|
+
* a project is on but no sign-in is saved for.
|
|
54
|
+
* "This Mac only" is not a card: nothing to connect, and the project rows already say it.
|
|
55
|
+
* `fix`: `{ path: 'cloud-signin', profile }` (Home's own Maude Cloud sign-in) or
|
|
56
|
+
* `{ path: 'hub-signin', profile, url }` (the team-server sign-in, address prefilled) — only for a
|
|
57
|
+
* sign-in that is missing or stopped working; a server that does not answer has nothing to fix here.
|
|
58
|
+
* 2.1.2 HB1: `stale` = a server that does not answer and holds no project (folded, `forget` offered);
|
|
59
|
+
* `projects` = the names whose changes wait on this account; `signOut` = the confirm spec, or null
|
|
60
|
+
* when no credential is saved on this Mac.
|
|
61
|
+
*
|
|
62
|
+
* @param in.shell `shell_state`
|
|
48
63
|
* @param in.clouds one `GET /_home/cloud` answer per profile
|
|
49
|
-
* @param in.hubProfiles `GET /_home/accounts` `profiles`
|
|
64
|
+
* @param in.hubProfiles `GET /_home/accounts` `profiles` (each hub with its `state`)
|
|
65
|
+
* @param in.groups `buildHomeModel().groups` (rows carry `where` / `connection`)
|
|
66
|
+
* @param in.cloudUrl the control plane (`/_config.cloudOrigin`); null ⇒ no server card at all
|
|
50
67
|
*/
|
|
51
|
-
export function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
].filter((
|
|
68
|
+
export function homeAccountCards({
|
|
69
|
+
shell = null,
|
|
70
|
+
clouds = null,
|
|
71
|
+
hubProfiles = null,
|
|
72
|
+
groups = [],
|
|
73
|
+
cloudUrl = null,
|
|
74
|
+
}) {
|
|
75
|
+
const profiles = (shell?.profiles ?? []).filter((p) => p && typeof p.id === 'string');
|
|
76
|
+
const ids = [...profiles.map((p) => p.id), ...groups.map((g) => g.profile?.id)].filter(
|
|
77
|
+
(id, i, all) => typeof id === 'string' && all.indexOf(id) === i
|
|
78
|
+
);
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const id of ids) {
|
|
81
|
+
const prof = profiles.find((p) => p.id === id) ?? null;
|
|
82
|
+
const rows = groups.find((g) => g.profile?.id === id)?.rows ?? [];
|
|
83
|
+
const listing = (clouds ?? []).find((c) => c?.profile === id) ?? null;
|
|
84
|
+
const email = str(listing?.account?.email) || str(prof?.email);
|
|
85
|
+
const onCloud = rows.filter((r) => r.where?.kind === 'cloud');
|
|
86
|
+
const cloudOwn = rows.some((r) => r.connection?.kind === 'cloud');
|
|
59
87
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
: null,
|
|
76
|
-
|
|
88
|
+
if (listing?.signedIn || listing?.rejected || cloudOwn) {
|
|
89
|
+
const state = cloudState(listing) ?? (cloudOwn ? 'missing' : null);
|
|
90
|
+
if (state)
|
|
91
|
+
out.push({
|
|
92
|
+
key: `cloud:${id}`,
|
|
93
|
+
kind: 'cloud',
|
|
94
|
+
profile: id,
|
|
95
|
+
url: null,
|
|
96
|
+
face: { kind: 'cloud', ...accountFace({ id, label: email || prof?.label, email }) },
|
|
97
|
+
title: email || 'Maude Cloud',
|
|
98
|
+
sub: `Maude Cloud · ${projectsWord(onCloud.length)}`,
|
|
99
|
+
state,
|
|
100
|
+
word: CONN_WORDS[state],
|
|
101
|
+
projects: onCloud.map((r) => r.name),
|
|
102
|
+
stale: false,
|
|
103
|
+
forget: null,
|
|
104
|
+
// a sign-out needs a credential on this Mac: signed in, or one that stopped working
|
|
105
|
+
signOut:
|
|
106
|
+
listing?.signedIn || listing?.rejected
|
|
107
|
+
? signOutSpec('cloud-signout', email || 'Maude Cloud', { profile: id })
|
|
108
|
+
: null,
|
|
109
|
+
fix:
|
|
110
|
+
state === 'rejected' || state === 'missing'
|
|
111
|
+
? {
|
|
112
|
+
path: 'cloud-signin',
|
|
113
|
+
profile: id,
|
|
114
|
+
label: state === 'rejected' ? 'Sign in again' : 'Sign in',
|
|
115
|
+
}
|
|
116
|
+
: null,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 2.1.2 HB1: a server card only once the control plane is known — until then a saved sign-in to
|
|
121
|
+
// a Maude Cloud cell cannot be told from a server of your own, and nothing is guessed. A cell is
|
|
122
|
+
// never a server: its projects already count under the Maude Cloud account above, whose own
|
|
123
|
+
// sign-in is the state (the cell's token is re-made from it).
|
|
124
|
+
const saved = cloudUrl ? ((hubProfiles ?? []).find((x) => x?.id === id)?.hubs ?? []) : [];
|
|
125
|
+
const servers = new Map();
|
|
126
|
+
for (const h of saved)
|
|
127
|
+
if (h && typeof h.url === 'string' && normHubUrl(h.url) && !isCloudHubUrl(h.url, cloudUrl))
|
|
128
|
+
servers.set(normHubUrl(h.url), {
|
|
129
|
+
url: h.url,
|
|
130
|
+
account: str(h.account),
|
|
131
|
+
state: h.state,
|
|
132
|
+
saved: true,
|
|
133
|
+
});
|
|
134
|
+
for (const r of rows) {
|
|
135
|
+
const url = r.connection?.kind === 'team' ? r.boundHub || r.hub : null;
|
|
136
|
+
if (url && !servers.has(url))
|
|
137
|
+
servers.set(url, { url, account: null, state: 'missing', saved: false });
|
|
77
138
|
}
|
|
78
|
-
for (const h of
|
|
79
|
-
|
|
139
|
+
for (const [norm, h] of servers) {
|
|
140
|
+
const state =
|
|
141
|
+
h.state === 'missing' || h.state === 'rejected' || h.state === 'unreachable'
|
|
142
|
+
? h.state
|
|
143
|
+
: 'ok';
|
|
80
144
|
const host = hostOf(h.url);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
145
|
+
const mine = rows.filter((r) => r.where?.kind === 'server' && (r.boundHub || r.hub) === norm);
|
|
146
|
+
const n = mine.length;
|
|
147
|
+
// an old server: it does not answer and no project is on it — folded, offered Forget…
|
|
148
|
+
const stale = state === 'unreachable' && n === 0;
|
|
149
|
+
out.push({
|
|
150
|
+
key: `server:${id}:${norm}`,
|
|
151
|
+
kind: 'server',
|
|
152
|
+
profile: id,
|
|
153
|
+
url: h.url,
|
|
154
|
+
face: { kind: 'server' },
|
|
155
|
+
title: h.account || host,
|
|
156
|
+
sub: `${h.account ? host : 'Your server'} · ${projectsWord(n)}`,
|
|
157
|
+
state,
|
|
158
|
+
word: CONN_WORDS[state],
|
|
159
|
+
projects: mine.map((r) => r.name),
|
|
160
|
+
stale,
|
|
161
|
+
forget: stale && h.saved ? { profile: id, url: h.url, host } : null,
|
|
162
|
+
signOut: h.saved ? signOutSpec('hub-signout', host, { profile: id, url: h.url }) : null,
|
|
163
|
+
fix:
|
|
164
|
+
state === 'rejected' || state === 'missing'
|
|
165
|
+
? {
|
|
166
|
+
path: 'hub-signin',
|
|
167
|
+
profile: id,
|
|
168
|
+
url: h.url,
|
|
169
|
+
label: state === 'rejected' ? 'Sign in again' : 'Sign in',
|
|
170
|
+
}
|
|
171
|
+
: null,
|
|
88
172
|
});
|
|
89
173
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The testid tail of a card: `<profile>-cloud` or `<profile>-<host>`. */
|
|
179
|
+
export const slugOf = (card) =>
|
|
180
|
+
card.kind === 'cloud'
|
|
181
|
+
? `${card.profile}-cloud`
|
|
182
|
+
: `${card.profile}-${hostOf(card.url)
|
|
183
|
+
.toLowerCase()
|
|
184
|
+
.replace(/[^a-z0-9]+/g, '-')}`;
|
|
185
|
+
|
|
186
|
+
const isBad = (c) => c.state === 'rejected' || c.state === 'missing';
|
|
187
|
+
const countOf = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 2.1.2 HB1 (canvas 17, artboards 15–17) — the chip at the top right of Home: "3 accounts", plus
|
|
191
|
+
* "1 needs sign-in" (with its dot) while a sign-in is missing or stopped working. Old servers (no
|
|
192
|
+
* answer, no project) are not counted: they fold at the foot of the accounts list (artboard 18).
|
|
193
|
+
*/
|
|
194
|
+
export function homeAccountsSummary(cards) {
|
|
195
|
+
const live = cards.filter((c) => !c.stale);
|
|
196
|
+
const old = cards.filter((c) => c.stale);
|
|
197
|
+
const needs = live.filter(isBad).length;
|
|
198
|
+
return {
|
|
199
|
+
live,
|
|
200
|
+
old,
|
|
201
|
+
word: live.length ? countOf(live.length, 'account', 'accounts') : 'Accounts',
|
|
202
|
+
needs,
|
|
203
|
+
needsWord: needs ? `${needs} ${needs === 1 ? 'needs' : 'need'} sign-in` : null,
|
|
204
|
+
oldWord: old.length ? countOf(old.length, 'old server', 'old servers') : null,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const namesWord = (names) =>
|
|
209
|
+
names.length <= 2
|
|
210
|
+
? names.join(' and ')
|
|
211
|
+
: `${names.slice(0, 2).join(', ')} and ${names.length - 2} more`;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 2.1.2 HB1 (artboard 16) — the one banner on top of Home: only a sign-in the person can fix (missing
|
|
215
|
+
* or stopped working). One → it names the place, the projects whose changes wait, and the card's own
|
|
216
|
+
* fix. Two or more → a count and Review (the accounts list). A server that does not answer never
|
|
217
|
+
* raises it. null = nothing needs the person.
|
|
218
|
+
*/
|
|
219
|
+
export function homeAccountBanner(cards) {
|
|
220
|
+
const bad = cards.filter((c) => !c.stale && isBad(c) && c.fix);
|
|
221
|
+
if (!bad.length) return null;
|
|
222
|
+
if (bad.length > 1)
|
|
100
223
|
return {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
224
|
+
kind: 'many',
|
|
225
|
+
key: bad.map((c) => c.key).join('|'),
|
|
226
|
+
card: null,
|
|
227
|
+
title: bad.every((c) => c.state === 'rejected')
|
|
228
|
+
? `${bad.length} sign-ins stopped working`
|
|
229
|
+
: `${bad.length} sign-ins need you`,
|
|
230
|
+
body: null,
|
|
231
|
+
action: 'Review',
|
|
106
232
|
};
|
|
107
|
-
|
|
233
|
+
const card = bad[0];
|
|
234
|
+
const place = card.kind === 'cloud' ? 'Maude Cloud' : hostOf(card.url);
|
|
235
|
+
const names = (card.projects ?? []).filter(Boolean);
|
|
236
|
+
return {
|
|
237
|
+
kind: 'one',
|
|
238
|
+
key: card.key,
|
|
239
|
+
card,
|
|
240
|
+
title:
|
|
241
|
+
card.state === 'rejected'
|
|
242
|
+
? `Your sign-in to ${place} stopped working.`
|
|
243
|
+
: `Your sign-in to ${place} is missing.`,
|
|
244
|
+
body: names.length ? `Changes to ${namesWord(names)} wait on this Mac.` : null,
|
|
245
|
+
action: card.fix.label,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
108
248
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
249
|
+
/**
|
|
250
|
+
* The GitHub login of a profile, for its first card's "…" menu: `{ login }` when signed in,
|
|
251
|
+
* `{ signIn: true }` when not (Home's `home_github_sign_in`). Home has no GitHub sign-out of its own.
|
|
252
|
+
*/
|
|
253
|
+
export function githubOf(shell, profile) {
|
|
254
|
+
const p = (shell?.profiles ?? []).find((x) => x?.id === profile);
|
|
255
|
+
const gh = str(p?.github);
|
|
256
|
+
return gh ? { login: `@${gh.replace(/^@/, '')}`, signIn: false } : { login: null, signIn: true };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** The confirm for Forget… on one old server, or on all of them (artboard 18). */
|
|
260
|
+
export function forgetSpec(servers) {
|
|
261
|
+
if (servers.length === 1)
|
|
262
|
+
return {
|
|
263
|
+
id: 'forget',
|
|
264
|
+
servers,
|
|
265
|
+
title: 'Forget this server?',
|
|
266
|
+
body: `The saved sign-in for ${servers[0].host} is removed from this Mac. Nothing on the server or in your projects is deleted.`,
|
|
267
|
+
primary: 'Forget this server',
|
|
268
|
+
cancel: 'Cancel',
|
|
269
|
+
};
|
|
270
|
+
const n = servers.length;
|
|
116
271
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
272
|
+
id: 'forget-all',
|
|
273
|
+
servers,
|
|
274
|
+
title: `Forget ${n} old servers?`,
|
|
275
|
+
body: `The saved sign-ins for these ${n} servers are removed from this Mac. Nothing on the servers or in your projects is deleted.`,
|
|
276
|
+
primary: `Forget ${n} old servers`,
|
|
277
|
+
cancel: 'Cancel',
|
|
120
278
|
};
|
|
121
279
|
}
|
|
@@ -130,8 +130,12 @@ export const cloudSignInStart = (profile) =>
|
|
|
130
130
|
export const cloudSignInPoll = (state) => post('/_home/cloud/signin/poll', { state });
|
|
131
131
|
export const cloudSignInCancel = (state) => post('/_home/cloud/signin/cancel', { state });
|
|
132
132
|
/** Rust picks (or makes) the profile the next sign-in may write → its id. A refusal rejects with words. */
|
|
133
|
-
export const signInPrepare = (forInvite) =>
|
|
134
|
-
shellInvoke('home_cloud_sign_in_prepare',
|
|
133
|
+
export const signInPrepare = (forInvite, profile) =>
|
|
134
|
+
shellInvoke('home_cloud_sign_in_prepare', {
|
|
135
|
+
...(forInvite ? { forInvite } : {}),
|
|
136
|
+
// 2.1.1: "Sign in again" on an account's card asks for THAT profile
|
|
137
|
+
...(profile ? { profile } : {}),
|
|
138
|
+
});
|
|
135
139
|
export const signInOpenBrowser = (userCode, state) =>
|
|
136
140
|
shellInvoke('home_cloud_sign_in_open', { userCode, state });
|
|
137
141
|
/** After the Home server stored the credential: Rust records the account → the profile it landed in. */
|
|
@@ -276,6 +280,10 @@ export const openProjectFolder = () => shellInvoke('open_project_folder');
|
|
|
276
280
|
* (Rust resolves the folder from its own list; Home never names a path). → `{label, opened}`. */
|
|
277
281
|
export const openWorktree = (pid) => shellInvoke('open_worktree', { pid });
|
|
278
282
|
export const relinkProject = (pid) => shellInvoke('relink_project', { pid });
|
|
283
|
+
/** 2.1.2 — "Remove from list": the pid off this Mac's list (Rust `forget_project`); files untouched. */
|
|
284
|
+
export const forgetProject = (pid) => shellInvoke('forget_project', { pid });
|
|
285
|
+
/** 2.1.2 — a project row's "Show in Finder": Rust resolves the folder by pid (Home never names a path). */
|
|
286
|
+
export const revealProjectFolder = (pid) => shellInvoke('reveal_project_folder', { pid });
|
|
279
287
|
/** The existing command (github.js `managedProjectOpen`): resolves the managed copy's folder. */
|
|
280
288
|
export const managedProjectOpen = (p) =>
|
|
281
289
|
shellInvoke('managed_project_open', {
|