@dungsil/dsh-plugin-ui-forge-worktree 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dungsil
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dungsil-ui-forge-worktree
3
+ name: '@dungsil/dsh-plugin-ui-forge-worktree'
package/dist/client.js ADDED
@@ -0,0 +1,471 @@
1
+ window.__ModuleLoader__.load({ id: "@dungsil/dsh-plugin-ui-forge-worktree", factory(require) { const module = { exports: {} }; const exports = module.exports;
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
6
+ // ../../tools/ui/src/client.ts
7
+ function useLocaleSnapshot(locale) {
8
+ const subscribe = (0, react.useCallback)((listener) => locale.subscribe(listener), [locale]);
9
+ const getSnapshot = (0, react.useCallback)(() => locale.getSnapshot(), [locale]);
10
+ return (0, react.useSyncExternalStore)(subscribe, getSnapshot);
11
+ }
12
+ /** Each effect owns its sheet, even when another plugin installs the same defaults. */
13
+ function installStyles(css) {
14
+ const style = document.createElement("style");
15
+ style.textContent = css;
16
+ document.head.append(style);
17
+ return () => style.remove();
18
+ }
19
+ // ../../tools/ui/src/composer.tsx
20
+ const composerStyles = `
21
+ :where(.dsh-plugin-composer-trigger) { display: flex; align-items: center; gap: 4px; min-width: 0; height: 28px; padding: 0 4px 0 8px; border: 0; border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; line-height: 1.5385; cursor: pointer; }
22
+ :where(.dsh-plugin-composer-trigger):disabled { color: var(--dsw-alias-label-dimmed); cursor: default; }
23
+ .dsh-plugin-composer-icon, .dsh-plugin-composer-chevron { display: inline-flex; flex: none; }
24
+ .dsh-plugin-composer-label, .dsh-plugin-composer-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
25
+ .dsh-plugin-composer-chevron, .dsh-plugin-composer-detail { color: var(--dsw-alias-label-caption); }
26
+ .dsh-plugin-composer-trigger[aria-expanded=true] .dsh-plugin-composer-chevron { transform: rotate(180deg); }
27
+ `;
28
+ const ComposerTrigger = /* @__PURE__ */ (0, react.forwardRef)(function ComposerTrigger({ className = "", icon, label, detail, ...props }, ref) {
29
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
30
+ ...props,
31
+ ref,
32
+ type: "button",
33
+ className: `dsh-plugin-composer-trigger ${className}`,
34
+ children: [
35
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
36
+ className: "dsh-plugin-composer-icon",
37
+ "aria-hidden": "true",
38
+ children: icon
39
+ }),
40
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
41
+ className: "dsh-plugin-composer-label",
42
+ children: label
43
+ }),
44
+ detail && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
45
+ className: "dsh-plugin-composer-detail",
46
+ children: detail
47
+ }),
48
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
49
+ className: "dsh-plugin-composer-chevron",
50
+ "aria-hidden": "true",
51
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {})
52
+ })
53
+ ]
54
+ });
55
+ });
56
+ // src/copy.ts
57
+ const copy = {
58
+ en: {
59
+ "title": "Worktree",
60
+ "create": "New worktree",
61
+ "current": "Current branch",
62
+ "detached": "Detached HEAD",
63
+ "loading": "Loading worktree…",
64
+ "saving": "Saving selection…",
65
+ "reserved": "A new worktree will be created when you send your first message.",
66
+ "locked": "The worktree selection cannot be changed after this session starts.",
67
+ "error": "Could not confirm the worktree selection. Refresh before trying again.",
68
+ "refresh": "Refresh selection",
69
+ "blocked": "A new worktree is not available for this checkout."
70
+ },
71
+ ko: {
72
+ "title": "워크트리",
73
+ "create": "새 워크트리",
74
+ "current": "현재 브랜치",
75
+ "detached": "분리된 HEAD",
76
+ "loading": "워크트리를 불러오는 중…",
77
+ "saving": "선택을 저장하는 중…",
78
+ "reserved": "첫 메시지를 보내면 새 워크트리가 생성됩니다.",
79
+ "locked": "세션이 시작된 후에는 워크트리 선택을 변경할 수 없습니다.",
80
+ "error": "워크트리 선택을 확인하지 못했습니다. 새로고침한 후 다시 시도하세요.",
81
+ "refresh": "선택 새로고침",
82
+ "blocked": "이 체크아웃에서는 새 워크트리를 사용할 수 없습니다."
83
+ },
84
+ zh: {
85
+ "title": "工作树",
86
+ "create": "新建工作树",
87
+ "current": "当前分支",
88
+ "detached": "分离的 HEAD",
89
+ "loading": "正在加载工作树…",
90
+ "saving": "正在保存选择…",
91
+ "reserved": "发送第一条消息时将创建新工作树。",
92
+ "locked": "会话开始后无法更改工作树选择。",
93
+ "error": "无法确认工作树选择。请刷新后重试。",
94
+ "refresh": "刷新选择",
95
+ "blocked": "此检出目录无法使用新工作树。"
96
+ },
97
+ ja: {
98
+ "title": "ワークツリー",
99
+ "create": "新しいワークツリー",
100
+ "current": "現在のブランチ",
101
+ "detached": "分離された HEAD",
102
+ "loading": "ワークツリーを読み込み中…",
103
+ "saving": "選択を保存中…",
104
+ "reserved": "最初のメッセージを送信すると、新しいワークツリーが作成されます。",
105
+ "locked": "セッション開始後はワークツリーの選択を変更できません。",
106
+ "error": "ワークツリーの選択を確認できませんでした。更新してから再試行してください。",
107
+ "refresh": "選択を更新",
108
+ "blocked": "このチェックアウトでは新しいワークツリーを利用できません。"
109
+ },
110
+ es: {
111
+ "title": "Árbol de trabajo",
112
+ "create": "Nuevo árbol de trabajo",
113
+ "current": "Rama actual",
114
+ "detached": "HEAD separado",
115
+ "loading": "Cargando el árbol de trabajo…",
116
+ "saving": "Guardando la selección…",
117
+ "reserved": "Se creará un nuevo árbol de trabajo al enviar tu primer mensaje.",
118
+ "locked": "No se puede cambiar la selección del árbol de trabajo una vez iniciada esta sesión.",
119
+ "error": "No se pudo confirmar la selección del árbol de trabajo. Actualiza antes de volver a intentarlo.",
120
+ "refresh": "Actualizar selección",
121
+ "blocked": "No hay un nuevo árbol de trabajo disponible para este checkout."
122
+ },
123
+ fr: {
124
+ "title": "Arbre de travail",
125
+ "create": "Nouvel arbre de travail",
126
+ "current": "Branche actuelle",
127
+ "detached": "HEAD détachée",
128
+ "loading": "Chargement de l’arbre de travail…",
129
+ "saving": "Enregistrement de la sélection…",
130
+ "reserved": "Un nouvel arbre de travail sera créé à l’envoi de votre premier message.",
131
+ "locked": "La sélection de l’arbre de travail ne peut plus être modifiée une fois cette session démarrée.",
132
+ "error": "Impossible de confirmer la sélection de l’arbre de travail. Actualisez avant de réessayer.",
133
+ "refresh": "Actualiser la sélection",
134
+ "blocked": "Aucun nouvel arbre de travail n’est disponible pour cette copie de travail."
135
+ },
136
+ de: {
137
+ "title": "Worktree",
138
+ "create": "Neuer Worktree",
139
+ "current": "Aktueller Branch",
140
+ "detached": "Losgelöster HEAD",
141
+ "loading": "Worktree wird geladen…",
142
+ "saving": "Auswahl wird gespeichert…",
143
+ "reserved": "Ein neuer Worktree wird erstellt, wenn Sie Ihre erste Nachricht senden.",
144
+ "locked": "Die Worktree-Auswahl kann nach dem Start dieser Sitzung nicht mehr geändert werden.",
145
+ "error": "Die Worktree-Auswahl konnte nicht bestätigt werden. Aktualisieren Sie vor einem erneuten Versuch.",
146
+ "refresh": "Auswahl aktualisieren",
147
+ "blocked": "Für diesen Checkout ist kein neuer Worktree verfügbar."
148
+ },
149
+ ru: {
150
+ "title": "Рабочее дерево",
151
+ "create": "Новое рабочее дерево",
152
+ "current": "Текущая ветка",
153
+ "detached": "Отсоединённый HEAD",
154
+ "loading": "Загрузка рабочего дерева…",
155
+ "saving": "Сохранение выбора…",
156
+ "reserved": "Новое рабочее дерево будет создано при отправке первого сообщения.",
157
+ "locked": "Выбор рабочего дерева нельзя изменить после начала этой сессии.",
158
+ "error": "Не удалось подтвердить выбор рабочего дерева. Обновите данные перед повторной попыткой.",
159
+ "refresh": "Обновить выбор",
160
+ "blocked": "Для этой рабочей копии новое рабочее дерево недоступно."
161
+ },
162
+ pt: {
163
+ "title": "Árvore de trabalho",
164
+ "create": "Nova árvore de trabalho",
165
+ "current": "Branch atual",
166
+ "detached": "HEAD desanexado",
167
+ "loading": "Carregando a árvore de trabalho…",
168
+ "saving": "Salvando a seleção…",
169
+ "reserved": "Uma nova árvore de trabalho será criada quando você enviar a primeira mensagem.",
170
+ "locked": "A seleção da árvore de trabalho não pode ser alterada após o início desta sessão.",
171
+ "error": "Não foi possível confirmar a seleção da árvore de trabalho. Atualize antes de tentar novamente.",
172
+ "refresh": "Atualizar seleção",
173
+ "blocked": "Uma nova árvore de trabalho não está disponível para este checkout."
174
+ }
175
+ };
176
+ // src/styles.ts
177
+ const styles = `${composerStyles}
178
+ .dsh-forge-worktree { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; max-width: 100%; color: var(--dsw-alias-label-secondary); font: inherit; }
179
+ .dsh-forge-worktree-picker { display: inline-flex; min-width: 0; max-width: 100%; }
180
+ .dsh-forge-worktree-menu { overscroll-behavior: contain; }
181
+ .dsh-forge-worktree-trigger { max-width: 220px; font-weight: 500; }
182
+ .dsh-forge-worktree-trigger .dsh-plugin-composer-icon svg { width: 14px; height: 14px; }
183
+ .dsh-forge-worktree-option { display: flex; align-items: center; gap: 8px; min-width: 0; }
184
+ .dsh-forge-worktree-option > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
185
+ .dsh-forge-worktree-option > svg { flex: none; width: 14px; height: 14px; margin-inline-start: auto; color: var(--dsw-alias-label-primary); }
186
+ .dsh-forge-worktree-badge { flex: none; padding: 1px 5px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); color: var(--dsw-alias-label-secondary); font-size: 11px; line-height: 16px; font-weight: 400; }
187
+ .dsh-forge-worktree-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
188
+ .dsh-forge-worktree-error { color: var(--dsw-alias-state-error-primary); font-size: 12px; overflow-wrap: anywhere; }
189
+ .dsh-forge-worktree-refresh { border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: transparent; color: inherit; padding: 3px 6px; font: inherit; cursor: pointer; }
190
+ .dsh-forge-worktree-trigger:focus-visible, .dsh-forge-worktree-refresh:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-brand-primary)); outline-offset: 2px; }
191
+ @media (hover: hover) { .dsh-forge-worktree-refresh:hover { background: var(--dsw-alias-bg-layer-2); } }
192
+ `;
193
+ // src/client.tsx
194
+ const name = "dungsil-ui-forge-worktree";
195
+ const inject = [
196
+ "slots",
197
+ "locale",
198
+ "remote",
199
+ "remote.forgePanel"
200
+ ];
201
+ /** One serialized writer, with selection receipts taken from a fresh Host stream. */
202
+ var SelectionController = class {
203
+ remote;
204
+ id;
205
+ snapshot = {
206
+ busy: false,
207
+ error: false
208
+ };
209
+ listeners = /* @__PURE__ */ new Set();
210
+ lifetime = new AbortController();
211
+ feed;
212
+ writing = false;
213
+ constructor(remote, id) {
214
+ this.remote = remote;
215
+ this.id = id;
216
+ }
217
+ getSnapshot = () => this.snapshot;
218
+ subscribe = (listener) => {
219
+ this.listeners.add(listener);
220
+ return () => {
221
+ this.listeners.delete(listener);
222
+ };
223
+ };
224
+ publish(next) {
225
+ if (this.lifetime.signal.aborted) return;
226
+ this.snapshot = next;
227
+ for (const listener of this.listeners) listener();
228
+ }
229
+ stopFeed() {
230
+ const feed = this.feed;
231
+ this.feed = void 0;
232
+ if (!feed) return;
233
+ clearTimeout(feed.timer);
234
+ feed.controller.abort();
235
+ try {
236
+ feed.stream.dispose();
237
+ } catch {}
238
+ }
239
+ activate() {
240
+ if (this.lifetime.signal.aborted) this.lifetime = new AbortController();
241
+ this.writing = false;
242
+ this.follow();
243
+ }
244
+ refresh = () => {
245
+ if (!this.writing) this.follow();
246
+ };
247
+ follow(expected) {
248
+ this.stopFeed();
249
+ if (this.lifetime.signal.aborted) return;
250
+ this.publish({
251
+ ...this.snapshot,
252
+ busy: true,
253
+ error: false
254
+ });
255
+ const controller = new AbortController();
256
+ let stream;
257
+ try {
258
+ stream = this.remote.follow(this.id, controller.signal);
259
+ } catch {
260
+ this.writing = false;
261
+ this.publish({
262
+ ...this.snapshot,
263
+ busy: false,
264
+ error: true
265
+ });
266
+ return;
267
+ }
268
+ const feed = {
269
+ controller,
270
+ stream,
271
+ timer: void 0
272
+ };
273
+ this.feed = feed;
274
+ const fail = () => {
275
+ if (this.feed !== feed) return;
276
+ this.stopFeed();
277
+ this.writing = false;
278
+ this.publish({
279
+ ...this.snapshot,
280
+ busy: false,
281
+ error: true
282
+ });
283
+ };
284
+ feed.timer = setTimeout(fail, 15e3);
285
+ (async () => {
286
+ try {
287
+ for await (const panel of stream) {
288
+ if (this.feed !== feed || controller.signal.aborted) return;
289
+ const confirmed = expected === void 0 || (expected === "new" ? panel.worktree.request !== null || panel.worktree.created !== null : panel.worktree.request === null);
290
+ if (confirmed) {
291
+ expected = void 0;
292
+ this.writing = false;
293
+ clearTimeout(feed.timer);
294
+ }
295
+ this.publish({
296
+ panel,
297
+ busy: !confirmed,
298
+ error: false
299
+ });
300
+ }
301
+ fail();
302
+ } catch {
303
+ fail();
304
+ }
305
+ })();
306
+ }
307
+ async choose(choice) {
308
+ const { panel, busy, error } = this.snapshot;
309
+ if (this.writing || busy || error || !panel || !panel.worktree.editable || panel.worktree.creation || panel.worktree.restoration || panel.worktree.created || choice === "new" && panel.worktree.blocker) return;
310
+ if (choice === "new" === (panel.worktree.request !== null)) return;
311
+ this.writing = true;
312
+ this.stopFeed();
313
+ const lifetime = this.lifetime;
314
+ this.publish({
315
+ ...this.snapshot,
316
+ busy: true,
317
+ error: false
318
+ });
319
+ try {
320
+ const result = choice === "new" ? await this.remote.requestWorktree(this.id, null, lifetime.signal) : await this.remote.cancelWorktree(this.id, lifetime.signal);
321
+ if (lifetime.signal.aborted) return;
322
+ if (!result.ok) throw result.error;
323
+ this.follow(choice);
324
+ } catch {
325
+ if (!lifetime.signal.aborted) {
326
+ this.writing = false;
327
+ this.stopFeed();
328
+ this.publish({
329
+ ...this.snapshot,
330
+ busy: false,
331
+ error: true
332
+ });
333
+ }
334
+ }
335
+ }
336
+ dispose() {
337
+ this.lifetime.abort();
338
+ this.stopFeed();
339
+ this.listeners.clear();
340
+ }
341
+ };
342
+ function apply(ctx) {
343
+ const remote = ctx.remote.forgePanel;
344
+ const controllers = /* @__PURE__ */ new Set();
345
+ ctx.effect(() => () => {
346
+ for (const controller of controllers) controller.dispose();
347
+ controllers.clear();
348
+ });
349
+ function Picker({ sessionId, useSession, useInput }) {
350
+ const { active } = useLocaleSnapshot(ctx.locale);
351
+ const text = copy[active.toLowerCase().split(/[-_]/)[0]] ?? copy.en;
352
+ const [controller] = (0, react.useState)(() => new SelectionController(remote, sessionId));
353
+ const state = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot);
354
+ const unavailable = useSession((s) => s.running || s.removed || s.openState !== "open" || s.pendingSubmissions.length > 0);
355
+ const inputBusy = useInput((input) => input.phase !== "plain");
356
+ const [open, setOpen] = (0, react.useState)(false);
357
+ const status = (0, react.useId)();
358
+ const available = (0, react.useRef)(false);
359
+ const worktree = state.panel?.worktree;
360
+ const disabled = unavailable || inputBusy || state.busy || state.error || !worktree?.editable || !!worktree.created || !!worktree.creation || !!worktree.restoration;
361
+ available.current = !disabled;
362
+ const branch = state.panel?.checkout.checkout?.branch ?? text.detached;
363
+ const requested = !!worktree?.request;
364
+ const label = state.busy ? state.panel ? text.saving : text.loading : worktree?.created?.branch ?? (requested ? text.create : branch);
365
+ (0, react.useEffect)(() => {
366
+ controllers.add(controller);
367
+ controller.activate();
368
+ const reset = ctx.on("connection/reset", () => controller.refresh());
369
+ return () => {
370
+ reset();
371
+ controller.dispose();
372
+ controllers.delete(controller);
373
+ };
374
+ }, [controller]);
375
+ (0, react.useEffect)(() => {
376
+ if (disabled) setOpen(false);
377
+ }, [disabled]);
378
+ const choose = (choice) => {
379
+ setOpen(false);
380
+ if (available.current) controller.choose(choice);
381
+ };
382
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
383
+ className: "dsh-forge-worktree",
384
+ children: [
385
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
386
+ open,
387
+ side: "top",
388
+ portal: true,
389
+ className: "dsh-forge-worktree-picker",
390
+ listClassName: "dsh-forge-worktree-menu",
391
+ onClose: () => setOpen(false),
392
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerTrigger, {
393
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, {}),
394
+ label,
395
+ disabled,
396
+ className: "dsh-forge-worktree-trigger",
397
+ "aria-label": `${text.title}: ${label}`,
398
+ "aria-haspopup": "menu",
399
+ "aria-expanded": open,
400
+ "aria-busy": state.busy,
401
+ "aria-describedby": status,
402
+ title: worktree && !worktree.editable ? text.locked : `${text.title}: ${label}`,
403
+ onClick: () => {
404
+ if (available.current) setOpen((value) => !value);
405
+ },
406
+ onKeyDown: (event) => {
407
+ if (available.current && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
408
+ event.preventDefault();
409
+ setOpen(true);
410
+ }
411
+ }
412
+ }),
413
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
414
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, {}),
415
+ current: requested,
416
+ disabled: !!worktree?.blocker,
417
+ onSelect: () => choose("new"),
418
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
419
+ className: "dsh-forge-worktree-option",
420
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text.create }), requested && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, {})]
421
+ })
422
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
423
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, {}),
424
+ current: !requested,
425
+ onSelect: () => choose("current"),
426
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
427
+ className: "dsh-forge-worktree-option",
428
+ children: [
429
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: branch }),
430
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
431
+ className: "dsh-forge-worktree-badge",
432
+ children: text.current
433
+ }),
434
+ !requested && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, {})
435
+ ]
436
+ })
437
+ })]
438
+ }),
439
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
440
+ id: status,
441
+ className: state.error ? "dsh-forge-worktree-error" : "dsh-forge-worktree-sr",
442
+ role: state.error ? "alert" : "status",
443
+ children: state.error ? text.error : state.busy ? label : worktree?.blocker ? text.blocked : requested ? text.reserved : ""
444
+ }),
445
+ state.error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
446
+ type: "button",
447
+ className: "dsh-forge-worktree-refresh",
448
+ onClick: controller.refresh,
449
+ children: text.refresh
450
+ })
451
+ ]
452
+ });
453
+ }
454
+ ctx.slots.inject("conversation.hero.options", () => ctx.slots.register({
455
+ name: "conversation.hero.options",
456
+ id: "forge-panel.worktree",
457
+ priority: -100
458
+ }, () => null));
459
+ ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
460
+ name: "conversation.input.left",
461
+ id: name,
462
+ order: -100
463
+ }, (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Picker, { ...props }, props.sessionId)));
464
+ ctx.effect(() => installStyles(styles), "ui-forge-worktree: composer styles");
465
+ }
466
+ exports.SelectionController = SelectionController;
467
+ exports.apply = apply;
468
+ exports.inject = inject;
469
+ exports.name = name;
470
+
471
+ return module.exports; } });
package/dist/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
2
+ <circle cx="6" cy="5" r="3"/>
3
+ <circle cx="6" cy="19" r="3"/>
4
+ <circle cx="18" cy="6" r="3"/>
5
+ <path d="M6 8v8M6 14h7a5 5 0 0 0 5-5"/>
6
+ </svg>
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // src/index.ts
2
+ const name = "dungsil-ui-forge-worktree";
3
+ function apply() {}
4
+ export { apply, name };
package/locale/de.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Worktree-Auswahl",
4
+ "description": "Wählen Sie den aktuellen Branch oder einen neuen Git-Worktree im Eingabefeld aus."
5
+ },
6
+ "ui": {
7
+ "title": "Worktree",
8
+ "create": "Neuer Worktree",
9
+ "current": "Aktueller Branch",
10
+ "detached": "Losgelöster HEAD",
11
+ "loading": "Worktree wird geladen…",
12
+ "saving": "Auswahl wird gespeichert…",
13
+ "reserved": "Ein neuer Worktree wird erstellt, wenn Sie Ihre erste Nachricht senden.",
14
+ "locked": "Die Worktree-Auswahl kann nach dem Start dieser Sitzung nicht mehr geändert werden.",
15
+ "error": "Die Worktree-Auswahl konnte nicht bestätigt werden. Aktualisieren Sie vor einem erneuten Versuch.",
16
+ "refresh": "Auswahl aktualisieren",
17
+ "blocked": "Für diesen Checkout ist kein neuer Worktree verfügbar."
18
+ }
19
+ }
package/locale/en.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Worktree picker",
4
+ "description": "Choose the current branch or a new Git worktree from the composer."
5
+ },
6
+ "ui": {
7
+ "title": "Worktree",
8
+ "create": "New worktree",
9
+ "current": "Current branch",
10
+ "detached": "Detached HEAD",
11
+ "loading": "Loading worktree…",
12
+ "saving": "Saving selection…",
13
+ "reserved": "A new worktree will be created when you send your first message.",
14
+ "locked": "The worktree selection cannot be changed after this session starts.",
15
+ "error": "Could not confirm the worktree selection. Refresh before trying again.",
16
+ "refresh": "Refresh selection",
17
+ "blocked": "A new worktree is not available for this checkout."
18
+ }
19
+ }
package/locale/es.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Selector de árboles de trabajo",
4
+ "description": "Elige la rama actual o un nuevo árbol de trabajo de Git desde el cuadro de entrada."
5
+ },
6
+ "ui": {
7
+ "title": "Árbol de trabajo",
8
+ "create": "Nuevo árbol de trabajo",
9
+ "current": "Rama actual",
10
+ "detached": "HEAD separado",
11
+ "loading": "Cargando el árbol de trabajo…",
12
+ "saving": "Guardando la selección…",
13
+ "reserved": "Se creará un nuevo árbol de trabajo al enviar tu primer mensaje.",
14
+ "locked": "No se puede cambiar la selección del árbol de trabajo una vez iniciada esta sesión.",
15
+ "error": "No se pudo confirmar la selección del árbol de trabajo. Actualiza antes de volver a intentarlo.",
16
+ "refresh": "Actualizar selección",
17
+ "blocked": "No hay un nuevo árbol de trabajo disponible para este checkout."
18
+ }
19
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Sélecteur d’arbres de travail",
4
+ "description": "Choisissez la branche actuelle ou un nouvel arbre de travail Git depuis la zone de saisie."
5
+ },
6
+ "ui": {
7
+ "title": "Arbre de travail",
8
+ "create": "Nouvel arbre de travail",
9
+ "current": "Branche actuelle",
10
+ "detached": "HEAD détachée",
11
+ "loading": "Chargement de l’arbre de travail…",
12
+ "saving": "Enregistrement de la sélection…",
13
+ "reserved": "Un nouvel arbre de travail sera créé à l’envoi de votre premier message.",
14
+ "locked": "La sélection de l’arbre de travail ne peut plus être modifiée une fois cette session démarrée.",
15
+ "error": "Impossible de confirmer la sélection de l’arbre de travail. Actualisez avant de réessayer.",
16
+ "refresh": "Actualiser la sélection",
17
+ "blocked": "Aucun nouvel arbre de travail n’est disponible pour cette copie de travail."
18
+ }
19
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "ワークツリー選択",
4
+ "description": "入力欄から現在のブランチまたは新しい Git ワークツリーを選択します。"
5
+ },
6
+ "ui": {
7
+ "title": "ワークツリー",
8
+ "create": "新しいワークツリー",
9
+ "current": "現在のブランチ",
10
+ "detached": "分離された HEAD",
11
+ "loading": "ワークツリーを読み込み中…",
12
+ "saving": "選択を保存中…",
13
+ "reserved": "最初のメッセージを送信すると、新しいワークツリーが作成されます。",
14
+ "locked": "セッション開始後はワークツリーの選択を変更できません。",
15
+ "error": "ワークツリーの選択を確認できませんでした。更新してから再試行してください。",
16
+ "refresh": "選択を更新",
17
+ "blocked": "このチェックアウトでは新しいワークツリーを利用できません。"
18
+ }
19
+ }
package/locale/ko.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "워크트리 선택기",
4
+ "description": "입력창에서 현재 브랜치나 새 Git 워크트리를 선택합니다."
5
+ },
6
+ "ui": {
7
+ "title": "워크트리",
8
+ "create": "새 워크트리",
9
+ "current": "현재 브랜치",
10
+ "detached": "분리된 HEAD",
11
+ "loading": "워크트리를 불러오는 중…",
12
+ "saving": "선택을 저장하는 중…",
13
+ "reserved": "첫 메시지를 보내면 새 워크트리가 생성됩니다.",
14
+ "locked": "세션이 시작된 후에는 워크트리 선택을 변경할 수 없습니다.",
15
+ "error": "워크트리 선택을 확인하지 못했습니다. 새로고침한 후 다시 시도하세요.",
16
+ "refresh": "선택 새로고침",
17
+ "blocked": "이 체크아웃에서는 새 워크트리를 사용할 수 없습니다."
18
+ }
19
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Seletor de árvores de trabalho",
4
+ "description": "Escolha a branch atual ou uma nova árvore de trabalho do Git no campo de mensagem."
5
+ },
6
+ "ui": {
7
+ "title": "Árvore de trabalho",
8
+ "create": "Nova árvore de trabalho",
9
+ "current": "Branch atual",
10
+ "detached": "HEAD desanexado",
11
+ "loading": "Carregando a árvore de trabalho…",
12
+ "saving": "Salvando a seleção…",
13
+ "reserved": "Uma nova árvore de trabalho será criada quando você enviar a primeira mensagem.",
14
+ "locked": "A seleção da árvore de trabalho não pode ser alterada após o início desta sessão.",
15
+ "error": "Não foi possível confirmar a seleção da árvore de trabalho. Atualize antes de tentar novamente.",
16
+ "refresh": "Atualizar seleção",
17
+ "blocked": "Uma nova árvore de trabalho não está disponível para este checkout."
18
+ }
19
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "Выбор рабочего дерева",
4
+ "description": "Выберите текущую ветку или новое рабочее дерево Git в поле ввода."
5
+ },
6
+ "ui": {
7
+ "title": "Рабочее дерево",
8
+ "create": "Новое рабочее дерево",
9
+ "current": "Текущая ветка",
10
+ "detached": "Отсоединённый HEAD",
11
+ "loading": "Загрузка рабочего дерева…",
12
+ "saving": "Сохранение выбора…",
13
+ "reserved": "Новое рабочее дерево будет создано при отправке первого сообщения.",
14
+ "locked": "Выбор рабочего дерева нельзя изменить после начала этой сессии.",
15
+ "error": "Не удалось подтвердить выбор рабочего дерева. Обновите данные перед повторной попыткой.",
16
+ "refresh": "Обновить выбор",
17
+ "blocked": "Для этой рабочей копии новое рабочее дерево недоступно."
18
+ }
19
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "meta": {
3
+ "title": "工作树选择器",
4
+ "description": "在输入框中选择当前分支或新建 Git 工作树。"
5
+ },
6
+ "ui": {
7
+ "title": "工作树",
8
+ "create": "新建工作树",
9
+ "current": "当前分支",
10
+ "detached": "分离的 HEAD",
11
+ "loading": "正在加载工作树…",
12
+ "saving": "正在保存选择…",
13
+ "reserved": "发送第一条消息时将创建新工作树。",
14
+ "locked": "会话开始后无法更改工作树选择。",
15
+ "error": "无法确认工作树选择。请刷新后重试。",
16
+ "refresh": "刷新选择",
17
+ "blocked": "此检出目录无法使用新工作树。"
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,105 @@
1
1
  {
2
2
  "name": "@dungsil/dsh-plugin-ui-forge-worktree",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Choose the current branch or a new Git worktree from the composer.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/dungsil/dsh-plugins.git",
9
+ "directory": "packages/ui-forge-worktree"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "locale",
14
+ "cordis.patch.yml"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ ".": "./dist/index.js",
19
+ "./client": "./dist/client.js",
20
+ "./package.json": "./package.json",
21
+ "./locale/*.json": "./locale/*.json",
22
+ "./icon": "./dist/icon.svg"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "devDependencies": {
28
+ "@deepseek-ai/cordis": "4.1.0",
29
+ "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.3",
30
+ "@deepseek-ai/dsh-client-connection": "0.2.2-rc.3",
31
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.3",
32
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.3",
33
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.3",
34
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.3",
35
+ "@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.3",
36
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.3",
37
+ "@dungsil/dsh-tsconfig": "0.0.0",
38
+ "@dungsil/dsh-ui": "0.0.0",
39
+ "@types/react": "18.3.31",
40
+ "react": "18.3.1",
41
+ "tsdown": "0.23.4"
42
+ },
43
+ "peerDependencies": {
44
+ "@deepseek-ai/cordis": "~4.1.0",
45
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.1"
46
+ },
47
+ "icon": "./dist/icon.svg",
48
+ "engines": {
49
+ "dsh": "^0.2.2-rc.1",
50
+ "node": ">=24.9.0"
51
+ },
52
+ "dsh": {
53
+ "bundle": {
54
+ "patch": "./cordis.patch.yml"
55
+ },
56
+ "client": {
57
+ "platform": "web",
58
+ "immediately": true,
59
+ "inject": [
60
+ "@deepseek-ai/dsh-api-remotes",
61
+ "@deepseek-ai/dsh-client-locale",
62
+ "@deepseek-ai/dsh-client-ui-conversation",
63
+ "@deepseek-ai/dsh-client-ui-session",
64
+ "@deepseek-ai/dsh-experimental-client-ui-forge"
65
+ ]
66
+ }
67
+ },
68
+ "market": {
69
+ "order": 9,
70
+ "title": {
71
+ "en": "Worktree picker",
72
+ "ko": "워크트리 선택기",
73
+ "zh": "工作树选择器",
74
+ "ja": "ワークツリー選択",
75
+ "es": "Selector de árboles de trabajo",
76
+ "fr": "Sélecteur d’arbres de travail",
77
+ "de": "Worktree-Auswahl",
78
+ "ru": "Выбор рабочего дерева",
79
+ "pt": "Seletor de árvores de trabalho"
80
+ },
81
+ "description": {
82
+ "en": "Choose the current branch or a new Git worktree from the composer.",
83
+ "ko": "입력창에서 현재 브랜치나 새 Git 워크트리를 선택합니다.",
84
+ "zh": "在输入框中选择当前分支或新建 Git 工作树。",
85
+ "ja": "入力欄から現在のブランチまたは新しい Git ワークツリーを選択します。",
86
+ "es": "Elige la rama actual o un nuevo árbol de trabajo de Git desde el cuadro de entrada.",
87
+ "fr": "Choisissez la branche actuelle ou un nouvel arbre de travail Git depuis la zone de saisie.",
88
+ "de": "Wählen Sie den aktuellen Branch oder einen neuen Git-Worktree im Eingabefeld aus.",
89
+ "ru": "Выберите текущую ветку или новое рабочее дерево Git в поле ввода.",
90
+ "pt": "Escolha a branch atual ou uma nova árvore de trabalho do Git no campo de mensagem."
91
+ },
92
+ "category": "ui",
93
+ "labels": [],
94
+ "keywords": [
95
+ "git",
96
+ "worktree",
97
+ "composer"
98
+ ]
99
+ },
100
+ "scripts": {
101
+ "build": "tsdown",
102
+ "typecheck": "tsc --noEmit",
103
+ "test": "node --test test/*.test.mjs"
104
+ }
6
105
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.