@laoyuehanni/dsh-git-worktree 0.4.8 → 0.4.9
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/README.md +4 -2
- package/README.zh.md +4 -2
- package/lib/client.js +1517 -102
- package/lib/git.d.ts +58 -11
- package/lib/git.js +197 -17
- package/lib/index.js +24 -4
- package/lib/progress.d.ts +60 -0
- package/lib/progress.js +122 -0
- package/lib/push.d.ts +27 -0
- package/lib/push.js +215 -0
- package/lib/routes.d.ts +45 -6
- package/lib/routes.js +120 -7
- package/lib/stream.d.ts +33 -0
- package/lib/stream.js +54 -0
- package/lib/wire.d.ts +95 -2
- package/lib/wire.js +15 -2
- package/package.json +12 -10
package/lib/client.js
CHANGED
|
@@ -72,10 +72,21 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
/** POST ROUTE_PREFIX/branch-delete — delete a LOCAL branch (`-d`, merged
|
|
73
73
|
* only; git refuses the rest). */
|
|
74
74
|
const ROUTE_BRANCH_DELETE = `${ROUTE_PREFIX}/branch-delete`;
|
|
75
|
-
/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
|
|
75
|
+
/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
|
|
76
|
+
* Streams {@link SyncFrame} lines (NDJSON) so a long transfer can show progress. */
|
|
76
77
|
const ROUTE_FETCH = `${ROUTE_PREFIX}/fetch`;
|
|
77
|
-
/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
|
|
78
|
+
/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
|
|
79
|
+
* Streams {@link SyncFrame} lines (NDJSON), like {@link ROUTE_FETCH}. */
|
|
78
80
|
const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`;
|
|
81
|
+
/** POST push-plan — resolve the selected branch's push destination. */
|
|
82
|
+
const ROUTE_PUSH_PLAN = `${ROUTE_PREFIX}/push-plan`;
|
|
83
|
+
/** POST push-preview — inspect one explicit destination without pushing. */
|
|
84
|
+
const ROUTE_PUSH_PREVIEW = `${ROUTE_PREFIX}/push-preview`;
|
|
85
|
+
/** POST push — push one explicit local branch. Streams {@link SyncFrame}
|
|
86
|
+
* lines (NDJSON), like {@link ROUTE_FETCH}; the `done` body is a
|
|
87
|
+
* {@link PushResult}. A cancel (499) kills `git push`; the remote only moves
|
|
88
|
+
* a ref once the whole pack has arrived, so a stopped transfer changes nothing. */
|
|
89
|
+
const ROUTE_PUSH = `${ROUTE_PREFIX}/push`;
|
|
79
90
|
/** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */
|
|
80
91
|
const ROUTE_INSPECT = `${ROUTE_PREFIX}/inspect`;
|
|
81
92
|
/** POST ROUTE_PREFIX/remove — delete one linked worktree (git registration + folder). */
|
|
@@ -97,26 +108,94 @@ window.__ModuleLoader__.load({
|
|
|
97
108
|
/** Send one JSON body with any method and parse the uniform envelope. */
|
|
98
109
|
async function send(method, url, body) {
|
|
99
110
|
try {
|
|
100
|
-
|
|
111
|
+
return await readEnvelope(await fetch(url, {
|
|
101
112
|
method,
|
|
102
113
|
headers: { "content-type": "application/json" },
|
|
103
114
|
body: JSON.stringify(body)
|
|
115
|
+
}));
|
|
116
|
+
} catch (cause) {
|
|
117
|
+
return {
|
|
118
|
+
ok: false,
|
|
119
|
+
error: cause instanceof Error ? cause.message : String(cause)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** Parse one whole-body JSON response into the uniform envelope. */
|
|
124
|
+
async function readEnvelope(response) {
|
|
125
|
+
let payload;
|
|
126
|
+
try {
|
|
127
|
+
payload = await response.json();
|
|
128
|
+
} catch {
|
|
129
|
+
return {
|
|
130
|
+
ok: false,
|
|
131
|
+
error: `HTTP ${String(response.status)}`
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (!response.ok) return {
|
|
135
|
+
ok: false,
|
|
136
|
+
error: payload.error ?? `HTTP ${String(response.status)}`
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
...payload,
|
|
140
|
+
ok: true
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The text a stream cut short (host restart, dropped connection) reports. */
|
|
144
|
+
const STREAM_CUT = "Connection closed before the operation finished";
|
|
145
|
+
/**
|
|
146
|
+
* POST one JSON body to a streamed route (NDJSON of {@link SyncFrame}s) and
|
|
147
|
+
* resolve with what the route would have answered in one piece, taken from
|
|
148
|
+
* the closing `done` frame. A response that is not a stream — a body-level
|
|
149
|
+
* 400, or a host build that predates streaming and answers plain JSON — is
|
|
150
|
+
* read as the ordinary envelope, so both ends upgrade independently.
|
|
151
|
+
* @param url - the streamed route.
|
|
152
|
+
* @param body - JSON request body.
|
|
153
|
+
* @param live - progress listener and cancellation signal.
|
|
154
|
+
*/
|
|
155
|
+
async function postStream(url, body, live = {}) {
|
|
156
|
+
try {
|
|
157
|
+
const response = await fetch(url, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: { "content-type": "application/json" },
|
|
160
|
+
body: JSON.stringify(body),
|
|
161
|
+
...live.signal === void 0 ? {} : { signal: live.signal }
|
|
104
162
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
163
|
+
if (response.body === null || !(response.headers.get("content-type") ?? "").includes("application/x-ndjson")) return await readEnvelope(response);
|
|
164
|
+
const reader = response.body.getReader();
|
|
165
|
+
const decoder = new TextDecoder();
|
|
166
|
+
let pending = "";
|
|
167
|
+
const closing = {};
|
|
168
|
+
const take = (line) => {
|
|
169
|
+
if (line.trim() === "") return;
|
|
170
|
+
let frame;
|
|
171
|
+
try {
|
|
172
|
+
frame = JSON.parse(line);
|
|
173
|
+
} catch {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (frame.type === "done") closing.frame = frame;
|
|
177
|
+
else live.onEvent?.(frame);
|
|
178
|
+
};
|
|
179
|
+
for (;;) {
|
|
180
|
+
const chunk = await reader.read();
|
|
181
|
+
if (chunk.done) break;
|
|
182
|
+
pending += decoder.decode(chunk.value, { stream: true });
|
|
183
|
+
const lines = pending.split("\n");
|
|
184
|
+
pending = lines.pop() ?? "";
|
|
185
|
+
lines.forEach(take);
|
|
113
186
|
}
|
|
114
|
-
|
|
187
|
+
take(pending + decoder.decode());
|
|
188
|
+
const done = closing.frame;
|
|
189
|
+
if (done === void 0) return {
|
|
190
|
+
ok: false,
|
|
191
|
+
error: STREAM_CUT
|
|
192
|
+
};
|
|
193
|
+
if (done.status < 200 || done.status >= 300) return {
|
|
115
194
|
ok: false,
|
|
116
|
-
error:
|
|
195
|
+
error: done.body?.error ?? `HTTP ${String(done.status)}`
|
|
117
196
|
};
|
|
118
197
|
return {
|
|
119
|
-
...
|
|
198
|
+
...done.body,
|
|
120
199
|
ok: true
|
|
121
200
|
};
|
|
122
201
|
} catch (cause) {
|
|
@@ -263,17 +342,37 @@ window.__ModuleLoader__.load({
|
|
|
263
342
|
/**
|
|
264
343
|
* Sync remote-tracking refs (fetch every remote + prune) for the repository.
|
|
265
344
|
* @param repoPath - absolute directory inside the repository.
|
|
345
|
+
* @param live - progress listener and cancellation signal.
|
|
266
346
|
*/
|
|
267
|
-
function requestFetch(repoPath) {
|
|
268
|
-
return
|
|
347
|
+
function requestFetch(repoPath, live) {
|
|
348
|
+
return postStream(ROUTE_FETCH, { repoPath }, live);
|
|
269
349
|
}
|
|
270
350
|
/**
|
|
271
351
|
* Update the CURRENT checkout: fetch every remote, then fast-forward the
|
|
272
352
|
* checked-out branch to its upstream.
|
|
273
353
|
* @param repoPath - absolute directory whose checked-out branch is updated.
|
|
354
|
+
* @param live - progress listener and cancellation signal.
|
|
274
355
|
*/
|
|
275
|
-
function requestUpdate(repoPath) {
|
|
276
|
-
return
|
|
356
|
+
function requestUpdate(repoPath, live) {
|
|
357
|
+
return postStream(ROUTE_UPDATE, { repoPath }, live);
|
|
358
|
+
}
|
|
359
|
+
function requestPushPlan(repoPath, branch) {
|
|
360
|
+
return post(ROUTE_PUSH_PLAN, {
|
|
361
|
+
repoPath,
|
|
362
|
+
branch
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function requestPushPreview(body) {
|
|
366
|
+
return post(ROUTE_PUSH_PREVIEW, body);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Push one branch: streamed, so a long upload reports git's progress and can
|
|
370
|
+
* be cancelled by aborting.
|
|
371
|
+
* @param body - what to push and where.
|
|
372
|
+
* @param live - progress listener and cancellation signal.
|
|
373
|
+
*/
|
|
374
|
+
function requestPush(body, live) {
|
|
375
|
+
return postStream(ROUTE_PUSH, body, live);
|
|
277
376
|
}
|
|
278
377
|
/**
|
|
279
378
|
* Pre-delete facts for one worktree directory: the uncommitted-file count
|
|
@@ -456,6 +555,697 @@ window.__ModuleLoader__.load({
|
|
|
456
555
|
};
|
|
457
556
|
}
|
|
458
557
|
//#endregion
|
|
558
|
+
//#region src/client/push-error.ts
|
|
559
|
+
/** Ordered: the most specific cause wins when several markers appear. */
|
|
560
|
+
const MARKERS$1 = [
|
|
561
|
+
["stale", /\(stale info\)/i],
|
|
562
|
+
["hook", /\bpre-push hook\b/i],
|
|
563
|
+
["refused", /\[remote rejected\]|remote: error: |pre-receive hook declined|protected branch/i],
|
|
564
|
+
["behind", /\((?:non-fast-forward|fetch first)\)|\bnon-fast-forward\b|\bfetch first\b|tip of your current branch is behind/i],
|
|
565
|
+
["auth", /authentication failed|could not read (?:username|password)|terminal prompts disabled|permission denied \(publickey|host key verification failed|access denied|invalid credentials/i]
|
|
566
|
+
];
|
|
567
|
+
/** git's trailer on a rejected push. It names no rule and no hook. */
|
|
568
|
+
const PUSH_TRAILER = /^error: failed to push some refs\b/i;
|
|
569
|
+
/**
|
|
570
|
+
* What git itself said, without the `git <args…> failed (exit N): ` preamble.
|
|
571
|
+
*
|
|
572
|
+
* The push command line (`-c remote.x.mirror=false push --porcelain …`) is
|
|
573
|
+
* long and pushes the remote's own wording (the one line that names a
|
|
574
|
+
* protected branch or a failing hook) out of a short scrolling box. The
|
|
575
|
+
* trailer `error: failed to push some refs to '<url>'` is dropped once any
|
|
576
|
+
* other line says why; a failure that is only that trailer keeps it.
|
|
577
|
+
* @param raw - the error text returned by the push route.
|
|
578
|
+
* @returns git's output, or `raw` unchanged when it is not a git failure.
|
|
579
|
+
*/
|
|
580
|
+
function gitOutput(raw) {
|
|
581
|
+
const output = /^git [\s\S]*?failed \(exit \d+\):\s*([\s\S]*)$/.exec(raw)?.[1];
|
|
582
|
+
const text = output === void 0 || output === "" ? raw : output;
|
|
583
|
+
const lines = text.split(/\r?\n/);
|
|
584
|
+
const kept = lines.filter((line) => !PUSH_TRAILER.test(line.trim()));
|
|
585
|
+
if (kept.length === lines.length || kept.every((line) => line.trim() === "")) return text;
|
|
586
|
+
return kept.join("\n").replace(/^\n+|\n+$/g, "");
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Whether git's own text is worth showing beneath the explanation.
|
|
590
|
+
*
|
|
591
|
+
* `behind` and `stale` are fully explained by one sentence that also names the
|
|
592
|
+
* next step; git's side of it is only `hint: … git pull …` boilerplate. A
|
|
593
|
+
* refusal or credential failure is different: the remote's wording names the
|
|
594
|
+
* rule, hook or host that said no, which no fixed sentence can.
|
|
595
|
+
* @param kind - a recognised cause.
|
|
596
|
+
* @returns true when the text adds information.
|
|
597
|
+
*/
|
|
598
|
+
function showsGitOutput(kind) {
|
|
599
|
+
return kind !== "behind" && kind !== "stale";
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Classify a push failure.
|
|
603
|
+
* @param raw - the error text returned by the push route.
|
|
604
|
+
* @returns the recognised cause, or null for anything else (shown verbatim).
|
|
605
|
+
*/
|
|
606
|
+
function classifyPushFailure(raw) {
|
|
607
|
+
for (const [kind, pattern] of MARKERS$1) if (pattern.test(raw)) return kind;
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\PushDialog.module.css?inline
|
|
612
|
+
const css$4 = ".dialog_1212074589 {\n width: min(420px, 100%);\n max-height: 100%;\n gap: 0;\n padding: 0;\n overflow: visible;\n border-radius: var(--dsw-radius-xl, 20px);\n font-size: 13px;\n line-height: 20px;\n}\n.header_1212074589 { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 16px; }\n.header_1212074589 h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 24px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.header_1212074589 h2 span { color: var(--dsw-alias-label-secondary); font-weight: 400; }\n.close_1212074589, .refresh_1212074589 { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-tertiary); cursor: pointer; }\n.close_1212074589:hover:not(:disabled), .refresh_1212074589:hover:not(:disabled), .textButton_1212074589:hover:not(:disabled), .scope_1212074589:hover:not(:disabled), .editorClose_1212074589:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.body_1212074589 { padding: 0 12px; min-height: 0; }\n.mapping_1212074589 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 34px; padding: 3px 10px; border-radius: var(--dsw-radius-md); background: var(--dsw-alias-interactive-bg-hover); }\n.mapping_1212074589 > svg { flex: none; color: var(--dsw-alias-label-secondary); }\n/* The branch being pushed may be long; give it up to half the row (the target keeps its own cap). */\n.source_1212074589 { min-width: 0; max-width: min(200px, 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.arrow_1212074589 { color: var(--dsw-alias-label-tertiary); }\n.destination_1212074589 { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; }\n.remote_1212074589 { color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n.textButton_1212074589, .scope_1212074589 { display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: var(--dsw-radius-xs); padding: 2px 4px; background: transparent; color: var(--dsw-alias-link); font: inherit; cursor: pointer; max-width: 100%; }\n.chevron_1212074589 { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }\n.targetWrap_1212074589 { position: relative; min-width: 0; max-width: 180px; }\n.targetName_1212074589 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.badge_1212074589 { font-size: 11px; line-height: 18px; padding: 0 5px; border-radius: var(--dsw-radius-xs); background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-secondary); }\n.editor_1212074589 { position: absolute; z-index: 5; top: calc(100% + 5px); left: 0; width: 200px; max-width: calc(100vw - 64px); padding: 10px; border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); }\n/* Near the dialog's right edge the editor lines up with the name's right edge instead. */\n.editorEnd_1212074589 { left: auto; right: 0; }\n.editorHead_1212074589 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; }\n.editor_1212074589 label { display: block; font-size: 11px; color: var(--dsw-alias-label-tertiary); }\n.editorClose_1212074589 { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin: -3px -4px 0 0; padding: 0; border: 0; border-radius: var(--dsw-radius-xs); background: transparent; color: var(--dsw-alias-label-tertiary); cursor: pointer; }\n.editor_1212074589 input { box-sizing: border-box; width: 100%; padding: 5px 7px; font: inherit; border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }\n.editor_1212074589 input[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n.commits_1212074589 { padding: 8px 10px 12px; min-height: 96px; }\n.count_1212074589 { font-size: 11px; color: var(--dsw-alias-label-tertiary); margin-bottom: 6px; }\n.previewStatus_1212074589 { margin-left: 8px; }\n.list_1212074589 { list-style: none; margin: 0; padding: 0 5px 0 0; max-height: min(168px, 28vh); overflow-y: auto; overscroll-behavior: contain; }\n.list_1212074589 li { display: flex; align-items: center; gap: 8px; min-height: 28px; }\n.list_1212074589 svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--dsw-alias-label-tertiary); stroke-width: 1.5; }\n.list_1212074589 li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.empty_1212074589 { display: grid; place-items: center; min-height: 60px; margin: 0; font-size: 12px; color: var(--dsw-alias-label-tertiary); }\n.hint_1212074589 { margin: 6px 0 0; font-size: 11px; line-height: 17px; color: var(--dsw-alias-label-tertiary); }\n.error_1212074589 { max-height: 120px; margin-bottom: 8px; overflow: auto; font-size: 12px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }\n/* A recognised cause leads in plain words; git's own text stays below it, quieter. */\n.errorSummary_1212074589 { margin: 0 0 4px; font-weight: 500; }\n.errorSummary_1212074589:last-child { margin-bottom: 0; }\n.errorDetail_1212074589 { max-height: 64px; overflow: auto; font-size: 11px; line-height: 16px; white-space: pre-wrap; color: var(--dsw-alias-label-secondary); }\n.footer_1212074589 { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0 16px; padding: 12px 0 14px; border-top: .5px solid var(--dsw-alias-border-l2); }\n.tagOptions_1212074589 { display: flex; align-items: center; gap: 4px; min-width: 0; }\n.checkbox_1212074589 { display: flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; color: var(--dsw-alias-label-secondary); cursor: pointer; }\n.checkbox_1212074589 input { appearance: none; margin: 0; width: 14px; height: 14px; border: 1px solid var(--dsw-alias-label-tertiary); border-radius: var(--dsw-radius-xs); display: grid; place-content: center; cursor: pointer; }\n.checkbox_1212074589 input:checked { background: var(--dsw-alias-button-primary-fill); border-color: var(--dsw-alias-button-primary-fill); }\n.checkbox_1212074589 input:checked::after { content: ''; width: 6px; height: 3px; border: solid var(--dsw-alias-label-primary-foreground); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg) translateY(-1px); }\n.scope_1212074589 { color: var(--dsw-alias-label-secondary); font-size: 12px; }\n.actions_1212074589 { display: flex; align-items: center; gap: 4px; margin-left: auto; }\n.split_1212074589 { display: flex; border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); }\n.push_1212074589, .splitArrow_1212074589 { height: 28px; padding: 0 10px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }\n.push_1212074589 { min-width: 56px; border-radius: var(--dsw-radius-sm) 0 0 var(--dsw-radius-sm); }\n.splitArrow_1212074589 { position: relative; display: grid; place-items: center; width: 27px; padding: 0; border-radius: 0 var(--dsw-radius-sm) var(--dsw-radius-sm) 0; }\n.splitArrow_1212074589::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; border-left: 1px solid currentColor; opacity: .18; }\n.push_1212074589:hover:not(:disabled), .splitArrow_1212074589:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dialog_1212074589 button:disabled, .dialog_1212074589 input:disabled { opacity: .4; cursor: not-allowed; }\n/* Keyboard focus ring, spelled out like the plugin's other dialogs rather\n * than left to the host's global reset. */\n.close_1212074589:focus-visible, .refresh_1212074589:focus-visible, .textButton_1212074589:focus-visible, .scope_1212074589:focus-visible, .editorClose_1212074589:focus-visible,\n.push_1212074589:focus-visible, .splitArrow_1212074589:focus-visible, .checkbox_1212074589 input:focus-visible, .list_1212074589:focus-visible, .editor_1212074589 input:focus-visible {\n outline: 2px solid var(--dsw-alias-brand-primary);\n outline-offset: -2px;\n}\n@media (max-height: 450px) { .list_1212074589 { max-height: 70px; } .header_1212074589 { padding-top: 8px; padding-bottom: 6px; } .commits_1212074589 { min-height: 65px; } .footer_1212074589 { padding-block: 8px; } }\n";
|
|
613
|
+
const tagId$4 = "@laoyuehanni/dsh-git-worktree/PushDialog.module.css";
|
|
614
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$4 + "\"]") === null) {
|
|
615
|
+
const tag = document.createElement("style");
|
|
616
|
+
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
617
|
+
tag.dataset.pluginCss = tagId$4;
|
|
618
|
+
tag.textContent = css$4;
|
|
619
|
+
document.head.appendChild(tag);
|
|
620
|
+
}
|
|
621
|
+
var PushDialog_module_default = {
|
|
622
|
+
"dialog": "dialog_1212074589",
|
|
623
|
+
"header": "header_1212074589",
|
|
624
|
+
"close": "close_1212074589",
|
|
625
|
+
"refresh": "refresh_1212074589",
|
|
626
|
+
"textButton": "textButton_1212074589",
|
|
627
|
+
"scope": "scope_1212074589",
|
|
628
|
+
"editorClose": "editorClose_1212074589",
|
|
629
|
+
"body": "body_1212074589",
|
|
630
|
+
"mapping": "mapping_1212074589",
|
|
631
|
+
"source": "source_1212074589",
|
|
632
|
+
"arrow": "arrow_1212074589",
|
|
633
|
+
"destination": "destination_1212074589",
|
|
634
|
+
"remote": "remote_1212074589",
|
|
635
|
+
"chevron": "chevron_1212074589",
|
|
636
|
+
"targetWrap": "targetWrap_1212074589",
|
|
637
|
+
"targetName": "targetName_1212074589",
|
|
638
|
+
"badge": "badge_1212074589",
|
|
639
|
+
"editor": "editor_1212074589",
|
|
640
|
+
"editorEnd": "editorEnd_1212074589",
|
|
641
|
+
"editorHead": "editorHead_1212074589",
|
|
642
|
+
"commits": "commits_1212074589",
|
|
643
|
+
"count": "count_1212074589",
|
|
644
|
+
"previewStatus": "previewStatus_1212074589",
|
|
645
|
+
"list": "list_1212074589",
|
|
646
|
+
"empty": "empty_1212074589",
|
|
647
|
+
"hint": "hint_1212074589",
|
|
648
|
+
"error": "error_1212074589",
|
|
649
|
+
"errorSummary": "errorSummary_1212074589",
|
|
650
|
+
"errorDetail": "errorDetail_1212074589",
|
|
651
|
+
"footer": "footer_1212074589",
|
|
652
|
+
"tagOptions": "tagOptions_1212074589",
|
|
653
|
+
"checkbox": "checkbox_1212074589",
|
|
654
|
+
"actions": "actions_1212074589",
|
|
655
|
+
"split": "split_1212074589",
|
|
656
|
+
"push": "push_1212074589",
|
|
657
|
+
"splitArrow": "splitArrow_1212074589"
|
|
658
|
+
};
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region src/client/PushDialog.tsx
|
|
661
|
+
const FAILURE_KEYS = {
|
|
662
|
+
behind: "pushFailBehind",
|
|
663
|
+
stale: "pushFailStale",
|
|
664
|
+
hook: "pushFailHook",
|
|
665
|
+
refused: "pushFailRefused",
|
|
666
|
+
auth: "pushFailAuth"
|
|
667
|
+
};
|
|
668
|
+
function Chevron() {
|
|
669
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
670
|
+
"aria-hidden": "true",
|
|
671
|
+
viewBox: "0 0 16 16",
|
|
672
|
+
className: PushDialog_module_default.chevron,
|
|
673
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m4 6 4 4 4-4" })
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* The host Modal closes on a click of its mask, the same command as Escape.
|
|
678
|
+
* For a review in progress that is too easy to hit: one stray click beside
|
|
679
|
+
* the window would throw away the destination, the preview and any edit.
|
|
680
|
+
* This swallows only that click, found as the element right before the
|
|
681
|
+
* dialog card; Escape, the close button and Cancel still close. If the host
|
|
682
|
+
* ever changes its markup the mask simply closes the window again.
|
|
683
|
+
* @param event - the click, seen in the capture phase before the host does.
|
|
684
|
+
* @param anchor - any element inside the dialog card.
|
|
685
|
+
* @returns whether the click was on the mask and has been swallowed.
|
|
686
|
+
*/
|
|
687
|
+
function swallowMaskClick(event, anchor) {
|
|
688
|
+
const mask = anchor?.closest("[role=\"dialog\"]")?.previousElementSibling;
|
|
689
|
+
if (mask === void 0 || mask === null || event.target !== mask) return false;
|
|
690
|
+
event.stopPropagation();
|
|
691
|
+
return true;
|
|
692
|
+
}
|
|
693
|
+
/** Compact push review: the branch/target and footer stay outside the scrolling list. */
|
|
694
|
+
function PushDialog({ repoPath, repoName, branch, branchInfo, busy, resume, t, onClose, onPush }) {
|
|
695
|
+
const [plan, setPlan] = (0, react.useState)(null);
|
|
696
|
+
const [planError, setPlanError] = (0, react.useState)(null);
|
|
697
|
+
const [destination, setDestination] = (0, react.useState)(null);
|
|
698
|
+
const [previewState, setPreviewState] = (0, react.useState)(null);
|
|
699
|
+
const [localState, setLocalState] = (0, react.useState)(null);
|
|
700
|
+
const [retry, setRetry] = (0, react.useState)(0);
|
|
701
|
+
const [planRetry, setPlanRetry] = (0, react.useState)(0);
|
|
702
|
+
const [menu, setMenu] = (0, react.useState)(null);
|
|
703
|
+
const [editing, setEditing] = (0, react.useState)(false);
|
|
704
|
+
const [alignEnd, setAlignEnd] = (0, react.useState)(false);
|
|
705
|
+
const [draft, setDraft] = (0, react.useState)("");
|
|
706
|
+
const [tags, setTags] = (0, react.useState)(resume !== void 0 && resume.tags !== "none");
|
|
707
|
+
const [scope, setScope] = (0, react.useState)(resume?.tags === "follow" ? "follow" : "all");
|
|
708
|
+
const [pushError, setPushError] = (0, react.useState)(resume?.error ?? null);
|
|
709
|
+
const [sending, setSending] = (0, react.useState)(false);
|
|
710
|
+
const sendingRef = (0, react.useRef)(false);
|
|
711
|
+
/** The destination of the failed push, applied once, when the first plan
|
|
712
|
+
* arrives; every later plan (a refresh) is the repository's own again. */
|
|
713
|
+
const resumeDestination = (0, react.useRef)(resume === void 0 ? void 0 : {
|
|
714
|
+
remote: resume.remote,
|
|
715
|
+
target: resume.target
|
|
716
|
+
});
|
|
717
|
+
/** A destination whose local snapshot is already on screen: the next
|
|
718
|
+
* preview round for exactly that destination skips re-reading it. */
|
|
719
|
+
const keepLocalFor = (0, react.useRef)(null);
|
|
720
|
+
const anchor = (0, react.useRef)(null);
|
|
721
|
+
const mapping = (0, react.useRef)(null);
|
|
722
|
+
const editor = (0, react.useRef)(null);
|
|
723
|
+
const input = (0, react.useRef)(null);
|
|
724
|
+
const targetButton = (0, react.useRef)(null);
|
|
725
|
+
(0, react.useEffect)(() => {
|
|
726
|
+
let active = true;
|
|
727
|
+
setPlanError(null);
|
|
728
|
+
requestPushPlan(repoPath, branch).then((result) => {
|
|
729
|
+
if (!active) return;
|
|
730
|
+
if (!result.ok) {
|
|
731
|
+
setPlanError(result.error);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const planned = {
|
|
735
|
+
remote: result.remote,
|
|
736
|
+
target: result.target
|
|
737
|
+
};
|
|
738
|
+
const resumed = resumeDestination.current;
|
|
739
|
+
resumeDestination.current = void 0;
|
|
740
|
+
const next = resumed !== void 0 && result.remotes.includes(resumed.remote) && (resumed.remote !== planned.remote || resumed.target !== planned.target) ? resumed : planned;
|
|
741
|
+
setPlan(result);
|
|
742
|
+
if (result.local !== void 0 && next === planned) {
|
|
743
|
+
keepLocalFor.current = next;
|
|
744
|
+
setLocalState({
|
|
745
|
+
destination: next,
|
|
746
|
+
data: result.local
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
setDestination(next);
|
|
750
|
+
});
|
|
751
|
+
return () => {
|
|
752
|
+
active = false;
|
|
753
|
+
};
|
|
754
|
+
}, [
|
|
755
|
+
repoPath,
|
|
756
|
+
branch,
|
|
757
|
+
planRetry
|
|
758
|
+
]);
|
|
759
|
+
(0, react.useEffect)(() => {
|
|
760
|
+
if (destination === null) return;
|
|
761
|
+
let active = true;
|
|
762
|
+
setPreviewState({ destination });
|
|
763
|
+
if (keepLocalFor.current === destination) keepLocalFor.current = null;
|
|
764
|
+
else {
|
|
765
|
+
setLocalState(null);
|
|
766
|
+
requestPushPreview({
|
|
767
|
+
repoPath,
|
|
768
|
+
branch,
|
|
769
|
+
...destination,
|
|
770
|
+
localOnly: true
|
|
771
|
+
}).then((result) => {
|
|
772
|
+
if (active && result.ok) setLocalState({
|
|
773
|
+
destination,
|
|
774
|
+
data: result
|
|
775
|
+
});
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
requestPushPreview({
|
|
779
|
+
repoPath,
|
|
780
|
+
branch,
|
|
781
|
+
...destination
|
|
782
|
+
}).then((result) => {
|
|
783
|
+
if (!active) return;
|
|
784
|
+
setPreviewState(result.ok ? {
|
|
785
|
+
destination,
|
|
786
|
+
data: result
|
|
787
|
+
} : {
|
|
788
|
+
destination,
|
|
789
|
+
error: result.error
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
return () => {
|
|
793
|
+
active = false;
|
|
794
|
+
};
|
|
795
|
+
}, [
|
|
796
|
+
repoPath,
|
|
797
|
+
branch,
|
|
798
|
+
destination,
|
|
799
|
+
retry
|
|
800
|
+
]);
|
|
801
|
+
(0, react.useEffect)(() => {
|
|
802
|
+
if (!editing) return;
|
|
803
|
+
input.current?.focus();
|
|
804
|
+
input.current?.select();
|
|
805
|
+
}, [editing]);
|
|
806
|
+
(0, react.useLayoutEffect)(() => {
|
|
807
|
+
if (!editing) {
|
|
808
|
+
setAlignEnd(false);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
const box = editor.current?.getBoundingClientRect();
|
|
812
|
+
const bound = mapping.current?.getBoundingClientRect();
|
|
813
|
+
if (box !== void 0 && bound !== void 0) setAlignEnd(box.right > bound.right + .5);
|
|
814
|
+
}, [editing]);
|
|
815
|
+
(0, react.useEffect)(() => {
|
|
816
|
+
const onClick = (event) => {
|
|
817
|
+
swallowMaskClick(event, anchor.current);
|
|
818
|
+
};
|
|
819
|
+
window.addEventListener("click", onClick, true);
|
|
820
|
+
return () => {
|
|
821
|
+
window.removeEventListener("click", onClick, true);
|
|
822
|
+
};
|
|
823
|
+
}, []);
|
|
824
|
+
const current = previewState?.destination === destination ? previewState : null;
|
|
825
|
+
const preview = current?.data;
|
|
826
|
+
const displayPreview = preview ?? (localState?.destination === destination ? localState.data : void 0);
|
|
827
|
+
const knownTotal = branchInfo?.kind === "local" && branchInfo.name === branch && branchInfo.upstream !== void 0 && !branchInfo.upstreamGone && (destination === null || branchInfo.upstream === `${destination.remote}/${destination.target}`) ? branchInfo.ahead ?? 0 : void 0;
|
|
828
|
+
const checking = destination !== null && preview === void 0 && current?.error === void 0 && planError === null;
|
|
829
|
+
const disabled = busy || sending;
|
|
830
|
+
const error = pushError ?? current?.error ?? planError;
|
|
831
|
+
const failure = error === null ? null : classifyPushFailure(error);
|
|
832
|
+
const canPush = !disabled && !editing && preview !== void 0 && destination !== null;
|
|
833
|
+
const nothingToPush = preview !== void 0 && preview.targetOid !== null && preview.total === 0 && !tags;
|
|
834
|
+
const pushTitle = !canPush && checking ? t("pushCheckingRemote") : nothingToPush ? t("pushEmpty") : void 0;
|
|
835
|
+
const draftIssue = branchNameIssue(draft.trim());
|
|
836
|
+
const commits = (n) => t(n === 1 ? "pushCommitCount.one" : "pushCommitCount.other", { n });
|
|
837
|
+
const close = () => {
|
|
838
|
+
if (!disabled && !sendingRef.current) onClose();
|
|
839
|
+
};
|
|
840
|
+
const refresh = () => {
|
|
841
|
+
if (disabled) return;
|
|
842
|
+
setPushError(null);
|
|
843
|
+
setPreviewState(null);
|
|
844
|
+
setLocalState(null);
|
|
845
|
+
keepLocalFor.current = null;
|
|
846
|
+
if (plan === null) setPlanRetry((value) => value + 1);
|
|
847
|
+
else setRetry((value) => value + 1);
|
|
848
|
+
};
|
|
849
|
+
/** A new object re-reads the destination from the remote, so an unchanged
|
|
850
|
+
* choice (same remote re-picked, same name re-applied) must not make one. */
|
|
851
|
+
const changeDestination = (next) => {
|
|
852
|
+
if (destination !== null && destination.remote === next.remote && destination.target === next.target) return;
|
|
853
|
+
setPushError(null);
|
|
854
|
+
setDestination(next);
|
|
855
|
+
};
|
|
856
|
+
const applyTarget = () => {
|
|
857
|
+
const target = draft.trim();
|
|
858
|
+
if (destination === null || branchNameIssue(target) !== null) return;
|
|
859
|
+
changeDestination({
|
|
860
|
+
...destination,
|
|
861
|
+
target
|
|
862
|
+
});
|
|
863
|
+
setEditing(false);
|
|
864
|
+
targetButton.current?.focus();
|
|
865
|
+
};
|
|
866
|
+
const closeEditor = () => {
|
|
867
|
+
setEditing(false);
|
|
868
|
+
targetButton.current?.focus();
|
|
869
|
+
};
|
|
870
|
+
const submit = async (force) => {
|
|
871
|
+
if (!canPush || sendingRef.current || preview === void 0 || destination === null) return;
|
|
872
|
+
sendingRef.current = true;
|
|
873
|
+
setSending(true);
|
|
874
|
+
setMenu(null);
|
|
875
|
+
setPushError(null);
|
|
876
|
+
try {
|
|
877
|
+
const failed = await onPush({
|
|
878
|
+
...destination,
|
|
879
|
+
tags: tags ? scope : "none",
|
|
880
|
+
force,
|
|
881
|
+
sourceOid: preview.sourceOid,
|
|
882
|
+
...force ? { expectedTarget: preview.targetOid ?? "" } : {}
|
|
883
|
+
});
|
|
884
|
+
if (failed !== void 0) {
|
|
885
|
+
setPushError(failed);
|
|
886
|
+
if (classifyPushFailure(failed) !== "auth") {
|
|
887
|
+
keepLocalFor.current = destination;
|
|
888
|
+
setRetry((value) => value + 1);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
} catch (cause) {
|
|
892
|
+
setPushError(cause instanceof Error ? cause.message : String(cause));
|
|
893
|
+
} finally {
|
|
894
|
+
sendingRef.current = false;
|
|
895
|
+
setSending(false);
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
899
|
+
open: true,
|
|
900
|
+
headless: true,
|
|
901
|
+
title: `${t("pushTitle")} · ${repoName}`,
|
|
902
|
+
onClose: close,
|
|
903
|
+
className: PushDialog_module_default.dialog ?? "",
|
|
904
|
+
onKeyDownCapture: (event) => {
|
|
905
|
+
if (event.key === "Escape" && editing) {
|
|
906
|
+
event.preventDefault();
|
|
907
|
+
event.stopPropagation();
|
|
908
|
+
closeEditor();
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
913
|
+
className: PushDialog_module_default.header,
|
|
914
|
+
ref: anchor,
|
|
915
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", { children: [
|
|
916
|
+
t("pushTitle"),
|
|
917
|
+
" ",
|
|
918
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["· ", repoName] })
|
|
919
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
920
|
+
type: "button",
|
|
921
|
+
className: PushDialog_module_default.close,
|
|
922
|
+
"aria-label": t("close"),
|
|
923
|
+
disabled,
|
|
924
|
+
onClick: close,
|
|
925
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 })
|
|
926
|
+
})]
|
|
927
|
+
}),
|
|
928
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
929
|
+
className: PushDialog_module_default.body,
|
|
930
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
931
|
+
className: PushDialog_module_default.mapping,
|
|
932
|
+
ref: mapping,
|
|
933
|
+
children: [
|
|
934
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 }),
|
|
935
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
936
|
+
className: PushDialog_module_default.source,
|
|
937
|
+
title: branch,
|
|
938
|
+
children: branch
|
|
939
|
+
}),
|
|
940
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
941
|
+
className: PushDialog_module_default.arrow,
|
|
942
|
+
children: "→"
|
|
943
|
+
}),
|
|
944
|
+
destination !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
945
|
+
className: PushDialog_module_default.destination,
|
|
946
|
+
children: [
|
|
947
|
+
plan !== null && plan.remotes.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
948
|
+
open: menu === "remote",
|
|
949
|
+
dense: true,
|
|
950
|
+
portal: true,
|
|
951
|
+
autoFocus: true,
|
|
952
|
+
onClose: () => {
|
|
953
|
+
setMenu(null);
|
|
954
|
+
},
|
|
955
|
+
selectedId: destination.remote,
|
|
956
|
+
items: plan.remotes.map((remote) => ({
|
|
957
|
+
id: remote,
|
|
958
|
+
label: remote
|
|
959
|
+
})),
|
|
960
|
+
onSelect: (remote) => {
|
|
961
|
+
setMenu(null);
|
|
962
|
+
changeDestination({
|
|
963
|
+
...destination,
|
|
964
|
+
remote
|
|
965
|
+
});
|
|
966
|
+
},
|
|
967
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
968
|
+
type: "button",
|
|
969
|
+
className: PushDialog_module_default.textButton,
|
|
970
|
+
disabled: disabled || editing,
|
|
971
|
+
"aria-haspopup": "menu",
|
|
972
|
+
"aria-expanded": menu === "remote",
|
|
973
|
+
onClick: () => {
|
|
974
|
+
setMenu(menu === "remote" ? null : "remote");
|
|
975
|
+
},
|
|
976
|
+
children: [destination.remote, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})]
|
|
977
|
+
})
|
|
978
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
979
|
+
className: PushDialog_module_default.remote,
|
|
980
|
+
children: destination.remote
|
|
981
|
+
}),
|
|
982
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
983
|
+
className: PushDialog_module_default.arrow,
|
|
984
|
+
children: ":"
|
|
985
|
+
}),
|
|
986
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
987
|
+
className: PushDialog_module_default.targetWrap,
|
|
988
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
989
|
+
type: "button",
|
|
990
|
+
ref: targetButton,
|
|
991
|
+
className: PushDialog_module_default.textButton,
|
|
992
|
+
disabled,
|
|
993
|
+
title: t("pushEditTarget"),
|
|
994
|
+
"aria-haspopup": "dialog",
|
|
995
|
+
"aria-expanded": editing,
|
|
996
|
+
onClick: () => {
|
|
997
|
+
setMenu(null);
|
|
998
|
+
setDraft(destination.target);
|
|
999
|
+
setEditing((value) => !value);
|
|
1000
|
+
},
|
|
1001
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1002
|
+
className: PushDialog_module_default.targetName,
|
|
1003
|
+
title: destination.target,
|
|
1004
|
+
children: destination.target
|
|
1005
|
+
})
|
|
1006
|
+
}), editing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1007
|
+
className: `${PushDialog_module_default.editor} ${alignEnd ? PushDialog_module_default.editorEnd : ""}`,
|
|
1008
|
+
ref: editor,
|
|
1009
|
+
role: "dialog",
|
|
1010
|
+
"aria-label": t("pushEditTarget"),
|
|
1011
|
+
children: [
|
|
1012
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1013
|
+
className: PushDialog_module_default.editorHead,
|
|
1014
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1015
|
+
htmlFor: "git-worktree-push-target",
|
|
1016
|
+
children: t("pushBranch")
|
|
1017
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1018
|
+
type: "button",
|
|
1019
|
+
className: PushDialog_module_default.editorClose,
|
|
1020
|
+
"aria-label": t("pushEditTargetClose"),
|
|
1021
|
+
title: t("pushEditTargetClose"),
|
|
1022
|
+
onClick: closeEditor,
|
|
1023
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 12 })
|
|
1024
|
+
})]
|
|
1025
|
+
}),
|
|
1026
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1027
|
+
id: "git-worktree-push-target",
|
|
1028
|
+
ref: input,
|
|
1029
|
+
value: draft,
|
|
1030
|
+
spellCheck: false,
|
|
1031
|
+
autoComplete: "off",
|
|
1032
|
+
"aria-invalid": draftIssue !== null && draftIssue !== "empty",
|
|
1033
|
+
onChange: (event) => {
|
|
1034
|
+
setDraft(event.target.value);
|
|
1035
|
+
},
|
|
1036
|
+
onKeyDown: (event) => {
|
|
1037
|
+
if (event.key !== "Enter" || event.nativeEvent.isComposing) return;
|
|
1038
|
+
event.preventDefault();
|
|
1039
|
+
event.stopPropagation();
|
|
1040
|
+
applyTarget();
|
|
1041
|
+
}
|
|
1042
|
+
}),
|
|
1043
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1044
|
+
className: PushDialog_module_default.hint,
|
|
1045
|
+
children: draftIssue === null || draftIssue === "empty" ? t("pushApplyEnter") : t("menuNewBranchBad")
|
|
1046
|
+
})
|
|
1047
|
+
]
|
|
1048
|
+
})]
|
|
1049
|
+
})
|
|
1050
|
+
]
|
|
1051
|
+
}),
|
|
1052
|
+
preview?.targetOid === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1053
|
+
className: PushDialog_module_default.badge,
|
|
1054
|
+
children: t("pushNew")
|
|
1055
|
+
})
|
|
1056
|
+
]
|
|
1057
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1058
|
+
className: PushDialog_module_default.commits,
|
|
1059
|
+
"aria-busy": displayPreview === void 0 && error === null,
|
|
1060
|
+
children: [
|
|
1061
|
+
displayPreview === void 0 && knownTotal !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1062
|
+
className: PushDialog_module_default.count,
|
|
1063
|
+
children: [destination === null ? t(knownTotal === 1 ? "aheadTitle.one" : "aheadTitle.other", { n: knownTotal }) : commits(knownTotal), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1064
|
+
className: PushDialog_module_default.previewStatus,
|
|
1065
|
+
role: "status",
|
|
1066
|
+
children: t(error === null ? "pushReadingCommits" : "pushLocalUnverified")
|
|
1067
|
+
})]
|
|
1068
|
+
}),
|
|
1069
|
+
displayPreview === void 0 && knownTotal === void 0 && error === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1070
|
+
className: PushDialog_module_default.empty,
|
|
1071
|
+
role: "status",
|
|
1072
|
+
children: t(checking ? "pushCheckingRemote" : "pushPlanning")
|
|
1073
|
+
}),
|
|
1074
|
+
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1075
|
+
className: PushDialog_module_default.error,
|
|
1076
|
+
role: "alert",
|
|
1077
|
+
children: [failure !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1078
|
+
className: PushDialog_module_default.errorSummary,
|
|
1079
|
+
children: t(FAILURE_KEYS[failure])
|
|
1080
|
+
}), (failure === null || showsGitOutput(failure)) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1081
|
+
className: failure === null ? void 0 : PushDialog_module_default.errorDetail,
|
|
1082
|
+
children: gitOutput(error)
|
|
1083
|
+
})]
|
|
1084
|
+
}),
|
|
1085
|
+
displayPreview !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1086
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1087
|
+
className: PushDialog_module_default.count,
|
|
1088
|
+
children: [commits(displayPreview.total), preview === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1089
|
+
className: PushDialog_module_default.previewStatus,
|
|
1090
|
+
role: "status",
|
|
1091
|
+
children: t(checking ? "pushLocalChecking" : "pushLocalUnverified")
|
|
1092
|
+
})]
|
|
1093
|
+
}),
|
|
1094
|
+
displayPreview.commits.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1095
|
+
className: PushDialog_module_default.empty,
|
|
1096
|
+
children: t(preview === void 0 ? "pushLocalEmpty" : preview.targetOid === null ? "pushNewEmpty" : "pushEmpty")
|
|
1097
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1098
|
+
className: PushDialog_module_default.list,
|
|
1099
|
+
tabIndex: 0,
|
|
1100
|
+
"aria-label": t("pushCommitList"),
|
|
1101
|
+
children: displayPreview.commits.map((commit) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1102
|
+
viewBox: "0 0 16 16",
|
|
1103
|
+
"aria-hidden": "true",
|
|
1104
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M1 8h4m6 0h4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1105
|
+
cx: "8",
|
|
1106
|
+
cy: "8",
|
|
1107
|
+
r: "3"
|
|
1108
|
+
})]
|
|
1109
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1110
|
+
title: commit.subject,
|
|
1111
|
+
children: commit.subject
|
|
1112
|
+
})] }, commit.oid))
|
|
1113
|
+
}),
|
|
1114
|
+
displayPreview.truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1115
|
+
className: PushDialog_module_default.hint,
|
|
1116
|
+
children: t("pushTruncated", { n: displayPreview.commits.length })
|
|
1117
|
+
})
|
|
1118
|
+
] })
|
|
1119
|
+
]
|
|
1120
|
+
})]
|
|
1121
|
+
}),
|
|
1122
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
1123
|
+
className: PushDialog_module_default.footer,
|
|
1124
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1125
|
+
className: PushDialog_module_default.tagOptions,
|
|
1126
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1127
|
+
className: PushDialog_module_default.checkbox,
|
|
1128
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1129
|
+
type: "checkbox",
|
|
1130
|
+
checked: tags,
|
|
1131
|
+
disabled,
|
|
1132
|
+
onChange: (event) => {
|
|
1133
|
+
setTags(event.target.checked);
|
|
1134
|
+
}
|
|
1135
|
+
}), t("pushTags")]
|
|
1136
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1137
|
+
open: menu === "tags",
|
|
1138
|
+
dense: true,
|
|
1139
|
+
portal: true,
|
|
1140
|
+
autoFocus: true,
|
|
1141
|
+
side: "top",
|
|
1142
|
+
selectedId: scope,
|
|
1143
|
+
onClose: () => {
|
|
1144
|
+
setMenu(null);
|
|
1145
|
+
},
|
|
1146
|
+
items: [{
|
|
1147
|
+
id: "all",
|
|
1148
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1149
|
+
title: t("pushTagsAllHint"),
|
|
1150
|
+
children: t("pushTagsAll")
|
|
1151
|
+
})
|
|
1152
|
+
}, {
|
|
1153
|
+
id: "follow",
|
|
1154
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1155
|
+
title: t("pushTagsFollowHint"),
|
|
1156
|
+
children: t("pushTagsFollow")
|
|
1157
|
+
})
|
|
1158
|
+
}],
|
|
1159
|
+
onSelect: (id) => {
|
|
1160
|
+
setScope(id);
|
|
1161
|
+
setMenu(null);
|
|
1162
|
+
},
|
|
1163
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1164
|
+
type: "button",
|
|
1165
|
+
className: PushDialog_module_default.scope,
|
|
1166
|
+
disabled: disabled || !tags,
|
|
1167
|
+
"aria-haspopup": "menu",
|
|
1168
|
+
"aria-expanded": menu === "tags",
|
|
1169
|
+
title: t(scope === "all" ? "pushTagsAllHint" : "pushTagsFollowHint"),
|
|
1170
|
+
onClick: () => {
|
|
1171
|
+
setMenu(menu === "tags" ? null : "tags");
|
|
1172
|
+
},
|
|
1173
|
+
children: [t(scope === "all" ? "pushTagsAll" : "pushTagsFollow"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})]
|
|
1174
|
+
})
|
|
1175
|
+
})]
|
|
1176
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1177
|
+
className: PushDialog_module_default.actions,
|
|
1178
|
+
children: [
|
|
1179
|
+
(error !== null || plan !== null) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1180
|
+
type: "button",
|
|
1181
|
+
className: PushDialog_module_default.refresh,
|
|
1182
|
+
disabled: disabled || editing,
|
|
1183
|
+
title: t("pushRefresh"),
|
|
1184
|
+
"aria-label": t("pushRefresh"),
|
|
1185
|
+
onClick: refresh,
|
|
1186
|
+
children: "↻"
|
|
1187
|
+
}),
|
|
1188
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1189
|
+
size: "sm",
|
|
1190
|
+
variant: "ghost",
|
|
1191
|
+
disabled,
|
|
1192
|
+
onClick: close,
|
|
1193
|
+
children: t("actionCancel")
|
|
1194
|
+
}),
|
|
1195
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1196
|
+
open: menu === "push",
|
|
1197
|
+
dense: true,
|
|
1198
|
+
portal: true,
|
|
1199
|
+
autoFocus: true,
|
|
1200
|
+
side: "top",
|
|
1201
|
+
align: "end",
|
|
1202
|
+
onClose: () => {
|
|
1203
|
+
setMenu(null);
|
|
1204
|
+
},
|
|
1205
|
+
items: [{
|
|
1206
|
+
id: "force",
|
|
1207
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1208
|
+
title: t("pushForceHint"),
|
|
1209
|
+
children: t("pushForce")
|
|
1210
|
+
}),
|
|
1211
|
+
disabled: !canPush
|
|
1212
|
+
}],
|
|
1213
|
+
onSelect: () => {
|
|
1214
|
+
submit(true);
|
|
1215
|
+
},
|
|
1216
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1217
|
+
className: PushDialog_module_default.split,
|
|
1218
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1219
|
+
type: "button",
|
|
1220
|
+
className: PushDialog_module_default.push,
|
|
1221
|
+
"data-modal-autofocus": true,
|
|
1222
|
+
disabled: !canPush || nothingToPush,
|
|
1223
|
+
...pushTitle === void 0 ? {} : { title: pushTitle },
|
|
1224
|
+
onClick: () => {
|
|
1225
|
+
submit(false);
|
|
1226
|
+
},
|
|
1227
|
+
children: t(disabled ? "pushBusy" : "ctxPush")
|
|
1228
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1229
|
+
type: "button",
|
|
1230
|
+
className: PushDialog_module_default.splitArrow,
|
|
1231
|
+
disabled: !canPush,
|
|
1232
|
+
"aria-label": t("pushOptions"),
|
|
1233
|
+
"aria-haspopup": "menu",
|
|
1234
|
+
"aria-expanded": menu === "push",
|
|
1235
|
+
onClick: () => {
|
|
1236
|
+
setMenu(menu === "push" ? null : "push");
|
|
1237
|
+
},
|
|
1238
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})
|
|
1239
|
+
})]
|
|
1240
|
+
})
|
|
1241
|
+
})
|
|
1242
|
+
]
|
|
1243
|
+
})]
|
|
1244
|
+
})
|
|
1245
|
+
]
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
459
1249
|
//#region src/client/branch-tree.ts
|
|
460
1250
|
/** Segment order: natural (so `v2` precedes `v10`) and case-blind. */
|
|
461
1251
|
const segCmp = (a, b) => a.localeCompare(b, void 0, {
|
|
@@ -574,6 +1364,53 @@ window.__ModuleLoader__.load({
|
|
|
574
1364
|
}
|
|
575
1365
|
return set;
|
|
576
1366
|
}
|
|
1367
|
+
/**
|
|
1368
|
+
* @param row - the row being rendered.
|
|
1369
|
+
* @param hasRemotes - whether the repository has any remote at all; without
|
|
1370
|
+
* one every branch would read "unpublished", which is noise, not news.
|
|
1371
|
+
* @returns the marks to show, or null for none.
|
|
1372
|
+
*/
|
|
1373
|
+
function syncMark(row, hasRemotes) {
|
|
1374
|
+
if (row.kind === "remote") return null;
|
|
1375
|
+
if (row.upstreamGone === true) return {
|
|
1376
|
+
kind: "gone",
|
|
1377
|
+
upstream: row.upstream ?? ""
|
|
1378
|
+
};
|
|
1379
|
+
const outgoing = row.upstream === void 0 ? hasRemotes ? "unpublished" : null : (row.ahead ?? 0) > 0 ? row.ahead ?? 0 : null;
|
|
1380
|
+
const incoming = (row.behind ?? 0) > 0 ? row.behind ?? 0 : null;
|
|
1381
|
+
return outgoing === null && incoming === null ? null : {
|
|
1382
|
+
kind: "diverged",
|
|
1383
|
+
outgoing,
|
|
1384
|
+
incoming
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Whether the repository has any remote, judged from the branch list the
|
|
1389
|
+
* status call already carries (a remote-tracking ref, or a local branch that
|
|
1390
|
+
* names an upstream). No extra git process: `/status` stays as cheap as ever.
|
|
1391
|
+
* A remote added but never fetched and not yet tracked by anything reads as
|
|
1392
|
+
* "none" until its first fetch or push — the context-menu Push is unaffected.
|
|
1393
|
+
* @param branches - every branch entry of the repository, local and remote.
|
|
1394
|
+
* @returns true when at least one remote is evident.
|
|
1395
|
+
*/
|
|
1396
|
+
function repoHasRemotes(branches) {
|
|
1397
|
+
return branches.some((branch) => branch.kind === "remote" || branch.upstream !== void 0);
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* The remote-facing verbs a branch row's context menu offers. Where each one
|
|
1401
|
+
* sits in the menu is the menu's call (Update directly above Push, both ahead
|
|
1402
|
+
* of the rename/delete block); this only says which are available.
|
|
1403
|
+
* Push needs no checkout, so every local and worktree row has it; Update is
|
|
1404
|
+
* fetch + fast-forward of the CURRENT checkout only, and only when there is
|
|
1405
|
+
* a live upstream to fast-forward to.
|
|
1406
|
+
* @param row - the right-clicked row.
|
|
1407
|
+
* @param currentBranch - the branch this session's directory has checked out.
|
|
1408
|
+
* @returns the verb ids, empty for a remote row.
|
|
1409
|
+
*/
|
|
1410
|
+
function syncActions(row, currentBranch) {
|
|
1411
|
+
if (row.kind === "remote") return [];
|
|
1412
|
+
return row.name === currentBranch && row.upstream !== void 0 && row.upstreamGone !== true ? ["push", "update"] : ["push"];
|
|
1413
|
+
}
|
|
577
1414
|
//#endregion
|
|
578
1415
|
//#region src/client/branch-keyboard.ts
|
|
579
1416
|
/** Check if the event represents a context-menu trigger (ContextMenu key or Shift+F10). */
|
|
@@ -641,13 +1478,13 @@ window.__ModuleLoader__.load({
|
|
|
641
1478
|
}
|
|
642
1479
|
//#endregion
|
|
643
1480
|
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\BranchChip.module.css?inline
|
|
644
|
-
const css$2 = "/* Branch chip row inside the composer tool row (conversation.input_2006230319.left_2006230319,\n * right of the mode chips). A single chip button: the branch picker (the\n * worktree toggle that used to share this dock is gone — worktree actions\n * live in the branch menu's right-click).\n *\n * Geometry mirrors the composer trigger chips in the DSH base (see\n * PermissionSelect / ModelSelect): 28px height, 13/20 medium-secondary\n * label, transparent fill, no outline — the dock stays at the same\n * visual weight as the surrounding chips (dsh-worktree select, standard\n * mode select, Workspace Write, MiniMax-M3 High). The corners stop short\n * of the base's full pill (24px) so the silhouette stays a chip rather\n * than a capsule, per the design brief. */\n\n/* Shared trigger geometry — copied 1:1 from the base composer triggers\n * (PermissionSelect .trigger_2006230319 / ModelSelect .trigger_2006230319). */\n.dock_2006230319 {\n display: inline-flex;\n align-items: stretch;\n height: 28px;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n min-height: 28px;\n overflow: hidden;\n}\n\n.chip_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 8px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.chip_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.branch_2006230319 {\n max-width: 16em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Confirm flyout: the second-level panel opening right of the branch\n * card (the base Menu's submenu posture: r20, elevation-prominent\n * hairline, --dsw-specific-menu with --dsw-menu-backdrop-filter — host 0.1.2 Menu card;\n * hosts without the token fall back to the old r12-era shadow-lv3). Width is content-driven — it follows\n * the longest line (for remote picks that is the subject line's branch\n * name) — floored at 168px (the Cancel/Confirm pair plus padding: short\n * branch names must not squeeze the buttons into wrapping \"切换中…\"\n * mid-word) and capped at 400px; BranchMenu also clamps it inline to the\n * room right of the card. Beyond the cap the lines wrap. border-box so\n * every width arm includes the card chrome. */\n.popCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n width: max-content;\n min-width: 168px;\n max-width: min(400px, 80vw);\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Elevation-prominent carries the hairline stroke; the lv3 fallback\n * keeps a shadow where the token does not exist. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.popAsk_2006230319 {\n margin: 0;\n padding: 6px 8px;\n font-size: 13px;\n line-height: 20px;\n color: inherit;\n /* Branch names are long unbroken tokens — plain wrapping would let them\n * overflow the capped card instead of breaking. */\n overflow-wrap: anywhere;\n}\n\n/* Remote confirm's name line: the branch itself, weight 500 like the leaf\n * rows — the subject the ask line refers to (\"该远程分支\"). A dedicated\n * line keeps the long unbroken token away from the sentence, so wraps\n * happen inside the name instead of shredding the Chinese around it. */\n.popSubject_2006230319 {\n margin: 0;\n padding: 0 8px 2px;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: inherit;\n overflow-wrap: anywhere;\n}\n\n/* The removal confirm's consequence lines (dirty/ahead/archived sessions):\n * subdued one-row facts under the ask, the dirty count alone in the warning\n * tone — mirroring the manager dialog's fact block. */\n.popDetails_2006230319 {\n padding: 0 8px 2px;\n}\n\n.popDetail_2006230319 {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary, rgba(128, 128, 128, 0.9));\n overflow-wrap: anywhere;\n}\n\n.popDetailWarn_2006230319 {\n color: var(--dsw-alias-status-danger, #d5304f);\n}\n\n.popActions_2006230319 {\n display: flex;\n gap: 2px;\n padding: 2px;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * nowrap keeps labels like 切换中… from splitting mid-word when the flyout\n * is pinned to its minimum width by a short branch name. */\n.popActions_2006230319 button {\n flex: 1 1 0;\n height: 28px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.popActions_2006230319 button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.popActions_2006230319 button:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.popActions_2006230319 button:last-child {\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n font-weight: 500;\n}\n\n/* ── Branch picker popup (BranchMenu) ──────────────────────────────\n * Upward-opening card pinned above the chip, in the Menu's card chrome\n * (r20, elevation-prominent hairline, --dsw-specific-menu with\n * --dsw-menu-backdrop-filter — host Menu/PermissionSelect card;\n * hosts without the token fall back to shadow-lv3). Three owner requirements shape the geometry:\n *\n * 1. height cap: min(420px, 60vh) on the card, only the rows area\n * scrolls (.menuRows_2006230319) — heading and search stay pinned;\n * 2. the search field sits pinned at the card's bottom edge, directly\n * above the chip, with the scrolling rows above it;\n * 3. the card is CSS-`bottom`-pinned ~6px above the chip's top and so\n * grows entirely upward — it can never cover the composer or fill\n * the viewport, whatever the branch count.\n *\n * The inline `left`/`bottom` come from BranchMenu's placement pass; the\n * width is fixed here (design 360px — 320 tree + 40 tool strip — and\n * viewport-capped) so horizontal clamping stays deterministic without\n * measuring the card. */\n\n/* The portal lands directly under document.body_2006230319, outside the shell's\n * box-sizing reset — content-box default would add padding/border on top\n * of the declared width (360 became 370, and the width:100% children\n * padded 16px past the card's right clip, shearing off their rounded\n * corners). Every width-declared box in this popup opts back into\n * border-box: the card, the toolbar, the rows, and the search input. */\n.menuCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n display: flex;\n flex-direction: row;\n width: min(360px, calc(100vw - 24px));\n max-height: min(420px, 60vh);\n overflow: hidden;\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Same elevation card as .popCard_2006230319 (host 0.1.2 Menu); lv3 fallback\n * for hosts without the token. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n/* Left tool strip (IDEA branch-panel posture at popup scale): a narrow\n * column of icon-only buttons for actions that do not belong in the tree\n * — locate the checked-out branch, expand/collapse the whole tree.\n * Buttons stack from the BOTTOM up: the card's height shrinks when the\n * repo has few branches, so a top-anchored strip would drift around and\n * the buttons would sit far from the search bar; anchoring to the bottom\n * pins them at a stable spot (beside the search row) whatever the height. */\n.menuToolbar_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n gap: 2px;\n flex-shrink: 0;\n width: 32px;\n padding: 0 2px;\n margin-right: 4px;\n border-right: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuToolButton_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n margin: 0 auto;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n\n.menuToolButton_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuToolButton_2006230319:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* The sync tools while their action runs: a soft opacity pulse. The glyph\n * is a directional arrow, so the circular-refresh spin read as garbled\n * rotation — pulsing keeps the arrow legible while clearly \"live\", and the\n * button keeps full opacity (the usual disabled dim would read as broken\n * for an in-flight network operation). */\n.menuToolButtonRunning_2006230319 svg {\n animation: menuToolPulse 700ms ease-in-out infinite alternate;\n}\n\n.menuToolButtonRunning_2006230319:disabled {\n opacity: 1;\n cursor: progress;\n}\n\n@keyframes menuToolPulse {\n from { opacity: 1; }\n to { opacity: 0.25; }\n}\n\n/* The main column: heading + scrollable rows + pinned search. */\n.menuMain_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Non-interactive group heading — the Menu label row's posture. */\n.menuHeading_2006230319 {\n padding: 6px 8px 4px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n\n/* The only scrollable region: shrinks within the capped card so the\n * heading above and the search below stay visible while rows scroll. */\n.menuRows_2006230319 {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * Weight 500 mirrors the chip's branch label (the portal escapes the\n * composer's font context, so the match must be explicit — the inherited\n * body weight is 400 and reads visibly lighter than the chip beside it). */\n.menuRow_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside .menuRows_2006230319 */\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuRow_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The checked-out branch: a persistent tint a step above the resting rows\n * so it reads as \"you are here\" the moment the list scrolls it into view\n * (BranchMenu centers it on open) — the trailing check alone is easy to\n * miss from a distance. */\n.menuRowSelected_2006230319,\n.menuRowSelected_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, currentColor 10%, transparent);\n}\n\n/* IDEA-style selection: the clicked row gets a bluish fill, layering over\n * the HEAD tint when the same row is both — selection communicates intent,\n * the HEAD tint communicates position, and they coexist (IDEA 4.4). */\n.menuRowPicked_2006230319,\n.menuRowPicked_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n}\n\n.menuRowLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Upstream divergence arrows (↑N/↓N) trailing a local branch row, before\n * the HEAD check: the count badge tone at a smaller size so a busy list\n * still reads the name first. Plain text arrows — no base-set icon pairs\n * a direction with a count. tabular-nums keeps ↑10 from nudging neighbors\n * as the digits tick. */\n.menuRowArrow_2006230319 {\n flex-shrink: 0;\n font-size: 11px;\n line-height: 20px;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Search hit highlight (IDEA): the matched substring gets a warm tint\n * behind it — theme-agnostic, legible in both light and dark cards. */\n.menuSearchMark_2006230319 {\n background: color-mix(in srgb, #b58900 38%, transparent);\n border-radius: 2px;\n}\n\n/* Tree group rows (folder headers) — BranchMenu's '/' prefix tree: the\n * same row geometry as .menuRow_2006230319, but labeled in the secondary tone so the\n * leaf rows pop, with a count badge and a chevron that turns on expand. */\n.menuGroup_2006230319 {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuGroup_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The two top-level section headers (local/remote branches) step ABOVE the\n * folder headers they contain: primary label tone like the leaf rows plus\n * a heavier weight, so the nav hierarchy reads group > row > folder — the\n * folder headers keep the secondary tone that alone would leave the\n * sections as the faintest (and most important) rows on the list. */\n.menuGroupTop_2006230319 {\n color: inherit;\n font-weight: 600;\n}\n\n.menuGroupLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.menuGroupChevron_2006230319 {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n transition: transform 120ms ease;\n}\n\n.menuGroupChevronOpen_2006230319 {\n transform: rotate(90deg);\n}\n\n.menuGroupCount_2006230319 {\n flex-shrink: 0;\n font-size: 12px;\n line-height: 20px;\n font-weight: 400;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Zero-search-hit state: centered secondary line inside the rows area. */\n.menuEmpty_2006230319 {\n padding: 10px 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n text-align: center;\n}\n\n/* Bottom-pinned search field, separated from the rows by a hairline.\n * Borderless so it reads as part of the card, focus shown as the\n * standard hover tint rather than an outline. */\n.menuSearchWrap_2006230319 {\n flex-shrink: 0;\n margin-top: 2px;\n padding-top: 4px;\n border-top: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuSearch_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside the wrap */\n width: 100%;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuRow_2006230319) — the portal\n * escapes the composer's font context and would inherit body's 400. */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuSearch_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuSearch_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* ── Create/rename flyouts (BranchMenu row context menu) ────────────\n * Open IN PLACE of the row menu (at its point, clamped) and hold the whole\n * flow in one panel: ask line, input, live hint, and the Cancel/confirm\n * pair — typing the name and pressing the button fires in one stroke, no\n * second confirm step. */\n\n/* The naming input inside the flyout: borderless, part of the card, focus\n * shown as the standard hover tint. Fixed width — the popCard is\n * max-content, so a percentage width would chase the input's own default\n * size instead of the design width. */\n.menuCreate_2006230319 {\n box-sizing: border-box;\n width: 248px;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuSearch_2006230319). */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuCreate_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuCreate_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuCreate_2006230319:disabled {\n opacity: 0.5;\n}\n\n/* The error line under the input — only rendered while the draft is\n * unacceptable with a non-empty reason; the input itself stays neutral,\n * the line carries the state. */\n.menuCreateHintBad_2006230319 {\n margin: 0;\n padding: 0 8px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-error);\n}\n\n/* ── Row context menu (BranchMenu right-click) ─────────────────────\n * Cursor-anchored transient over the branch card: translucent menu chrome\n * (--dsw-specific-menu with --dsw-menu-backdrop-filter, elevation-prominent hairline,\n * lv3 fallback) at a smaller radius — r20 would round a launcher this\n * short into a pill, r12 keeps the corners proportionate to a handful of\n * rows (two on a worktree row, up to six plus a header on a branch row).\n * Width hugs the widest item\n * (shrink-to-fit, no design width) with a generous cap for safety —\n * a launcher reads better snug than stretched. Positioned once at open\n * and dismissed rather than re-placed when the page moves (see\n * BranchMenu's ctx placement pass); z-index one step above the popCard so\n * it never slides under the confirm flyout. */\n.ctxCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1001;\n width: max-content;\n max-width: 280px;\n padding: 4px;\n border: 0;\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n/* The target row's name, above the verbs. Unlike the items this one holds\n * a branch name, so it is the one line allowed to hit the 280px cap and\n * ellipsize (the full name rides in a title). Secondary tone and no hover\n * affordance: it is a label, not a seventh item. */\n.ctxHeader_2006230319 {\n padding: 4px 8px 2px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-secondary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n/* Menu-item rows: the .menuRow_2006230319 geometry at a hair lighter weight — a\n * launcher's labels read as commands, not data. nowrap: the labels are\n * fixed copy (no branch names), the 280px cap is unreachable by design. */\n.ctxItem_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.ctxItem_2006230319:hover,\n.ctxItem_2006230319:focus-visible {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The running-session withhold (worktree removal): a disabled item stays\n * visible — the reason it is missing lives on its hover title, and a verb\n * that appears and disappears with session state reads as a bug, not a\n * rule. No hover tint, no pointer; the label dims instead of vanishing. */\n.ctxItem_2006230319:disabled {\n cursor: default;\n opacity: 0.45;\n}\n\n.ctxItem_2006230319:disabled:hover {\n background: transparent;\n}\n\n/* The arrow-key walk lands here, so the focused item must read as strongly\n * as a hovered one — the tint above carries it, the default ring would sit\n * outside the 8px radius. */\n.ctxItem_2006230319:focus-visible {\n outline: none;\n}\n\n/* Leading glyph rides the label tone, a step quieter. */\n.ctxItem_2006230319 svg {\n flex-shrink: 0;\n opacity: 0.75;\n}\n\n.ctxItemLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
|
|
645
|
-
const tagId$
|
|
646
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$
|
|
1481
|
+
const css$3 = "/* Branch chip row inside the composer tool row (conversation.input_2006230319.left_2006230319,\n * right of the mode chips). A single chip button: the branch picker (the\n * worktree toggle that used to share this dock is gone — worktree actions\n * live in the branch menu's right-click).\n *\n * Geometry mirrors the composer trigger chips in the DSH base (see\n * PermissionSelect / ModelSelect): 28px height, 13/20 medium-secondary\n * label, transparent fill, no outline — the dock stays at the same\n * visual weight as the surrounding chips (dsh-worktree select, standard\n * mode select, Workspace Write, MiniMax-M3 High). The corners stop short\n * of the base's full pill (24px) so the silhouette stays a chip rather\n * than a capsule, per the design brief. */\n\n/* Shared trigger geometry — copied 1:1 from the base composer triggers\n * (PermissionSelect .trigger_2006230319 / ModelSelect .trigger_2006230319). */\n.dock_2006230319 {\n display: inline-flex;\n align-items: stretch;\n height: 28px;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n min-height: 28px;\n overflow: hidden;\n}\n\n.chip_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 8px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.chip_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.branch_2006230319 {\n max-width: 16em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Confirm flyout: the second-level panel opening right of the branch\n * card (the base Menu's submenu posture: r20, elevation-prominent\n * hairline, --dsw-specific-menu with --dsw-menu-backdrop-filter — host 0.1.2 Menu card;\n * hosts without the token fall back to the old r12-era shadow-lv3). Width is content-driven — it follows\n * the longest line (for remote picks that is the subject line's branch\n * name) — floored at 168px (the Cancel/Confirm pair plus padding: short\n * branch names must not squeeze the buttons into wrapping \"切换中…\"\n * mid-word) and capped at 400px; BranchMenu also clamps it inline to the\n * room right of the card. Beyond the cap the lines wrap. border-box so\n * every width arm includes the card chrome. */\n.popCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n width: max-content;\n min-width: 168px;\n max-width: min(400px, 80vw);\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Elevation-prominent carries the hairline stroke; the lv3 fallback\n * keeps a shadow where the token does not exist. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.popAsk_2006230319 {\n margin: 0;\n padding: 6px 8px;\n font-size: 13px;\n line-height: 20px;\n color: inherit;\n /* Branch names are long unbroken tokens — plain wrapping would let them\n * overflow the capped card instead of breaking. */\n overflow-wrap: anywhere;\n}\n\n/* Remote confirm's name line: the branch itself, weight 500 like the leaf\n * rows — the subject the ask line refers to (\"该远程分支\"). A dedicated\n * line keeps the long unbroken token away from the sentence, so wraps\n * happen inside the name instead of shredding the Chinese around it. */\n.popSubject_2006230319 {\n margin: 0;\n padding: 0 8px 2px;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: inherit;\n overflow-wrap: anywhere;\n}\n\n/* The removal confirm's consequence lines (dirty/ahead/archived sessions):\n * subdued one-row facts under the ask, the dirty count alone in the warning\n * tone — mirroring the manager dialog's fact block. */\n.popDetails_2006230319 {\n padding: 0 8px 2px;\n}\n\n.popDetail_2006230319 {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary, rgba(128, 128, 128, 0.9));\n overflow-wrap: anywhere;\n}\n\n.popDetailWarn_2006230319 {\n color: var(--dsw-alias-status-danger, #d5304f);\n}\n\n.popActions_2006230319 {\n display: flex;\n gap: 2px;\n padding: 2px;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * nowrap keeps labels like 切换中… from splitting mid-word when the flyout\n * is pinned to its minimum width by a short branch name. */\n.popActions_2006230319 button {\n flex: 1 1 0;\n height: 28px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.popActions_2006230319 button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.popActions_2006230319 button:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.popActions_2006230319 button:last-child {\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n font-weight: 500;\n}\n\n/* ── Branch picker popup (BranchMenu) ──────────────────────────────\n * Upward-opening card pinned above the chip, in the Menu's card chrome\n * (r20, elevation-prominent hairline, --dsw-specific-menu with\n * --dsw-menu-backdrop-filter — host Menu/PermissionSelect card;\n * hosts without the token fall back to shadow-lv3). Three owner requirements shape the geometry:\n *\n * 1. height cap: min(420px, 60vh) on the card, only the rows area\n * scrolls (.menuRows_2006230319) — heading and search stay pinned;\n * 2. the search field sits pinned at the card's bottom edge, directly\n * above the chip, with the scrolling rows above it;\n * 3. the card is CSS-`bottom`-pinned ~6px above the chip's top and so\n * grows entirely upward — it can never cover the composer or fill\n * the viewport, whatever the branch count.\n *\n * The inline `left`/`bottom` come from BranchMenu's placement pass; the\n * width is fixed here (design 360px — 320 tree + 40 tool strip — and\n * viewport-capped) so horizontal clamping stays deterministic without\n * measuring the card. */\n\n/* The portal lands directly under document.body_2006230319, outside the shell's\n * box-sizing reset — content-box default would add padding/border on top\n * of the declared width (360 became 370, and the width:100% children\n * padded 16px past the card's right clip, shearing off their rounded\n * corners). Every width-declared box in this popup opts back into\n * border-box: the card, the toolbar, the rows, and the search input. */\n.menuCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n display: flex;\n flex-direction: row;\n width: min(360px, calc(100vw - 24px));\n max-height: min(420px, 60vh);\n overflow: hidden;\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Same elevation card as .popCard_2006230319 (host 0.1.2 Menu); lv3 fallback\n * for hosts without the token. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n/* Left tool strip (IDEA branch-panel posture at popup scale): a narrow\n * column of icon-only buttons for actions that do not belong in the tree\n * — locate the checked-out branch, expand/collapse the whole tree.\n * Buttons stack from the BOTTOM up: the card's height shrinks when the\n * repo has few branches, so a top-anchored strip would drift around and\n * the buttons would sit far from the search bar; anchoring to the bottom\n * pins them at a stable spot (beside the search row) whatever the height. */\n.menuToolbar_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n gap: 2px;\n flex-shrink: 0;\n width: 32px;\n padding: 0 2px;\n margin-right: 4px;\n border-right: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuToolButton_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n margin: 0 auto;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n\n.menuToolButton_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuToolButton_2006230319:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* The sync tools while their action runs: a soft opacity pulse. The glyph\n * is a directional arrow, so the circular-refresh spin read as garbled\n * rotation — pulsing keeps the arrow legible while clearly \"live\", and the\n * button keeps full opacity (the usual disabled dim would read as broken\n * for an in-flight network operation). */\n.menuToolButtonRunning_2006230319 svg {\n animation: menuToolPulse 700ms ease-in-out infinite alternate;\n}\n\n.menuToolButtonRunning_2006230319:disabled {\n opacity: 1;\n cursor: progress;\n}\n\n@keyframes menuToolPulse {\n from { opacity: 1; }\n to { opacity: 0.25; }\n}\n\n/* The main column: heading + scrollable rows + pinned search. */\n.menuMain_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Non-interactive group heading — the Menu label row's posture. */\n.menuHeading_2006230319 {\n padding: 6px 8px 4px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n\n/* The only scrollable region: shrinks within the capped card so the\n * heading above and the search below stay visible while rows scroll. */\n.menuRows_2006230319 {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * Weight 500 mirrors the chip's branch label (the portal escapes the\n * composer's font context, so the match must be explicit — the inherited\n * body weight is 400 and reads visibly lighter than the chip beside it). */\n.menuRow_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside .menuRows_2006230319 */\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuRow_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The checked-out branch: a persistent tint a step above the resting rows\n * so it reads as \"you are here\" the moment the list scrolls it into view\n * (BranchMenu centers it on open) — the trailing check alone is easy to\n * miss from a distance. */\n.menuRowSelected_2006230319,\n.menuRowSelected_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, currentColor 10%, transparent);\n}\n\n/* IDEA-style selection: the clicked row gets a bluish fill, layering over\n * the HEAD tint when the same row is both — selection communicates intent,\n * the HEAD tint communicates position, and they coexist (IDEA 4.4). */\n.menuRowPicked_2006230319,\n.menuRowPicked_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n}\n\n.menuRowLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* IDEA-style outgoing green / incoming blue marks, including unpublished refs. */\n.menuRowArrow_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n flex-shrink: 0;\n font-size: 11px;\n line-height: 20px;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n}\n\n/* Host state tokens first (they follow the active theme and keep text\n * contrast); IDEA's own hues remain the fallback where a token is absent. */\n.menuRowAhead_2006230319 { color: var(--dsw-alias-state-success-primary, #57965c); }\n.menuRowBehind_2006230319 { color: var(--dsw-alias-link, #589df6); }\n.menuRowGone_2006230319 { color: var(--dsw-alias-state-warn-primary, #b58900); }\n.menuRowOutgoing_2006230319 { display: inline-flex; transform: rotate(180deg); }\n\n/* Search hit highlight (IDEA): the matched substring gets a warm tint\n * behind it — theme-agnostic, legible in both light and dark cards. */\n.menuSearchMark_2006230319 {\n background: color-mix(in srgb, #b58900 38%, transparent);\n border-radius: 2px;\n}\n\n/* Tree group rows (folder headers) — BranchMenu's '/' prefix tree: the\n * same row geometry as .menuRow_2006230319, but labeled in the secondary tone so the\n * leaf rows pop, with a count badge and a chevron that turns on expand. */\n.menuGroup_2006230319 {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuGroup_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The two top-level section headers (local/remote branches) step ABOVE the\n * folder headers they contain: primary label tone like the leaf rows plus\n * a heavier weight, so the nav hierarchy reads group > row > folder — the\n * folder headers keep the secondary tone that alone would leave the\n * sections as the faintest (and most important) rows on the list. */\n.menuGroupTop_2006230319 {\n color: inherit;\n font-weight: 600;\n}\n\n.menuGroupLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.menuGroupChevron_2006230319 {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n transition: transform 120ms ease;\n}\n\n.menuGroupChevronOpen_2006230319 {\n transform: rotate(90deg);\n}\n\n.menuGroupCount_2006230319 {\n flex-shrink: 0;\n font-size: 12px;\n line-height: 20px;\n font-weight: 400;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Zero-search-hit state: centered secondary line inside the rows area. */\n.menuEmpty_2006230319 {\n padding: 10px 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n text-align: center;\n}\n\n/* Bottom-pinned search field, separated from the rows by a hairline.\n * Borderless so it reads as part of the card, focus shown as the\n * standard hover tint rather than an outline. */\n.menuSearchWrap_2006230319 {\n flex-shrink: 0;\n margin-top: 2px;\n padding-top: 4px;\n border-top: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuSearch_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside the wrap */\n width: 100%;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuRow_2006230319) — the portal\n * escapes the composer's font context and would inherit body's 400. */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuSearch_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuSearch_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* ── Create/rename flyouts (BranchMenu row context menu) ────────────\n * Open IN PLACE of the row menu (at its point, clamped) and hold the whole\n * flow in one panel: ask line, input, live hint, and the Cancel/confirm\n * pair — typing the name and pressing the button fires in one stroke, no\n * second confirm step. */\n\n/* The naming input inside the flyout: borderless, part of the card, focus\n * shown as the standard hover tint. Fixed width — the popCard is\n * max-content, so a percentage width would chase the input's own default\n * size instead of the design width. */\n.menuCreate_2006230319 {\n box-sizing: border-box;\n width: 248px;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuSearch_2006230319). */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuCreate_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuCreate_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuCreate_2006230319:disabled {\n opacity: 0.5;\n}\n\n/* The error line under the input — only rendered while the draft is\n * unacceptable with a non-empty reason; the input itself stays neutral,\n * the line carries the state. */\n.menuCreateHintBad_2006230319 {\n margin: 0;\n padding: 0 8px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-error);\n}\n\n/* ── Row context menu (BranchMenu right-click) ─────────────────────\n * Cursor-anchored transient over the branch card: translucent menu chrome\n * (--dsw-specific-menu with --dsw-menu-backdrop-filter, elevation-prominent hairline,\n * lv3 fallback) at a smaller radius — r20 would round a launcher this\n * short into a pill, r12 keeps the corners proportionate to a handful of\n * rows (two on a worktree row, up to six plus a header on a branch row).\n * Width hugs the widest item\n * (shrink-to-fit, no design width) with a generous cap for safety —\n * a launcher reads better snug than stretched. Positioned once at open\n * and dismissed rather than re-placed when the page moves (see\n * BranchMenu's ctx placement pass); z-index one step above the popCard so\n * it never slides under the confirm flyout. */\n.ctxCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1001;\n width: max-content;\n max-width: 280px;\n padding: 4px;\n border: 0;\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n/* The target row's name, above the verbs. Unlike the items this one holds\n * a branch name, so it is the one line allowed to hit the 280px cap and\n * ellipsize (the full name rides in a title). Secondary tone and no hover\n * affordance: it is a label, not a seventh item. */\n.ctxHeader_2006230319 {\n padding: 4px 8px 2px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-secondary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n/* Menu-item rows: the .menuRow_2006230319 geometry at a hair lighter weight — a\n * launcher's labels read as commands, not data. nowrap: the labels are\n * fixed copy (no branch names), the 280px cap is unreachable by design. */\n.ctxItem_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.ctxItem_2006230319:hover,\n.ctxItem_2006230319:focus-visible {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The running-session withhold (worktree removal): a disabled item stays\n * visible — the reason it is missing lives on its hover title, and a verb\n * that appears and disappears with session state reads as a bug, not a\n * rule. No hover tint, no pointer; the label dims instead of vanishing. */\n.ctxItem_2006230319:disabled {\n cursor: default;\n opacity: 0.45;\n}\n\n.ctxItem_2006230319:disabled:hover {\n background: transparent;\n}\n\n/* The arrow-key walk lands here, so the focused item must read as strongly\n * as a hovered one — the tint above carries it, the default ring would sit\n * outside the 8px radius. */\n.ctxItem_2006230319:focus-visible {\n outline: none;\n}\n\n/* Leading glyph rides the label tone, a step quieter. */\n.ctxItem_2006230319 svg {\n flex-shrink: 0;\n opacity: 0.75;\n}\n\n.ctxItemLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
|
|
1482
|
+
const tagId$3 = "@laoyuehanni/dsh-git-worktree/BranchChip.module.css";
|
|
1483
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$3 + "\"]") === null) {
|
|
647
1484
|
const tag = document.createElement("style");
|
|
648
1485
|
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
649
|
-
tag.dataset.pluginCss = tagId$
|
|
650
|
-
tag.textContent = css$
|
|
1486
|
+
tag.dataset.pluginCss = tagId$3;
|
|
1487
|
+
tag.textContent = css$3;
|
|
651
1488
|
document.head.appendChild(tag);
|
|
652
1489
|
}
|
|
653
1490
|
var BranchChip_module_default = {
|
|
@@ -677,6 +1514,10 @@ window.__ModuleLoader__.load({
|
|
|
677
1514
|
"menuRowPicked": "menuRowPicked_2006230319",
|
|
678
1515
|
"menuRowLabel": "menuRowLabel_2006230319",
|
|
679
1516
|
"menuRowArrow": "menuRowArrow_2006230319",
|
|
1517
|
+
"menuRowAhead": "menuRowAhead_2006230319",
|
|
1518
|
+
"menuRowBehind": "menuRowBehind_2006230319",
|
|
1519
|
+
"menuRowGone": "menuRowGone_2006230319",
|
|
1520
|
+
"menuRowOutgoing": "menuRowOutgoing_2006230319",
|
|
680
1521
|
"menuSearchMark": "menuSearchMark_2006230319",
|
|
681
1522
|
"menuGroup": "menuGroup_2006230319",
|
|
682
1523
|
"menuGroupTop": "menuGroupTop_2006230319",
|
|
@@ -796,9 +1637,11 @@ window.__ModuleLoader__.load({
|
|
|
796
1637
|
* fast-forward) — the pairing is IDEA's dashed/solid synchronize/update
|
|
797
1638
|
* language. The base library has no such glyph, so both are drawn here,
|
|
798
1639
|
* local to the menu; the sync spin animation targets `svg` descendants of
|
|
799
|
-
* the tool button and applies to them unchanged.
|
|
1640
|
+
* the tool button and applies to them unchanged. `weight` is the stroke
|
|
1641
|
+
* width in viewBox units: the 12px row marks draw heavier than the 14–16px
|
|
1642
|
+
* tool icons so a thin diagonal stays legible at that size.
|
|
800
1643
|
*/
|
|
801
|
-
function FetchGlyph({ size = 16, dashed = true }) {
|
|
1644
|
+
function FetchGlyph({ size = 16, dashed = true, weight = 1.3 }) {
|
|
802
1645
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
803
1646
|
width: size,
|
|
804
1647
|
height: size,
|
|
@@ -808,18 +1651,20 @@ window.__ModuleLoader__.load({
|
|
|
808
1651
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
809
1652
|
d: "M13 3 L5.9 10.1",
|
|
810
1653
|
stroke: "currentColor",
|
|
811
|
-
strokeWidth:
|
|
1654
|
+
strokeWidth: weight,
|
|
812
1655
|
strokeLinecap: "round",
|
|
813
1656
|
strokeDasharray: dashed ? "2.4 1.6" : void 0
|
|
814
1657
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
815
1658
|
d: "M5 5.9 V11 H10.1",
|
|
816
1659
|
stroke: "currentColor",
|
|
817
|
-
strokeWidth:
|
|
1660
|
+
strokeWidth: weight,
|
|
818
1661
|
strokeLinecap: "round",
|
|
819
1662
|
strokeLinejoin: "round"
|
|
820
1663
|
})]
|
|
821
1664
|
});
|
|
822
1665
|
}
|
|
1666
|
+
/** Stroke weight of the 12px ahead/behind marks: same size as before, a heavier line. */
|
|
1667
|
+
const ROW_MARK_WEIGHT = 2.2;
|
|
823
1668
|
/** Viewport edge clearance, mirroring the base Menu portal margin. */
|
|
824
1669
|
const MARGIN = 12;
|
|
825
1670
|
/** Gap kept between the chip's top edge and the card's bottom edge. */
|
|
@@ -940,7 +1785,7 @@ window.__ModuleLoader__.load({
|
|
|
940
1785
|
* @param props - anchor, rows, confirm bundle, callbacks, and the class sheet.
|
|
941
1786
|
* @returns null while closed or unplaced; otherwise the portaled card (+flyout).
|
|
942
1787
|
*/
|
|
943
|
-
function BranchMenu({ open, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, canWorktree, onWorktree, onCutWorktree, onRemoveWorktree, worktreeRemovalBlocked, onCreate, onRename, onDelete, busy, onFetch, fetchBusy, onUpdate, updateBusy, onClose, t }) {
|
|
1788
|
+
function BranchMenu({ open, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, canWorktree, onWorktree, onCutWorktree, onRemoveWorktree, worktreeRemovalBlocked, onCreate, onRename, onDelete, busy, onFetch, fetchBusy, onUpdate, onPush, hasRemotes, updateBusy, onClose, t }) {
|
|
944
1789
|
const cardRef = (0, react.useRef)(null);
|
|
945
1790
|
const inputRef = (0, react.useRef)(null);
|
|
946
1791
|
/**
|
|
@@ -1515,24 +2360,50 @@ window.__ModuleLoader__.load({
|
|
|
1515
2360
|
if (name === selected) cls += ` ${BranchChip_module_default.menuRowPicked}`;
|
|
1516
2361
|
return cls;
|
|
1517
2362
|
};
|
|
1518
|
-
/**
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1521
|
-
*
|
|
2363
|
+
/** IDEA colors and direction; what shows is decided by `syncMark` (an
|
|
2364
|
+
* unpublished branch gets an unnumbered green arrow, but only in a
|
|
2365
|
+
* repository that has a remote; a deleted upstream is a different,
|
|
2366
|
+
* explicitly warned state). */
|
|
1522
2367
|
const renderArrows = (row) => {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
if (
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
2368
|
+
const mark = row === null ? null : syncMark(row, hasRemotes);
|
|
2369
|
+
if (mark === null) return null;
|
|
2370
|
+
if (mark.kind === "gone") {
|
|
2371
|
+
const title = t("upstreamGoneTitle", { upstream: mark.upstream });
|
|
2372
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2373
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowGone}`,
|
|
2374
|
+
role: "img",
|
|
2375
|
+
"aria-label": title,
|
|
2376
|
+
title,
|
|
2377
|
+
children: "!"
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
const { outgoing, incoming } = mark;
|
|
2381
|
+
const outgoingTitle = outgoing === null ? "" : outgoing === "unpublished" ? t("unpublishedTitle") : t(outgoing === 1 ? "aheadTitle.one" : "aheadTitle.other", { n: outgoing });
|
|
2382
|
+
const incomingTitle = incoming === null ? "" : t(incoming === 1 ? "behindTitle.one" : "behindTitle.other", { n: incoming });
|
|
2383
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [outgoing !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2384
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowAhead}`,
|
|
2385
|
+
role: "img",
|
|
2386
|
+
"aria-label": outgoingTitle,
|
|
2387
|
+
title: outgoingTitle,
|
|
2388
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2389
|
+
className: BranchChip_module_default.menuRowOutgoing,
|
|
2390
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
2391
|
+
size: 12,
|
|
2392
|
+
dashed: false,
|
|
2393
|
+
weight: ROW_MARK_WEIGHT
|
|
2394
|
+
})
|
|
2395
|
+
}), outgoing !== "unpublished" && outgoing]
|
|
2396
|
+
}), incoming !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2397
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowBehind}`,
|
|
2398
|
+
role: "img",
|
|
2399
|
+
"aria-label": incomingTitle,
|
|
2400
|
+
title: incomingTitle,
|
|
2401
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
2402
|
+
size: 12,
|
|
2403
|
+
dashed: false,
|
|
2404
|
+
weight: ROW_MARK_WEIGHT
|
|
2405
|
+
}), incoming]
|
|
2406
|
+
})] });
|
|
1536
2407
|
};
|
|
1537
2408
|
/** A row's click behavior: with a dialog open (delete confirm or a
|
|
1538
2409
|
* worktree pick), clicking a row re-picks it (the flyout re-anchors);
|
|
@@ -1875,8 +2746,12 @@ window.__ModuleLoader__.load({
|
|
|
1875
2746
|
* 新建分支并创建工作树 (the owner's cutout dialog, name typed by hand,
|
|
1876
2747
|
* cut from THIS row); a started session drops them — its directory is
|
|
1877
2748
|
* fixed. Copy is client-only (WYSIWYG display names; a successful write
|
|
1878
|
-
* toasts the shared copied label).
|
|
1879
|
-
*
|
|
2749
|
+
* toasts the shared copied label). 推送, with 更新 (current branch with a
|
|
2750
|
+
* live upstream) directly above it, sits BETWEEN the verbs that check out
|
|
2751
|
+
* / create (签出 … 新建分支并创建工作树) and the ones that rewrite or delete
|
|
2752
|
+
* (重命名分支, 删除分支, 复制分支); on a worktree row the pair follows the
|
|
2753
|
+
* hop. The menu opens NEITHER select NOR pick — it launches, never
|
|
2754
|
+
* re-semantics. */
|
|
1880
2755
|
const ctxItems = [];
|
|
1881
2756
|
if (ctx !== null) {
|
|
1882
2757
|
const { row, name, x, y } = ctx;
|
|
@@ -1888,6 +2763,34 @@ window.__ModuleLoader__.load({
|
|
|
1888
2763
|
y
|
|
1889
2764
|
};
|
|
1890
2765
|
};
|
|
2766
|
+
const syncVerbs = row === null ? [] : syncActions(row, currentBranch);
|
|
2767
|
+
const addSync = () => {
|
|
2768
|
+
if (syncVerbs.includes("update")) ctxItems.push({
|
|
2769
|
+
id: "update",
|
|
2770
|
+
label: t("menuUpdate"),
|
|
2771
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
2772
|
+
size: 14,
|
|
2773
|
+
dashed: false
|
|
2774
|
+
}),
|
|
2775
|
+
run: () => {
|
|
2776
|
+
setCtx(null);
|
|
2777
|
+
onUpdate();
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
if (!syncVerbs.includes("push")) return;
|
|
2781
|
+
ctxItems.push({
|
|
2782
|
+
id: "push",
|
|
2783
|
+
label: t("ctxPush"),
|
|
2784
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutlineRegular, { size: 14 }),
|
|
2785
|
+
run: () => {
|
|
2786
|
+
confirmRef.current?.onCancel();
|
|
2787
|
+
setCreating(false);
|
|
2788
|
+
setRenaming(null);
|
|
2789
|
+
setCtx(null);
|
|
2790
|
+
onPush(name);
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2793
|
+
};
|
|
1891
2794
|
const openCreate = (checkout) => {
|
|
1892
2795
|
confirmRef.current?.onCancel();
|
|
1893
2796
|
setRenaming(null);
|
|
@@ -1910,6 +2813,7 @@ window.__ModuleLoader__.load({
|
|
|
1910
2813
|
pick(buttonOf(name), name, true);
|
|
1911
2814
|
}
|
|
1912
2815
|
});
|
|
2816
|
+
addSync();
|
|
1913
2817
|
ctxItems.push({
|
|
1914
2818
|
id: "copy",
|
|
1915
2819
|
label: t("ctxCopyPath"),
|
|
@@ -1996,6 +2900,7 @@ window.__ModuleLoader__.load({
|
|
|
1996
2900
|
}
|
|
1997
2901
|
});
|
|
1998
2902
|
}
|
|
2903
|
+
addSync();
|
|
1999
2904
|
if (canCreate) {
|
|
2000
2905
|
if (row?.kind !== "remote") {
|
|
2001
2906
|
ctxItems.push({
|
|
@@ -2361,7 +3266,7 @@ window.__ModuleLoader__.load({
|
|
|
2361
3266
|
type: "button",
|
|
2362
3267
|
role: "menuitem",
|
|
2363
3268
|
className: BranchChip_module_default.ctxItem,
|
|
2364
|
-
disabled: item.disabled,
|
|
3269
|
+
disabled: busy || item.disabled,
|
|
2365
3270
|
title: item.title,
|
|
2366
3271
|
onClick: item.run,
|
|
2367
3272
|
children: [item.icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -2379,6 +3284,258 @@ window.__ModuleLoader__.load({
|
|
|
2379
3284
|
] });
|
|
2380
3285
|
}
|
|
2381
3286
|
//#endregion
|
|
3287
|
+
//#region src/client/sync-job.ts
|
|
3288
|
+
let jobs = [];
|
|
3289
|
+
let lastId = 0;
|
|
3290
|
+
const aborts = /* @__PURE__ */ new Map();
|
|
3291
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
3292
|
+
function publish(next) {
|
|
3293
|
+
jobs = next;
|
|
3294
|
+
for (const listener of [...listeners]) listener();
|
|
3295
|
+
}
|
|
3296
|
+
/**
|
|
3297
|
+
* The job running for a directory.
|
|
3298
|
+
* @param cwd - session directory; undefined has no job.
|
|
3299
|
+
*/
|
|
3300
|
+
function findSyncJob(cwd) {
|
|
3301
|
+
return cwd === void 0 ? void 0 : jobs.find((job) => job.cwd === cwd);
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Be told whenever any job starts, advances or ends.
|
|
3305
|
+
* @param listener - called after the store changed.
|
|
3306
|
+
* @returns the unsubscribe.
|
|
3307
|
+
*/
|
|
3308
|
+
function subscribeSyncJobs(listener) {
|
|
3309
|
+
listeners.add(listener);
|
|
3310
|
+
return () => {
|
|
3311
|
+
listeners.delete(listener);
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
/**
|
|
3315
|
+
* Run one job for a directory. At most one job runs per directory.
|
|
3316
|
+
* @param cwd - session directory the job belongs to.
|
|
3317
|
+
* @param kind - which verb the card should say.
|
|
3318
|
+
* @param request - issues the streamed call with the live channel it is given.
|
|
3319
|
+
* @param subject - what the job is about, shown from the first moment.
|
|
3320
|
+
* @returns the outcome, or undefined when a job already runs for `cwd`
|
|
3321
|
+
* (nothing was started).
|
|
3322
|
+
*/
|
|
3323
|
+
async function runSyncJob(cwd, kind, request, subject = {}) {
|
|
3324
|
+
if (aborts.has(cwd)) return void 0;
|
|
3325
|
+
const controller = new AbortController();
|
|
3326
|
+
aborts.set(cwd, controller);
|
|
3327
|
+
const id = ++lastId;
|
|
3328
|
+
const identity = {
|
|
3329
|
+
id,
|
|
3330
|
+
kind,
|
|
3331
|
+
cwd,
|
|
3332
|
+
...subject.branch === void 0 ? {} : { branch: subject.branch }
|
|
3333
|
+
};
|
|
3334
|
+
publish([...jobs, {
|
|
3335
|
+
...identity,
|
|
3336
|
+
stage: "fetch",
|
|
3337
|
+
...subject.remote === void 0 ? {} : { remote: subject.remote }
|
|
3338
|
+
}]);
|
|
3339
|
+
const onEvent = (event) => {
|
|
3340
|
+
if (controller.signal.aborted) return;
|
|
3341
|
+
const before = jobs.find((job) => job.id === id);
|
|
3342
|
+
if (before === void 0) return;
|
|
3343
|
+
const remote = event.type === "progress" ? event.remote ?? before.remote : void 0;
|
|
3344
|
+
const next = event.type === "merge" ? {
|
|
3345
|
+
...identity,
|
|
3346
|
+
stage: "merge"
|
|
3347
|
+
} : {
|
|
3348
|
+
...identity,
|
|
3349
|
+
stage: "fetch",
|
|
3350
|
+
text: event.text,
|
|
3351
|
+
...event.percent === void 0 ? {} : { percent: event.percent },
|
|
3352
|
+
...remote === void 0 ? {} : { remote }
|
|
3353
|
+
};
|
|
3354
|
+
publish(jobs.map((job) => job.id === id ? next : job));
|
|
3355
|
+
};
|
|
3356
|
+
try {
|
|
3357
|
+
return {
|
|
3358
|
+
result: await request({
|
|
3359
|
+
signal: controller.signal,
|
|
3360
|
+
onEvent
|
|
3361
|
+
}),
|
|
3362
|
+
cancelled: controller.signal.aborted
|
|
3363
|
+
};
|
|
3364
|
+
} finally {
|
|
3365
|
+
aborts.delete(cwd);
|
|
3366
|
+
publish(jobs.filter((job) => job.id !== id));
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Cancel the job running for a directory: the connection closes and the host
|
|
3371
|
+
* kills git. A job already past fetching (the quick fast-forward) is left to
|
|
3372
|
+
* finish — stopping it half way would only add a state to explain.
|
|
3373
|
+
* @param cwd - session directory.
|
|
3374
|
+
*/
|
|
3375
|
+
function cancelSyncJob(cwd) {
|
|
3376
|
+
if (findSyncJob(cwd)?.stage === "merge") return;
|
|
3377
|
+
aborts.get(cwd)?.abort();
|
|
3378
|
+
}
|
|
3379
|
+
const pushFailures = /* @__PURE__ */ new Map();
|
|
3380
|
+
/**
|
|
3381
|
+
* Keep a failed push for a directory and tell the docks. The push window had
|
|
3382
|
+
* already closed (the card carried the push), so whichever dock is on that
|
|
3383
|
+
* directory — the one that started it, a later one, or one not yet mounted —
|
|
3384
|
+
* picks the failure up and reopens the window with git's reason.
|
|
3385
|
+
* @param cwd - session directory the push ran for.
|
|
3386
|
+
* @param failure - what was pushed and why it failed.
|
|
3387
|
+
*/
|
|
3388
|
+
function recordPushFailure(cwd, failure) {
|
|
3389
|
+
pushFailures.set(cwd, failure);
|
|
3390
|
+
for (const listener of [...listeners]) listener();
|
|
3391
|
+
}
|
|
3392
|
+
/**
|
|
3393
|
+
* Take the failed push waiting for a directory (it is forgotten once taken).
|
|
3394
|
+
* @param cwd - session directory; undefined has none.
|
|
3395
|
+
* @returns the failure, or undefined.
|
|
3396
|
+
*/
|
|
3397
|
+
function takePushFailure(cwd) {
|
|
3398
|
+
if (cwd === void 0) return void 0;
|
|
3399
|
+
const failure = pushFailures.get(cwd);
|
|
3400
|
+
pushFailures.delete(cwd);
|
|
3401
|
+
return failure;
|
|
3402
|
+
}
|
|
3403
|
+
//#endregion
|
|
3404
|
+
//#region src/client/update-error.ts
|
|
3405
|
+
/** Ordered: the most specific cause wins when several markers appear. */
|
|
3406
|
+
const MARKERS = [
|
|
3407
|
+
["diverged", /not possible to fast-forward|diverging branches can't be fast-forwarded/i],
|
|
3408
|
+
["dirty", /would be overwritten by merge|please commit your changes or stash them before you merge/i],
|
|
3409
|
+
["noUpstream", /no upstream configured|does not have (?:an |any )?upstream|no tracking information for the current branch/i]
|
|
3410
|
+
];
|
|
3411
|
+
/**
|
|
3412
|
+
* Classify an update failure.
|
|
3413
|
+
* @param raw - the error text returned by the update route.
|
|
3414
|
+
* @returns the recognised cause, or null when the toast should keep git's words.
|
|
3415
|
+
*/
|
|
3416
|
+
function explainUpdateFailure(raw) {
|
|
3417
|
+
for (const [kind, pattern] of MARKERS) if (pattern.test(raw)) return kind;
|
|
3418
|
+
return null;
|
|
3419
|
+
}
|
|
3420
|
+
/**
|
|
3421
|
+
* Git's own words for an update failure this toast does not name.
|
|
3422
|
+
*
|
|
3423
|
+
* Drops the `git <args> failed (exit N):` preamble and every `hint:` line.
|
|
3424
|
+
* A diverged update is nothing but those two, which is why a recognised
|
|
3425
|
+
* cause never calls this.
|
|
3426
|
+
* @param raw - the error text returned by the update route.
|
|
3427
|
+
* @returns the remaining text, or `raw` when stripping would leave nothing.
|
|
3428
|
+
*/
|
|
3429
|
+
function updateErrorText(raw) {
|
|
3430
|
+
const body = /^git [\s\S]*?failed \(exit \d+\):\s*([\s\S]*)$/.exec(raw)?.[1];
|
|
3431
|
+
const text = body === void 0 || body === "" ? raw : body;
|
|
3432
|
+
const kept = text.split(/\r?\n/).filter((line) => {
|
|
3433
|
+
const trimmed = line.trim();
|
|
3434
|
+
return trimmed !== "" && !/^hint:/i.test(trimmed);
|
|
3435
|
+
});
|
|
3436
|
+
return kept.length === 0 ? text : kept.join("\n");
|
|
3437
|
+
}
|
|
3438
|
+
//#endregion
|
|
3439
|
+
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\SyncProgress.module.css?inline
|
|
3440
|
+
const css$2 = "/* The floating progress card of a running fetch/update.\n *\n * Fixed to the viewport and portalled out of the composer, so it can never\n * push or clip the layout it floats over. Only the card itself takes the\n * pointer; everything around it keeps working, which is the point — a\n * transfer that takes a minute must not hold the app hostage.\n *\n * Chrome is the branch menu card's recipe (r16 here: it is a small notice,\n * not a menu), so it reads as part of the same plugin in both themes. */\n.card_2133289399 {\n box-sizing: border-box;\n position: fixed;\n right: 20px;\n bottom: 84px;\n z-index: 1000;\n /* Wide enough for git's longest ordinary counter line on one row\n * (`Receiving objects: 66% (1340/2030), 120.80 MiB | 10.24 MiB/s`), which a\n * 300px card cut to `… | 1024.0…` from the tens of MiB on. */\n width: 380px;\n max-width: calc(100vw - 40px);\n padding: 10px 12px 12px;\n border-radius: 16px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n color: var(--dsw-alias-label-primary, inherit);\n animation: syncCardIn 160ms ease-out;\n}\n\n.head_2133289399 {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 22px;\n}\n\n.title_2133289399 {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.cancel_2133289399 {\n flex: none;\n display: grid;\n place-items: center;\n width: 22px;\n height: 22px;\n margin: 0 -4px 0 0;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-tertiary, #81858c);\n cursor: pointer;\n}\n\n.cancel_2133289399:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.cancel_2133289399:focus-visible {\n outline: 2px solid var(--dsw-alias-brand-primary, #4186f0);\n outline-offset: 1px;\n}\n\n/* The bar: a determinate fill follows git's own percentage; with none to\n * show (connecting, a phase git cannot size, the fast-forward) a short\n * segment sweeps instead of a bar frozen at some stale number. */\n.track_2133289399 {\n position: relative;\n height: 4px;\n margin: 8px 0 8px;\n overflow: hidden;\n border-radius: 2px;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 10%, transparent));\n}\n\n.fill_2133289399 {\n height: 100%;\n border-radius: 2px;\n background: var(--dsw-alias-brand-primary, #4186f0);\n transition: width 150ms linear;\n}\n\n.indeterminate_2133289399 {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 40%;\n border-radius: 2px;\n background: var(--dsw-alias-brand-primary, #4186f0);\n animation: syncSweep 1.1s ease-in-out infinite;\n}\n\n/* git's line, verbatim: stage, counts and transfer speed in one row, the\n * way IDEA's task popup prints it. Tabular figures keep it from jittering. */\n.detail_2133289399 {\n overflow: hidden;\n font-size: 12px;\n line-height: 18px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n text-overflow: ellipsis;\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n@keyframes syncSweep {\n from { transform: translateX(-100%); }\n to { transform: translateX(250%); }\n}\n\n@keyframes syncCardIn {\n from { opacity: 0; transform: translateY(6px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .card_2133289399 { animation: none; }\n .fill_2133289399 { transition: none; }\n .indeterminate_2133289399 { width: 100%; opacity: 0.35; animation: none; }\n}\n";
|
|
3441
|
+
const tagId$2 = "@laoyuehanni/dsh-git-worktree/SyncProgress.module.css";
|
|
3442
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$2 + "\"]") === null) {
|
|
3443
|
+
const tag = document.createElement("style");
|
|
3444
|
+
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
3445
|
+
tag.dataset.pluginCss = tagId$2;
|
|
3446
|
+
tag.textContent = css$2;
|
|
3447
|
+
document.head.appendChild(tag);
|
|
3448
|
+
}
|
|
3449
|
+
var SyncProgress_module_default = {
|
|
3450
|
+
"card": "card_2133289399",
|
|
3451
|
+
"head": "head_2133289399",
|
|
3452
|
+
"title": "title_2133289399",
|
|
3453
|
+
"cancel": "cancel_2133289399",
|
|
3454
|
+
"track": "track_2133289399",
|
|
3455
|
+
"fill": "fill_2133289399",
|
|
3456
|
+
"indeterminate": "indeterminate_2133289399",
|
|
3457
|
+
"detail": "detail_2133289399"
|
|
3458
|
+
};
|
|
3459
|
+
//#endregion
|
|
3460
|
+
//#region src/client/SyncProgress.tsx
|
|
3461
|
+
/**
|
|
3462
|
+
* SyncProgress: the floating card of a running fetch/update/push — IDEA's
|
|
3463
|
+
* background-task popup in this plugin's terms. Title says what is running,
|
|
3464
|
+
* the bar follows git's own percentage, the line under it is git's own
|
|
3465
|
+
* progress text (stage, counts, transfer speed), and × cancels the transfer.
|
|
3466
|
+
*
|
|
3467
|
+
* It is a non-modal notice: portalled to the body and fixed to the viewport,
|
|
3468
|
+
* so the composer, the menu and the rest of the app stay fully usable while
|
|
3469
|
+
* it is up. All the data comes from the {@link SyncJob} the store keeps; this
|
|
3470
|
+
* component owns nothing.
|
|
3471
|
+
*
|
|
3472
|
+
* @module git-worktree/client/SyncProgress
|
|
3473
|
+
*/
|
|
3474
|
+
/**
|
|
3475
|
+
* Decide what the card says for a job, as a pure function of its state.
|
|
3476
|
+
* @param job - the job, as the store holds it.
|
|
3477
|
+
* @param branch - the checked-out branch.
|
|
3478
|
+
* @param t - the plugin's translator.
|
|
3479
|
+
*/
|
|
3480
|
+
function describeSync(job, branch, t) {
|
|
3481
|
+
const verb = job.kind === "update" ? t("syncTitleUpdate", { branch }) : job.kind === "push" ? t("syncTitlePush", { branch: job.branch ?? branch }) : t("syncTitleFetch");
|
|
3482
|
+
const title = job.remote === void 0 ? verb : `${verb} · ${job.remote}`;
|
|
3483
|
+
if (job.stage === "merge") return {
|
|
3484
|
+
title,
|
|
3485
|
+
detail: t("syncMerging", { branch }),
|
|
3486
|
+
percent: void 0,
|
|
3487
|
+
cancellable: false
|
|
3488
|
+
};
|
|
3489
|
+
return {
|
|
3490
|
+
title,
|
|
3491
|
+
detail: job.text ?? t("syncConnecting"),
|
|
3492
|
+
percent: job.percent,
|
|
3493
|
+
cancellable: true
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
/** The floating progress card. */
|
|
3497
|
+
function SyncProgress({ job, branch, t, onCancel }) {
|
|
3498
|
+
const { title, detail, percent, cancellable } = describeSync(job, branch, t);
|
|
3499
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3500
|
+
className: SyncProgress_module_default.card,
|
|
3501
|
+
role: "status",
|
|
3502
|
+
"aria-live": "polite",
|
|
3503
|
+
children: [
|
|
3504
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3505
|
+
className: SyncProgress_module_default.head,
|
|
3506
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3507
|
+
className: SyncProgress_module_default.title,
|
|
3508
|
+
title,
|
|
3509
|
+
children: title
|
|
3510
|
+
}), cancellable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3511
|
+
type: "button",
|
|
3512
|
+
className: SyncProgress_module_default.cancel,
|
|
3513
|
+
"aria-label": t("syncCancel"),
|
|
3514
|
+
title: t("syncCancel"),
|
|
3515
|
+
onClick: onCancel,
|
|
3516
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 12 })
|
|
3517
|
+
})]
|
|
3518
|
+
}),
|
|
3519
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3520
|
+
className: SyncProgress_module_default.track,
|
|
3521
|
+
role: "progressbar",
|
|
3522
|
+
"aria-valuemin": 0,
|
|
3523
|
+
"aria-valuemax": 100,
|
|
3524
|
+
...percent === void 0 ? {} : { "aria-valuenow": percent },
|
|
3525
|
+
children: percent === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: SyncProgress_module_default.indeterminate }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3526
|
+
className: SyncProgress_module_default.fill,
|
|
3527
|
+
style: { width: `${percent}%` }
|
|
3528
|
+
})
|
|
3529
|
+
}),
|
|
3530
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3531
|
+
className: SyncProgress_module_default.detail,
|
|
3532
|
+
title: detail,
|
|
3533
|
+
children: detail
|
|
3534
|
+
})
|
|
3535
|
+
]
|
|
3536
|
+
}), document.body);
|
|
3537
|
+
}
|
|
3538
|
+
//#endregion
|
|
2382
3539
|
//#region src/client/BranchChip.tsx
|
|
2383
3540
|
/**
|
|
2384
3541
|
* BranchChipDock: the composer tool-row entry (conversation.input.left, right
|
|
@@ -2401,8 +3558,10 @@ window.__ModuleLoader__.load({
|
|
|
2401
3558
|
* moving between worktrees is the point of having them. What also stays is
|
|
2402
3559
|
* the two tools that never move a checkout: fetch, and update-current — the
|
|
2403
3560
|
* update fast-forwards the session's OWN worktree, the fetch is
|
|
2404
|
-
* repository-wide metadata.
|
|
2405
|
-
*
|
|
3561
|
+
* repository-wide metadata. Both run as jobs in ./sync-job.ts and show a
|
|
3562
|
+
* floating, non-modal progress card with a cancel button (./SyncProgress.tsx).
|
|
3563
|
+
* Non-git directories and load failures render nothing. The confirm dialogs
|
|
3564
|
+
* and the error toast live here too.
|
|
2406
3565
|
*
|
|
2407
3566
|
* Checking the worktree toggle pops the cutout confirm dialog right away:
|
|
2408
3567
|
* confirming it cuts a NEW branch (`<current>-wt`, suffixes past taken
|
|
@@ -2441,6 +3600,13 @@ window.__ModuleLoader__.load({
|
|
|
2441
3600
|
* gains the main checkout row (see {@link buildLinkedWorktreeRows}); a
|
|
2442
3601
|
* started MAIN-checkout session drops the group — its directory is fixed.
|
|
2443
3602
|
*/
|
|
3603
|
+
/** The toast for an update failure the plugin can name. Each one says what
|
|
3604
|
+
* to do next; git's hint essay is not part of it. */
|
|
3605
|
+
const UPDATE_FAIL = {
|
|
3606
|
+
diverged: "updateFailDiverged",
|
|
3607
|
+
dirty: "updateFailDirty",
|
|
3608
|
+
noUpstream: "updateFailNoUpstream"
|
|
3609
|
+
};
|
|
2444
3610
|
/**
|
|
2445
3611
|
* Read the repository status for a directory; refetch on demand.
|
|
2446
3612
|
* @param cwd - absolute session directory.
|
|
@@ -2472,6 +3638,22 @@ window.__ModuleLoader__.load({
|
|
|
2472
3638
|
}, [cwd]);
|
|
2473
3639
|
return [state, load];
|
|
2474
3640
|
}
|
|
3641
|
+
/**
|
|
3642
|
+
* The fetch/update running for a directory, live. The job store outlives
|
|
3643
|
+
* this component (switching sessions unmounts the dock, a long transfer does
|
|
3644
|
+
* not stop), so the hook reads the store at render time — a held copy could
|
|
3645
|
+
* lag a render behind a directory change — and only subscribes to learn WHEN
|
|
3646
|
+
* to re-render.
|
|
3647
|
+
* @param cwd - absolute session directory.
|
|
3648
|
+
* @returns the running job, or undefined.
|
|
3649
|
+
*/
|
|
3650
|
+
function useSyncJob(cwd) {
|
|
3651
|
+
const [, redraw] = (0, react.useState)(0);
|
|
3652
|
+
(0, react.useEffect)(() => subscribeSyncJobs(() => {
|
|
3653
|
+
redraw((tick) => tick + 1);
|
|
3654
|
+
}), []);
|
|
3655
|
+
return findSyncJob(cwd);
|
|
3656
|
+
}
|
|
2475
3657
|
/** Longest branch name shown on the chip before ellipsizing (chars, … included). */
|
|
2476
3658
|
const BRANCH_DISPLAY_MAX = 25;
|
|
2477
3659
|
/** Viewport edge clearance and chip gap, mirroring BranchMenu's posture. */
|
|
@@ -2521,7 +3703,9 @@ window.__ModuleLoader__.load({
|
|
|
2521
3703
|
name: b.name,
|
|
2522
3704
|
kind: "local",
|
|
2523
3705
|
...b.ahead === void 0 ? {} : { ahead: b.ahead },
|
|
2524
|
-
...b.behind === void 0 ? {} : { behind: b.behind }
|
|
3706
|
+
...b.behind === void 0 ? {} : { behind: b.behind },
|
|
3707
|
+
...b.upstream === void 0 ? {} : { upstream: b.upstream },
|
|
3708
|
+
...b.upstreamGone === void 0 ? {} : { upstreamGone: b.upstreamGone }
|
|
2525
3709
|
})),
|
|
2526
3710
|
...branches.filter((b) => b.kind === "remote").map((b) => ({
|
|
2527
3711
|
name: b.name,
|
|
@@ -2535,7 +3719,9 @@ window.__ModuleLoader__.load({
|
|
|
2535
3719
|
kind: "worktree",
|
|
2536
3720
|
path: w.path,
|
|
2537
3721
|
...twin?.ahead === void 0 ? {} : { ahead: twin.ahead },
|
|
2538
|
-
...twin?.behind === void 0 ? {} : { behind: twin.behind }
|
|
3722
|
+
...twin?.behind === void 0 ? {} : { behind: twin.behind },
|
|
3723
|
+
...twin?.upstream === void 0 ? {} : { upstream: twin.upstream },
|
|
3724
|
+
...twin?.upstreamGone === void 0 ? {} : { upstreamGone: twin.upstreamGone }
|
|
2539
3725
|
}];
|
|
2540
3726
|
})
|
|
2541
3727
|
];
|
|
@@ -2571,7 +3757,9 @@ window.__ModuleLoader__.load({
|
|
|
2571
3757
|
name: current.name,
|
|
2572
3758
|
kind: "local",
|
|
2573
3759
|
...current.ahead === void 0 ? {} : { ahead: current.ahead },
|
|
2574
|
-
...current.behind === void 0 ? {} : { behind: current.behind }
|
|
3760
|
+
...current.behind === void 0 ? {} : { behind: current.behind },
|
|
3761
|
+
...current.upstream === void 0 ? {} : { upstream: current.upstream },
|
|
3762
|
+
...current.upstreamGone === void 0 ? {} : { upstreamGone: current.upstreamGone }
|
|
2575
3763
|
}], ...worktrees.flatMap((w) => {
|
|
2576
3764
|
if (w.branch === void 0 || w.branch === currentBranch) return [];
|
|
2577
3765
|
const twin = localMap.get(w.branch);
|
|
@@ -2581,7 +3769,9 @@ window.__ModuleLoader__.load({
|
|
|
2581
3769
|
path: w.path,
|
|
2582
3770
|
...w.main ? { mainWorktree: true } : {},
|
|
2583
3771
|
...twin?.ahead === void 0 ? {} : { ahead: twin.ahead },
|
|
2584
|
-
...twin?.behind === void 0 ? {} : { behind: twin.behind }
|
|
3772
|
+
...twin?.behind === void 0 ? {} : { behind: twin.behind },
|
|
3773
|
+
...twin?.upstream === void 0 ? {} : { upstream: twin.upstream },
|
|
3774
|
+
...twin?.upstreamGone === void 0 ? {} : { upstreamGone: twin.upstreamGone }
|
|
2585
3775
|
}];
|
|
2586
3776
|
})];
|
|
2587
3777
|
}
|
|
@@ -2711,19 +3901,18 @@ window.__ModuleLoader__.load({
|
|
|
2711
3901
|
const session = useSession((s) => s);
|
|
2712
3902
|
const cwd = summary?.cwd;
|
|
2713
3903
|
const [repo, refresh] = useRepoStatus(cwd);
|
|
3904
|
+
const syncJob = useSyncJob(cwd);
|
|
2714
3905
|
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
2715
3906
|
const [confirm, setConfirm] = (0, react.useState)(null);
|
|
3907
|
+
const [pushBranch, setPushBranch] = (0, react.useState)(null);
|
|
3908
|
+
/** Set when the push window is coming back after a failed push. */
|
|
3909
|
+
const [pushResume, setPushResume] = (0, react.useState)(void 0);
|
|
2716
3910
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
2717
3911
|
/** Inspect facts of the staged worktree removal, keyed to its directory:
|
|
2718
3912
|
* a confirm staged for one path never shows another's facts, and a restage
|
|
2719
3913
|
* while a probe is in flight keeps showing the new path's loading line. */
|
|
2720
3914
|
const [removalPath, setRemovalPath] = (0, react.useState)(null);
|
|
2721
3915
|
const [removalFacts, setRemovalFacts] = (0, react.useState)(void 0);
|
|
2722
|
-
/** Which arrow is spinning: fetch and update are single-flight against
|
|
2723
|
-
* the SAME busyRef (mutually exclusive), but the spinning state must be
|
|
2724
|
-
* per-tool — one shared flag made both arrows rotate at once. */
|
|
2725
|
-
const [fetchBusy, setFetchBusy] = (0, react.useState)(false);
|
|
2726
|
-
const [updateBusy, setUpdateBusy] = (0, react.useState)(false);
|
|
2727
3916
|
/** Toasts wait their turn instead of overwriting each other. One flow
|
|
2728
3917
|
* can raise two in a row — a worktree creation whose fetch warned, then
|
|
2729
3918
|
* the auto-prune's report — and a single-slot state made the second
|
|
@@ -2741,6 +3930,12 @@ window.__ModuleLoader__.load({
|
|
|
2741
3930
|
}, []);
|
|
2742
3931
|
const chipRef = (0, react.useRef)(null);
|
|
2743
3932
|
const busyRef = (0, react.useRef)(false);
|
|
3933
|
+
const currentCwdRef = (0, react.useRef)(cwd);
|
|
3934
|
+
currentCwdRef.current = cwd;
|
|
3935
|
+
/** Is something already running that another git action must not overlap:
|
|
3936
|
+
* one of this dock's own actions, or a fetch/update the job store holds for
|
|
3937
|
+
* this directory (it outlives the dock, so a remounted dock still sees it). */
|
|
3938
|
+
const blocked = (0, react.useCallback)(() => busyRef.current || findSyncJob(currentCwdRef.current) !== void 0, []);
|
|
2744
3939
|
/** Branch the label is showing. The poll compares against this and does
|
|
2745
3940
|
* not refetch while it is still empty (the mount fetch owns that). */
|
|
2746
3941
|
const shownBranchRef = (0, react.useRef)(void 0);
|
|
@@ -2750,8 +3945,22 @@ window.__ModuleLoader__.load({
|
|
|
2750
3945
|
const pollRefreshRef = (0, react.useRef)(false);
|
|
2751
3946
|
(0, react.useEffect)(() => {
|
|
2752
3947
|
setConfirm(null);
|
|
3948
|
+
setPushBranch(null);
|
|
3949
|
+
setPushResume(void 0);
|
|
2753
3950
|
setMenuOpen(false);
|
|
2754
3951
|
}, [cwd]);
|
|
3952
|
+
(0, react.useEffect)(() => {
|
|
3953
|
+
const reopen = () => {
|
|
3954
|
+
const failure = takePushFailure(cwd);
|
|
3955
|
+
if (failure === void 0) return;
|
|
3956
|
+
setConfirm(null);
|
|
3957
|
+
setMenuOpen(false);
|
|
3958
|
+
setPushResume(failure);
|
|
3959
|
+
setPushBranch(failure.branch);
|
|
3960
|
+
};
|
|
3961
|
+
reopen();
|
|
3962
|
+
return subscribeSyncJobs(reopen);
|
|
3963
|
+
}, [cwd]);
|
|
2755
3964
|
(0, react.useEffect)(() => {
|
|
2756
3965
|
if (!session.blank) setConfirm(null);
|
|
2757
3966
|
}, [session.blank]);
|
|
@@ -2795,7 +4004,7 @@ window.__ModuleLoader__.load({
|
|
|
2795
4004
|
* menu's rule: 原地动作 leave the picker up), and `onSettled` — the
|
|
2796
4005
|
* flyout's success-only close hook — fires after both. */
|
|
2797
4006
|
const runGuarded = (0, react.useCallback)(async (action, keepOpen = false, onSettled) => {
|
|
2798
|
-
if (
|
|
4007
|
+
if (blocked()) return;
|
|
2799
4008
|
busyRef.current = true;
|
|
2800
4009
|
setBusy(true);
|
|
2801
4010
|
const failure = await action();
|
|
@@ -2808,7 +4017,7 @@ window.__ModuleLoader__.load({
|
|
|
2808
4017
|
setConfirm(null);
|
|
2809
4018
|
if (!keepOpen) setMenuOpen(false);
|
|
2810
4019
|
onSettled?.();
|
|
2811
|
-
}, [showError]);
|
|
4020
|
+
}, [blocked, showError]);
|
|
2812
4021
|
/** In-place switch flow: POST /switch, then refetch the status. */
|
|
2813
4022
|
const doSwitch = (0, react.useCallback)((branch, keepOpen = false) => runGuarded(async () => {
|
|
2814
4023
|
if (cwd === void 0) return "no session directory";
|
|
@@ -2906,30 +4115,34 @@ window.__ModuleLoader__.load({
|
|
|
2906
4115
|
/** Remote-sync flow: POST /fetch (fetch every remote + prune), then
|
|
2907
4116
|
* refetch the status. Deliberately NOT runGuarded: its success closes the
|
|
2908
4117
|
* menu, while the whole point of a sync is watching the refreshed branch
|
|
2909
|
-
* list in place.
|
|
2910
|
-
*
|
|
2911
|
-
*
|
|
2912
|
-
*
|
|
4118
|
+
* list in place. The run lives in the job store, not in this component:
|
|
4119
|
+
* the floating card shows its progress and cancels it, a remounted dock
|
|
4120
|
+
* still sees it, and while it runs the single-flight gate (`blocked`)
|
|
4121
|
+
* keeps every other git action out. A fetch has NO visible side effect
|
|
4122
|
+
* when the remote moved not — the card and the done toast ARE the
|
|
4123
|
+
* feedback. */
|
|
2913
4124
|
const doFetch = (0, react.useCallback)(async () => {
|
|
2914
|
-
if (
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
4125
|
+
if (cwd === void 0) {
|
|
4126
|
+
showError("no session directory");
|
|
4127
|
+
return;
|
|
4128
|
+
}
|
|
4129
|
+
if (blocked()) return;
|
|
4130
|
+
const outcome = await runSyncJob(cwd, "fetch", (live) => requestFetch(cwd, live));
|
|
4131
|
+
if (outcome === void 0 || currentCwdRef.current !== cwd) return;
|
|
4132
|
+
const { result, cancelled } = outcome;
|
|
4133
|
+
if (cancelled && !result.ok) {
|
|
4134
|
+
await refresh();
|
|
4135
|
+
pushToast(t("fetchCancelled"));
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
if (!result.ok) {
|
|
4139
|
+
showError(result.error);
|
|
2928
4140
|
return;
|
|
2929
4141
|
}
|
|
2930
4142
|
await refresh();
|
|
2931
4143
|
pushToast(t("fetchDone"));
|
|
2932
4144
|
}, [
|
|
4145
|
+
blocked,
|
|
2933
4146
|
cwd,
|
|
2934
4147
|
pushToast,
|
|
2935
4148
|
refresh,
|
|
@@ -2938,40 +4151,101 @@ window.__ModuleLoader__.load({
|
|
|
2938
4151
|
]);
|
|
2939
4152
|
/** Update-current-branch flow: POST /update (fetch every remote, then
|
|
2940
4153
|
* fast-forward the checked-out branch to its upstream), then refetch the
|
|
2941
|
-
* status in place — same keep-the-menu-open semantics as the
|
|
2942
|
-
* The toast tells the two apart: fast-forwarded vs already up
|
|
4154
|
+
* status in place — same job-store and keep-the-menu-open semantics as the
|
|
4155
|
+
* fetch sync. The toast tells the two apart: fast-forwarded vs already up
|
|
4156
|
+
* to date. */
|
|
2943
4157
|
const doUpdate = (0, react.useCallback)(async () => {
|
|
2944
|
-
if (
|
|
2945
|
-
busyRef.current = true;
|
|
2946
|
-
setBusy(true);
|
|
2947
|
-
setUpdateBusy(true);
|
|
2948
|
-
const result = cwd === void 0 ? void 0 : await requestUpdate(cwd);
|
|
2949
|
-
busyRef.current = false;
|
|
2950
|
-
setBusy(false);
|
|
2951
|
-
setUpdateBusy(false);
|
|
2952
|
-
if (result === void 0) {
|
|
4158
|
+
if (cwd === void 0) {
|
|
2953
4159
|
showError("no session directory");
|
|
2954
4160
|
return;
|
|
2955
4161
|
}
|
|
4162
|
+
if (blocked()) return;
|
|
4163
|
+
const outcome = await runSyncJob(cwd, "update", (live) => requestUpdate(cwd, live));
|
|
4164
|
+
if (outcome === void 0 || currentCwdRef.current !== cwd) return;
|
|
4165
|
+
const { result, cancelled } = outcome;
|
|
4166
|
+
if (cancelled && !result.ok) {
|
|
4167
|
+
await refresh();
|
|
4168
|
+
pushToast(t("updateCancelled"));
|
|
4169
|
+
return;
|
|
4170
|
+
}
|
|
2956
4171
|
if (!result.ok) {
|
|
2957
|
-
|
|
4172
|
+
const kind = explainUpdateFailure(result.error);
|
|
4173
|
+
if (kind !== null) pushToast(t(UPDATE_FAIL[kind]));
|
|
4174
|
+
else showError(updateErrorText(result.error));
|
|
2958
4175
|
return;
|
|
2959
4176
|
}
|
|
2960
4177
|
await refresh();
|
|
2961
4178
|
pushToast(result.updated ? t("updateDone", { branch: result.branch }) : t("updateUpToDate"));
|
|
2962
4179
|
}, [
|
|
4180
|
+
blocked,
|
|
2963
4181
|
cwd,
|
|
2964
4182
|
pushToast,
|
|
2965
4183
|
refresh,
|
|
2966
4184
|
showError,
|
|
2967
4185
|
t
|
|
2968
4186
|
]);
|
|
4187
|
+
/**
|
|
4188
|
+
* Push flow: the window hands the push over and closes; the push itself
|
|
4189
|
+
* runs in the job store behind the floating card (progress from git,
|
|
4190
|
+
* cancellable, the page stays usable) like a fetch or update. Success is a
|
|
4191
|
+
* toast. A failure is NOT: the reason belongs next to the choices that
|
|
4192
|
+
* produced it, so it is recorded and the window comes back (see the effect
|
|
4193
|
+
* that reopens it) — here, or in whichever dock is on this directory later.
|
|
4194
|
+
* @returns an error only when nothing could be started (the window then
|
|
4195
|
+
* stays open with it); otherwise undefined at once.
|
|
4196
|
+
*/
|
|
4197
|
+
const doPush = (0, react.useCallback)((body) => {
|
|
4198
|
+
if (blocked() || cwd === void 0) return Promise.resolve(t("pushBusy"));
|
|
4199
|
+
const remote = body.remote ?? "";
|
|
4200
|
+
const target = body.target ?? body.branch;
|
|
4201
|
+
const failure = (error) => ({
|
|
4202
|
+
branch: body.branch,
|
|
4203
|
+
remote,
|
|
4204
|
+
target,
|
|
4205
|
+
tags: body.tags ?? "none",
|
|
4206
|
+
error
|
|
4207
|
+
});
|
|
4208
|
+
setPushBranch(null);
|
|
4209
|
+
setPushResume(void 0);
|
|
4210
|
+
(async () => {
|
|
4211
|
+
const outcome = await runSyncJob(cwd, "push", (live) => requestPush({
|
|
4212
|
+
repoPath: cwd,
|
|
4213
|
+
...body
|
|
4214
|
+
}, live), {
|
|
4215
|
+
branch: body.branch,
|
|
4216
|
+
...remote === "" ? {} : { remote }
|
|
4217
|
+
});
|
|
4218
|
+
if (outcome === void 0) {
|
|
4219
|
+
recordPushFailure(cwd, failure(t("pushBusy")));
|
|
4220
|
+
return;
|
|
4221
|
+
}
|
|
4222
|
+
const { result, cancelled } = outcome;
|
|
4223
|
+
const stopped = cancelled && !result.ok;
|
|
4224
|
+
if (!result.ok && !stopped) recordPushFailure(cwd, failure(result.error));
|
|
4225
|
+
if (currentCwdRef.current !== cwd) return;
|
|
4226
|
+
await refresh();
|
|
4227
|
+
if (currentCwdRef.current !== cwd) return;
|
|
4228
|
+
if (stopped) pushToast(t("pushCancelled"));
|
|
4229
|
+
else if (result.ok) pushToast(t("pushDone", {
|
|
4230
|
+
branch: body.branch,
|
|
4231
|
+
remote: result.remote,
|
|
4232
|
+
target: result.target
|
|
4233
|
+
}));
|
|
4234
|
+
})();
|
|
4235
|
+
return Promise.resolve(void 0);
|
|
4236
|
+
}, [
|
|
4237
|
+
blocked,
|
|
4238
|
+
cwd,
|
|
4239
|
+
pushToast,
|
|
4240
|
+
refresh,
|
|
4241
|
+
t
|
|
4242
|
+
]);
|
|
2969
4243
|
/** Worktree-group flow: hop the session into the EXISTING worktree
|
|
2970
4244
|
* directory. No git action, no confirm — the row menu's hop IS the jump
|
|
2971
4245
|
* (a directory jump is reversible and touches nothing), and the owner's
|
|
2972
4246
|
* adoptWorktree registers the folder and opens a blank session there. */
|
|
2973
4247
|
const doAdoptWorktree = (0, react.useCallback)((path) => {
|
|
2974
|
-
if (
|
|
4248
|
+
if (blocked()) return;
|
|
2975
4249
|
busyRef.current = true;
|
|
2976
4250
|
setBusy(true);
|
|
2977
4251
|
adoptWorktree(path).then(() => {
|
|
@@ -2982,7 +4256,11 @@ window.__ModuleLoader__.load({
|
|
|
2982
4256
|
busyRef.current = false;
|
|
2983
4257
|
setBusy(false);
|
|
2984
4258
|
});
|
|
2985
|
-
}, [
|
|
4259
|
+
}, [
|
|
4260
|
+
adoptWorktree,
|
|
4261
|
+
blocked,
|
|
4262
|
+
showError
|
|
4263
|
+
]);
|
|
2986
4264
|
/** Worktree flow: POST /worktree (create-or-reuse, or cut out a new
|
|
2987
4265
|
* branch under an explicit name), register the directory, hop sessions.
|
|
2988
4266
|
* After the hop the lazy auto-prune fires (fire-and-forget — a slow
|
|
@@ -3088,6 +4366,7 @@ window.__ModuleLoader__.load({
|
|
|
3088
4366
|
if (!busy) setConfirm(null);
|
|
3089
4367
|
}
|
|
3090
4368
|
};
|
|
4369
|
+
const pushBranchInfo = facts.branches.find((entry) => entry.kind === "local" && entry.name === pushBranch);
|
|
3091
4370
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3092
4371
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3093
4372
|
className: BranchChip_module_default.dock,
|
|
@@ -3133,7 +4412,7 @@ window.__ModuleLoader__.load({
|
|
|
3133
4412
|
},
|
|
3134
4413
|
onRemoveWorktree: stageRemoveWorktree,
|
|
3135
4414
|
worktreeRemovalBlocked: (path) => describeWorktreeRemoval(path).running,
|
|
3136
|
-
busy,
|
|
4415
|
+
busy: busy || syncJob !== void 0,
|
|
3137
4416
|
onCreate: (name, from, checkout, onSettled) => {
|
|
3138
4417
|
doCreateBranch(name, from, checkout, onSettled);
|
|
3139
4418
|
},
|
|
@@ -3149,11 +4428,19 @@ window.__ModuleLoader__.load({
|
|
|
3149
4428
|
onFetch: () => {
|
|
3150
4429
|
doFetch();
|
|
3151
4430
|
},
|
|
3152
|
-
fetchBusy,
|
|
4431
|
+
fetchBusy: syncJob?.kind === "fetch",
|
|
3153
4432
|
onUpdate: () => {
|
|
3154
4433
|
doUpdate();
|
|
3155
4434
|
},
|
|
3156
|
-
|
|
4435
|
+
hasRemotes: repoHasRemotes(facts.branches),
|
|
4436
|
+
onPush: (branch) => {
|
|
4437
|
+
if (blocked()) return;
|
|
4438
|
+
setConfirm(null);
|
|
4439
|
+
setMenuOpen(false);
|
|
4440
|
+
setPushResume(void 0);
|
|
4441
|
+
setPushBranch(branch);
|
|
4442
|
+
},
|
|
4443
|
+
updateBusy: syncJob?.kind === "update",
|
|
3157
4444
|
onSelect: (branch) => {
|
|
3158
4445
|
if (branch === facts.currentBranch) {
|
|
3159
4446
|
setMenuOpen(false);
|
|
@@ -3185,6 +4472,32 @@ window.__ModuleLoader__.load({
|
|
|
3185
4472
|
...isCutout && !cutoutValid ? { draftInvalid: true } : {},
|
|
3186
4473
|
...cutoutHint === void 0 ? {} : { draftHint: cutoutHint }
|
|
3187
4474
|
}),
|
|
4475
|
+
pushBranch !== null && cwd !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PushDialog, {
|
|
4476
|
+
repoPath: cwd,
|
|
4477
|
+
repoName: facts.repoName,
|
|
4478
|
+
branch: pushBranch,
|
|
4479
|
+
busy,
|
|
4480
|
+
t,
|
|
4481
|
+
...pushBranchInfo === void 0 ? {} : { branchInfo: pushBranchInfo },
|
|
4482
|
+
...pushResume === void 0 ? {} : { resume: pushResume },
|
|
4483
|
+
onClose: () => {
|
|
4484
|
+
if (busyRef.current) return;
|
|
4485
|
+
setPushBranch(null);
|
|
4486
|
+
setPushResume(void 0);
|
|
4487
|
+
},
|
|
4488
|
+
onPush: (options) => doPush({
|
|
4489
|
+
branch: pushBranch,
|
|
4490
|
+
...options
|
|
4491
|
+
})
|
|
4492
|
+
}, `${cwd}:${pushBranch}`),
|
|
4493
|
+
syncJob !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SyncProgress, {
|
|
4494
|
+
job: syncJob,
|
|
4495
|
+
branch: facts.currentBranch,
|
|
4496
|
+
t,
|
|
4497
|
+
onCancel: () => {
|
|
4498
|
+
cancelSyncJob(syncJob.cwd);
|
|
4499
|
+
}
|
|
4500
|
+
}),
|
|
3188
4501
|
toasts[0] !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
3189
4502
|
text: toasts[0].text,
|
|
3190
4503
|
onDone: () => {
|
|
@@ -4437,7 +5750,7 @@ window.__ModuleLoader__.load({
|
|
|
4437
5750
|
menuNewBranchBad: "Git will not accept this name",
|
|
4438
5751
|
menuNewBranchExists: "A branch with this name already exists",
|
|
4439
5752
|
menuFetch: "Fetch",
|
|
4440
|
-
menuUpdate: "Update
|
|
5753
|
+
menuUpdate: "Update",
|
|
4441
5754
|
ctxCheckout: "Check out",
|
|
4442
5755
|
ctxHop: "Go to this worktree",
|
|
4443
5756
|
ctxWorktree: "Create worktree",
|
|
@@ -4459,8 +5772,59 @@ window.__ModuleLoader__.load({
|
|
|
4459
5772
|
fetchDone: "Remote branches synced",
|
|
4460
5773
|
updateDone: "{branch} fast-forwarded to its upstream",
|
|
4461
5774
|
updateUpToDate: "Already up to date",
|
|
4462
|
-
|
|
4463
|
-
|
|
5775
|
+
updateFailDiverged: "The branch has diverged. Merge or rebase its upstream first.",
|
|
5776
|
+
updateFailDirty: "Uncommitted changes would be overwritten by the fast-forward. Commit or stash them, then update again.",
|
|
5777
|
+
updateFailNoUpstream: "This branch has no upstream to update from. Push it and set an upstream first.",
|
|
5778
|
+
syncTitleFetch: "Fetching remote branches",
|
|
5779
|
+
syncTitleUpdate: "Updating {branch}",
|
|
5780
|
+
syncTitlePush: "Pushing {branch}",
|
|
5781
|
+
syncConnecting: "Connecting to the remote…",
|
|
5782
|
+
syncMerging: "Fast-forwarding {branch}…",
|
|
5783
|
+
syncCancel: "Cancel",
|
|
5784
|
+
fetchCancelled: "Fetch cancelled",
|
|
5785
|
+
updateCancelled: "Update cancelled",
|
|
5786
|
+
pushCancelled: "Push cancelled",
|
|
5787
|
+
"aheadTitle.one": "{n} commit ahead of upstream",
|
|
5788
|
+
"aheadTitle.other": "{n} commits ahead of upstream",
|
|
5789
|
+
"behindTitle.one": "{n} commit behind upstream",
|
|
5790
|
+
"behindTitle.other": "{n} commits behind upstream",
|
|
5791
|
+
unpublishedTitle: "Not pushed — no upstream configured",
|
|
5792
|
+
upstreamGoneTitle: "Upstream {upstream} no longer exists; choose a push destination",
|
|
5793
|
+
ctxPush: "Push",
|
|
5794
|
+
pushTitle: "Push",
|
|
5795
|
+
pushEditTarget: "Edit target branch",
|
|
5796
|
+
pushEditTargetClose: "Close without applying",
|
|
5797
|
+
pushApplyEnter: "Press Enter to apply",
|
|
5798
|
+
pushNew: "New",
|
|
5799
|
+
pushEmpty: "No commits to push",
|
|
5800
|
+
pushNewEmpty: "This branch will be created on the remote",
|
|
5801
|
+
"pushCommitCount.one": "{n} commit",
|
|
5802
|
+
"pushCommitCount.other": "{n} commits",
|
|
5803
|
+
pushFailBehind: "The remote branch has commits you do not have locally. Update the branch first, or use Force push to overwrite them.",
|
|
5804
|
+
pushFailStale: "The remote branch changed after the preview. The preview was refreshed; review it and push again.",
|
|
5805
|
+
pushFailHook: "A local pre-push hook refused this push. See the details below.",
|
|
5806
|
+
pushFailRefused: "The remote refused the update (for example a protected branch or a server-side hook). See the details below.",
|
|
5807
|
+
pushFailAuth: "Authentication failed. Check your Git credentials or SSH key; the plugin cannot prompt for a password.",
|
|
5808
|
+
pushCommitList: "Commits to push",
|
|
5809
|
+
pushTruncated: "Showing the first {n} commits",
|
|
5810
|
+
pushTags: "Push tags",
|
|
5811
|
+
pushTagsAll: "All",
|
|
5812
|
+
pushTagsFollow: "Follow commits",
|
|
5813
|
+
pushTagsAllHint: "Push all local Git tags, including tags unrelated to this branch",
|
|
5814
|
+
pushTagsFollowHint: "Push missing annotated tags reachable from the pushed history; excludes lightweight tags",
|
|
5815
|
+
pushForce: "Force push",
|
|
5816
|
+
pushForceHint: "Uses force-with-lease; refuses to overwrite remote changes made after preview",
|
|
5817
|
+
pushOptions: "Push options",
|
|
5818
|
+
pushRefresh: "Refresh push preview",
|
|
5819
|
+
pushBranch: "Remote branch name",
|
|
5820
|
+
pushPlanning: "Reading local commits…",
|
|
5821
|
+
pushCheckingRemote: "Checking remote destination…",
|
|
5822
|
+
pushLocalChecking: "Local preview · checking remote…",
|
|
5823
|
+
pushLocalUnverified: "Local preview · remote unverified",
|
|
5824
|
+
pushLocalEmpty: "No commits found in the local preview",
|
|
5825
|
+
pushReadingCommits: "Reading commit messages…",
|
|
5826
|
+
pushBusy: "Pushing…",
|
|
5827
|
+
pushDone: "{branch} pushed to {remote}/{target}",
|
|
4464
5828
|
worktreeAskNew: "Create a worktree from {branch}?",
|
|
4465
5829
|
worktreeAskRemote: "Create a worktree from this remote branch?",
|
|
4466
5830
|
worktreeAskReuse: "Switch to the {branch} worktree?",
|
|
@@ -4563,7 +5927,7 @@ window.__ModuleLoader__.load({
|
|
|
4563
5927
|
menuNewBranchBad: "Git 不接受该名称",
|
|
4564
5928
|
menuNewBranchExists: "同名分支已存在",
|
|
4565
5929
|
menuFetch: "提取",
|
|
4566
|
-
menuUpdate: "
|
|
5930
|
+
menuUpdate: "更新",
|
|
4567
5931
|
ctxCheckout: "签出",
|
|
4568
5932
|
ctxHop: "跳到此工作树",
|
|
4569
5933
|
ctxWorktree: "创建工作树",
|
|
@@ -4585,8 +5949,59 @@ window.__ModuleLoader__.load({
|
|
|
4585
5949
|
fetchDone: "远程分支已同步",
|
|
4586
5950
|
updateDone: "{branch} 已快进到远程最新",
|
|
4587
5951
|
updateUpToDate: "已是最新",
|
|
4588
|
-
|
|
4589
|
-
|
|
5952
|
+
updateFailDiverged: "分支已分叉,请先合并或变基上游。",
|
|
5953
|
+
updateFailDirty: "工作区有未提交的改动,快进会覆盖它们。请先提交或暂存这些改动,再更新。",
|
|
5954
|
+
updateFailNoUpstream: "当前分支没有可用的上游,无法更新。请先推送并设置上游。",
|
|
5955
|
+
syncTitleFetch: "正在提取远程分支",
|
|
5956
|
+
syncTitleUpdate: "正在更新 {branch}",
|
|
5957
|
+
syncTitlePush: "正在推送 {branch}",
|
|
5958
|
+
syncConnecting: "正在连接远程…",
|
|
5959
|
+
syncMerging: "正在快进 {branch}…",
|
|
5960
|
+
syncCancel: "取消",
|
|
5961
|
+
fetchCancelled: "已取消提取",
|
|
5962
|
+
updateCancelled: "已取消更新",
|
|
5963
|
+
pushCancelled: "已取消推送",
|
|
5964
|
+
"aheadTitle.one": "领先上游 {n} 个提交",
|
|
5965
|
+
"aheadTitle.other": "领先上游 {n} 个提交",
|
|
5966
|
+
"behindTitle.one": "落后上游 {n} 个提交",
|
|
5967
|
+
"behindTitle.other": "落后上游 {n} 个提交",
|
|
5968
|
+
unpublishedTitle: "尚未推送:未配置上游分支",
|
|
5969
|
+
upstreamGoneTitle: "上游 {upstream} 已失效,请重新选择推送目标",
|
|
5970
|
+
ctxPush: "推送",
|
|
5971
|
+
pushTitle: "推送",
|
|
5972
|
+
pushEditTarget: "修改目标分支",
|
|
5973
|
+
pushEditTargetClose: "关闭且不应用",
|
|
5974
|
+
pushApplyEnter: "按 Enter 应用",
|
|
5975
|
+
pushNew: "新建",
|
|
5976
|
+
pushEmpty: "没有待推送的提交",
|
|
5977
|
+
pushNewEmpty: "将在远程新建此分支",
|
|
5978
|
+
"pushCommitCount.one": "{n} 个提交",
|
|
5979
|
+
"pushCommitCount.other": "{n} 个提交",
|
|
5980
|
+
pushFailBehind: "远程分支有本地没有的提交。请先更新该分支,或使用“强制推送”覆盖它们。",
|
|
5981
|
+
pushFailStale: "预览之后远程分支又有更新,预览已刷新。请确认后重新推送。",
|
|
5982
|
+
pushFailHook: "本地的 pre-push 钩子拒绝了这次推送。详情见下方。",
|
|
5983
|
+
pushFailRefused: "远程拒绝了本次更新(例如受保护分支或服务端钩子)。详情见下方。",
|
|
5984
|
+
pushFailAuth: "认证失败。请检查 Git 凭据或 SSH 密钥;插件无法弹出密码输入。",
|
|
5985
|
+
pushCommitList: "待推送提交列表",
|
|
5986
|
+
pushTruncated: "仅显示前 {n} 条提交",
|
|
5987
|
+
pushTags: "推送标记",
|
|
5988
|
+
pushTagsAll: "所有",
|
|
5989
|
+
pushTagsFollow: "跟随提交",
|
|
5990
|
+
pushTagsAllHint: "推送所有本地 Git 标记,包括与当前分支无关的标记",
|
|
5991
|
+
pushTagsFollowHint: "仅推送远程缺少、且指向本次推送提交历史的附注标记,不含轻量标记",
|
|
5992
|
+
pushForce: "强制推送",
|
|
5993
|
+
pushForceHint: "使用 force-with-lease;远程在预览后有更新时拒绝覆盖",
|
|
5994
|
+
pushOptions: "推送选项",
|
|
5995
|
+
pushRefresh: "刷新推送预览",
|
|
5996
|
+
pushBranch: "远程分支名称",
|
|
5997
|
+
pushPlanning: "正在读取本地提交…",
|
|
5998
|
+
pushCheckingRemote: "正在校验远程目标…",
|
|
5999
|
+
pushLocalChecking: "本地预览 · 正在校验远程…",
|
|
6000
|
+
pushLocalUnverified: "本地预览 · 远程尚未校验",
|
|
6001
|
+
pushLocalEmpty: "本地预览暂无待推送提交",
|
|
6002
|
+
pushReadingCommits: "正在读取提交消息…",
|
|
6003
|
+
pushBusy: "正在推送…",
|
|
6004
|
+
pushDone: "已将 {branch} 推送到 {remote}/{target}",
|
|
4590
6005
|
worktreeAskNew: "是否从 {branch} 新建工作树?",
|
|
4591
6006
|
worktreeAskRemote: "从该远程分支新建工作树?",
|
|
4592
6007
|
worktreeAskReuse: "是否切到 {branch} 工作树?",
|