@1agh/maude 0.35.0 → 0.36.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/apps/studio/canvas-shell.tsx +73 -2
- package/apps/studio/client/app.jsx +225 -11
- package/apps/studio/client/panels/GitPanel.jsx +6 -0
- package/apps/studio/client/panels/RepoBranchSwitcher.jsx +199 -68
- package/apps/studio/client/styles/3-shell-maude.css +22 -0
- package/apps/studio/commands/edit-source-command.ts +118 -0
- package/apps/studio/dist/client.bundle.js +21 -53108
- package/apps/studio/dist/comment-mount.js +1 -2048
- package/apps/studio/dist/styles.css +1 -12220
- package/apps/studio/git/endpoints.ts +17 -0
- package/apps/studio/git/service.ts +483 -40
- package/apps/studio/github/endpoints.ts +28 -4
- package/apps/studio/github/identity-cache.ts +138 -0
- package/apps/studio/github/service.ts +40 -23
- package/apps/studio/http.ts +12 -0
- package/apps/studio/test/canvas-origin-gate.test.ts +2 -0
- package/apps/studio/test/edit-source-command.test.ts +119 -0
- package/apps/studio/test/git-branches.test.ts +141 -3
- package/apps/studio/test/github-api.test.ts +58 -1
- package/apps/studio/test/identity-cache.test.ts +83 -0
- package/apps/studio/test/remote-ahead-behind-cache.test.ts +89 -0
- package/apps/studio/test/use-undo-stack.test.tsx +30 -0
- package/apps/studio/undo-stack.ts +10 -0
- package/apps/studio/use-undo-stack.tsx +21 -1
- package/apps/studio/whats-new.json +18 -0
- package/package.json +15 -10
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
gitCreateBranch,
|
|
23
23
|
gitDiff,
|
|
24
24
|
gitDiscard,
|
|
25
|
+
gitFetchRemote,
|
|
25
26
|
gitFoldDraft,
|
|
26
27
|
gitListBranches,
|
|
27
28
|
gitLog,
|
|
@@ -76,6 +77,8 @@ export interface GitEndpoints {
|
|
|
76
77
|
checkout(body: unknown): Promise<GitEndpointResult>;
|
|
77
78
|
// "Add this draft to the Shared version" — token-bearing (it publishes).
|
|
78
79
|
fold(body: unknown): Promise<GitEndpointResult>;
|
|
80
|
+
// "Refresh drafts" — token-bearing fetch so new remote drafts surface.
|
|
81
|
+
fetchRemote(body: unknown): Promise<GitEndpointResult>;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
export function createGitEndpoints(ctx: Context): GitEndpoints {
|
|
@@ -296,6 +299,19 @@ export function createGitEndpoints(ctx: Context): GitEndpoints {
|
|
|
296
299
|
return { status: 502, json: { ok: false, error: res.error ?? 'Could not add the draft.' } };
|
|
297
300
|
}
|
|
298
301
|
|
|
302
|
+
async function fetchRemote(body: unknown): Promise<GitEndpointResult> {
|
|
303
|
+
// Token resolution mirrors fold/pull: body token → keychain bridge → undefined
|
|
304
|
+
// → authRequired. Explicit user gesture only (the UI "Refresh drafts" button).
|
|
305
|
+
const token = readToken(body) ?? (await getGithubToken()) ?? undefined;
|
|
306
|
+
const b = (body ?? {}) as { remote?: unknown };
|
|
307
|
+
if (b.remote != null && safeRemoteArg(b.remote) === undefined) return bad('Invalid remote.');
|
|
308
|
+
const res = await gitFetchRemote(dir, token, { remote: safeRemoteArg(b.remote) });
|
|
309
|
+
if (res.ok) return { status: 200, json: { ok: true, fetchedAt: res.fetchedAt } };
|
|
310
|
+
if (res.authRequired)
|
|
311
|
+
return { status: 401, json: { ok: false, authRequired: true, error: res.error } };
|
|
312
|
+
return { status: 502, json: { ok: false, error: res.error ?? 'Could not refresh drafts.' } };
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
return {
|
|
300
316
|
status,
|
|
301
317
|
commit,
|
|
@@ -309,6 +325,7 @@ export function createGitEndpoints(ctx: Context): GitEndpoints {
|
|
|
309
325
|
createBranch,
|
|
310
326
|
checkout,
|
|
311
327
|
fold,
|
|
328
|
+
fetchRemote,
|
|
312
329
|
};
|
|
313
330
|
}
|
|
314
331
|
|