@dungsil/dsh-plugin-ui-forge-chip 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +920 -223
- package/dist/index.js +1041 -2
- package/locale/de.json +41 -13
- package/locale/en.json +41 -13
- package/locale/es.json +41 -13
- package/locale/fr.json +41 -13
- package/locale/ja.json +41 -13
- package/locale/ko.json +41 -13
- package/locale/pt.json +41 -13
- package/locale/ru.json +41 -13
- package/locale/zh.json +41 -13
- package/package.json +26 -12
package/dist/client.js
CHANGED
|
@@ -9,6 +9,15 @@ function useLocaleSnapshot(locale) {
|
|
|
9
9
|
const getSnapshot = (0, react.useCallback)(() => locale.getSnapshot(), [locale]);
|
|
10
10
|
return (0, react.useSyncExternalStore)(subscribe, getSnapshot);
|
|
11
11
|
}
|
|
12
|
+
/** Key of a per-language record for the language's primary subtag, falling back to `fallback`. */
|
|
13
|
+
function localizedLanguage(languages, language, fallback = "en") {
|
|
14
|
+
const base = language.toLowerCase().split(/[-_]/)[0];
|
|
15
|
+
return Object.hasOwn(languages, base) ? base : fallback;
|
|
16
|
+
}
|
|
17
|
+
/** Entry of a per-language record for the language's primary subtag, falling back to `fallback`. */
|
|
18
|
+
function localizedCopy(languages, language, fallback = "en") {
|
|
19
|
+
return languages[localizedLanguage(languages, language, fallback)];
|
|
20
|
+
}
|
|
12
21
|
/** Each effect owns its sheet, even when another plugin installs the same defaults. */
|
|
13
22
|
function installStyles(css) {
|
|
14
23
|
const style = document.createElement("style");
|
|
@@ -20,260 +29,552 @@ function installStyles(css) {
|
|
|
20
29
|
var en_default = {
|
|
21
30
|
meta: {
|
|
22
31
|
"title": "Forge Chips",
|
|
23
|
-
"description": "Commit, push and create or view PRs from compact composer chips
|
|
32
|
+
"description": "Commit, push and create or view PRs from compact composer chips. Git runs on the host and an auxiliary model writes commit messages."
|
|
24
33
|
},
|
|
25
|
-
commit: "Commit
|
|
26
|
-
|
|
34
|
+
commit: "Commit",
|
|
35
|
+
commitPush: "Commit & push",
|
|
36
|
+
defaultAction: "Default action",
|
|
37
|
+
menu: "More Git actions",
|
|
27
38
|
pr: "Create PR",
|
|
28
|
-
updatePr: "Update PR",
|
|
29
39
|
viewPr: "View PR",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
committing: "Committing…",
|
|
41
|
+
pushing: "Committing and pushing…",
|
|
42
|
+
creatingPr: "Creating PR…",
|
|
43
|
+
error: "Could not run the Git action. Check the session before retrying.",
|
|
44
|
+
errorUnavailable: "The session is busy or has no branch checked out. Try again when it is idle.",
|
|
45
|
+
errorNothingToCommit: "There are no changes to commit.",
|
|
46
|
+
errorMessageFailed: "Could not write a commit message. Check the commit message model settings.",
|
|
47
|
+
errorCommitFailed: "Git could not create the commit. Check commit hooks and your Git identity.",
|
|
48
|
+
errorNoRemote: "This branch has no remote to push to.",
|
|
49
|
+
errorPushFailed: "The commit was created, but the push failed. Check the remote and your credentials.",
|
|
50
|
+
errorNotPushed: "Push this branch before creating a PR.",
|
|
51
|
+
errorUnsupported: "Creating a PR is not supported for this code host.",
|
|
52
|
+
errorPrFailed: "Could not create the PR. Check that the code host CLI is signed in.",
|
|
36
53
|
checks: "Checks",
|
|
37
54
|
none: "No checks",
|
|
38
55
|
pending: "Pending",
|
|
39
56
|
success: "Passed",
|
|
40
57
|
failure: "Failed",
|
|
41
58
|
unknown: "Unknown",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
lookupError: "Git status is unavailable. Select View PR to check.",
|
|
60
|
+
integrateFf: "Fast-forward {branch}",
|
|
61
|
+
integrateCherryPick: "Cherry-pick into {branch}",
|
|
62
|
+
integrateMerge: "Merge into {branch}",
|
|
63
|
+
integrateRebase: "Rebase onto {branch}",
|
|
64
|
+
integrateSquash: "Squash into {branch}",
|
|
65
|
+
integrationMenu: "Choose how to integrate",
|
|
66
|
+
integrationHint: "Bring this worktree's commits into the current branch of the original checkout",
|
|
67
|
+
integrating: "Integrating…",
|
|
68
|
+
blockedReadOnly: "This session is read-only, so it cannot commit in the original checkout.",
|
|
69
|
+
blockedDetached: "The original checkout has no branch checked out.",
|
|
70
|
+
blockedInProgress: "A Git operation is in progress in the original checkout.",
|
|
71
|
+
blockedStaged: "The original checkout has staged changes.",
|
|
72
|
+
blockedOverlap: "Uncommitted changes in the original checkout overlap: {paths}",
|
|
73
|
+
integrationDone: "Integrated into {branch}.",
|
|
74
|
+
integrationStale: "The checkouts changed, so the proposal was refreshed. Check it and try again.",
|
|
75
|
+
integrationBusy: "Another integration or a turn is running. Try again when it finishes.",
|
|
76
|
+
integrationFailed: "Integration failed and was rolled back. The original checkout is unchanged.",
|
|
77
|
+
integrationCleanupRefused: "Integration stopped. Its Git state was left as-is because it may belong to another operation; check the original checkout.",
|
|
78
|
+
integrationError: "Could not integrate. Check the original checkout and try again.",
|
|
79
|
+
toolbar: "Git actions",
|
|
80
|
+
shortcut: "Git action {n}",
|
|
81
|
+
shortcutAlt: "Git action {n} (alternate)"
|
|
45
82
|
};
|
|
46
83
|
// locale/ko.json
|
|
47
84
|
var ko_default = {
|
|
48
85
|
meta: {
|
|
49
86
|
"title": "Forge 칩",
|
|
50
|
-
"description": "
|
|
87
|
+
"description": "입력창 칩으로 커밋·푸시·PR 생성과 조회를 실행합니다. Git은 호스트가 직접 실행하고 커밋 메시지는 보조 모델이 작성합니다."
|
|
51
88
|
},
|
|
52
|
-
commit: "
|
|
53
|
-
|
|
89
|
+
commit: "커밋",
|
|
90
|
+
commitPush: "커밋 & 푸시",
|
|
91
|
+
defaultAction: "기본 동작",
|
|
92
|
+
menu: "다른 Git 작업",
|
|
54
93
|
pr: "PR 생성",
|
|
55
|
-
updatePr: "PR 업데이트",
|
|
56
94
|
viewPr: "PR 보기",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
95
|
+
committing: "커밋 중…",
|
|
96
|
+
pushing: "커밋하고 푸시하는 중…",
|
|
97
|
+
creatingPr: "PR 생성 중…",
|
|
98
|
+
error: "Git 작업을 실행하지 못했습니다. 다시 시도하기 전에 세션을 확인하세요.",
|
|
99
|
+
errorUnavailable: "세션이 작업 중이거나 체크아웃된 브랜치가 없습니다. 세션이 대기 중일 때 다시 시도하세요.",
|
|
100
|
+
errorNothingToCommit: "커밋할 변경 사항이 없습니다.",
|
|
101
|
+
errorMessageFailed: "커밋 메시지를 작성하지 못했습니다. 커밋 메시지 모델 설정을 확인하세요.",
|
|
102
|
+
errorCommitFailed: "Git이 커밋을 만들지 못했습니다. 커밋 훅과 Git 사용자 정보를 확인하세요.",
|
|
103
|
+
errorNoRemote: "이 브랜치에는 푸시할 원격 저장소가 없습니다.",
|
|
104
|
+
errorPushFailed: "커밋은 만들었지만 푸시에 실패했습니다. 원격 저장소와 인증 정보를 확인하세요.",
|
|
105
|
+
errorNotPushed: "PR을 만들기 전에 이 브랜치를 푸시하세요.",
|
|
106
|
+
errorUnsupported: "이 코드 호스트에서는 PR 생성을 지원하지 않습니다.",
|
|
107
|
+
errorPrFailed: "PR을 만들지 못했습니다. 코드 호스트 CLI에 로그인되어 있는지 확인하세요.",
|
|
63
108
|
checks: "검사",
|
|
64
109
|
none: "검사 없음",
|
|
65
110
|
pending: "진행 중",
|
|
66
111
|
success: "통과",
|
|
67
112
|
failure: "실패",
|
|
68
113
|
unknown: "알 수 없음",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
114
|
+
lookupError: "Git 상태를 확인하지 못했습니다. PR 보기를 열어 확인하세요.",
|
|
115
|
+
integrateFf: "{branch}에 fast-forward",
|
|
116
|
+
integrateCherryPick: "{branch}에 cherry-pick",
|
|
117
|
+
integrateMerge: "{branch}에 병합",
|
|
118
|
+
integrateRebase: "{branch}에 rebase",
|
|
119
|
+
integrateSquash: "{branch}에 squash",
|
|
120
|
+
integrationMenu: "통합 방식 선택",
|
|
121
|
+
integrationHint: "이 워크트리의 커밋을 원본 작업 공간의 현재 브랜치로 가져옵니다",
|
|
122
|
+
integrating: "통합하는 중…",
|
|
123
|
+
blockedReadOnly: "이 세션은 읽기 전용이어서 원본 작업 공간에 커밋할 수 없습니다.",
|
|
124
|
+
blockedDetached: "원본 작업 공간에 체크아웃된 브랜치가 없습니다.",
|
|
125
|
+
blockedInProgress: "원본 작업 공간에서 진행 중인 Git 작업이 있습니다.",
|
|
126
|
+
blockedStaged: "원본 작업 공간에 staged 변경 사항이 있습니다.",
|
|
127
|
+
blockedOverlap: "원본 작업 공간의 커밋하지 않은 변경 사항과 겹칩니다: {paths}",
|
|
128
|
+
integrationDone: "{branch}에 통합했습니다.",
|
|
129
|
+
integrationStale: "체크아웃이 바뀌어 제안을 새로 고쳤습니다. 확인한 뒤 다시 시도하세요.",
|
|
130
|
+
integrationBusy: "다른 통합이나 턴이 실행 중입니다. 끝난 뒤 다시 시도하세요.",
|
|
131
|
+
integrationFailed: "통합에 실패하여 되돌렸습니다. 원본 작업 공간은 바뀌지 않았습니다.",
|
|
132
|
+
integrationCleanupRefused: "통합을 중단했습니다. 다른 작업의 Git 상태일 수 있어 그대로 두었으니 원본 작업 공간을 확인하세요.",
|
|
133
|
+
integrationError: "통합하지 못했습니다. 원본 작업 공간을 확인한 뒤 다시 시도하세요.",
|
|
134
|
+
toolbar: "Git 작업",
|
|
135
|
+
shortcut: "Git 작업 {n}",
|
|
136
|
+
shortcutAlt: "Git 작업 {n} (보조)"
|
|
72
137
|
};
|
|
73
138
|
// locale/zh.json
|
|
74
139
|
var zh_default = {
|
|
75
140
|
meta: {
|
|
76
141
|
"title": "Forge 操作按钮",
|
|
77
|
-
"description": "
|
|
142
|
+
"description": "通过输入框按钮提交、推送、创建或查看 PR。Git 由主机直接执行,提交信息由辅助模型生成。"
|
|
78
143
|
},
|
|
79
|
-
commit: "
|
|
80
|
-
|
|
144
|
+
commit: "提交",
|
|
145
|
+
commitPush: "提交并推送",
|
|
146
|
+
defaultAction: "默认操作",
|
|
147
|
+
menu: "更多 Git 操作",
|
|
81
148
|
pr: "创建 PR",
|
|
82
|
-
updatePr: "更新 PR",
|
|
83
149
|
viewPr: "查看 PR",
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
150
|
+
committing: "正在提交…",
|
|
151
|
+
pushing: "正在提交并推送…",
|
|
152
|
+
creatingPr: "正在创建 PR…",
|
|
153
|
+
error: "无法执行 Git 操作。请先检查会话再重试。",
|
|
154
|
+
errorUnavailable: "会话正忙或未检出分支。请在会话空闲时重试。",
|
|
155
|
+
errorNothingToCommit: "没有可提交的更改。",
|
|
156
|
+
errorMessageFailed: "无法生成提交信息。请检查提交信息的模型设置。",
|
|
157
|
+
errorCommitFailed: "Git 无法创建提交。请检查提交钩子和 Git 用户信息。",
|
|
158
|
+
errorNoRemote: "此分支没有可推送的远程仓库。",
|
|
159
|
+
errorPushFailed: "已创建提交,但推送失败。请检查远程仓库和凭据。",
|
|
160
|
+
errorNotPushed: "创建 PR 前请先推送此分支。",
|
|
161
|
+
errorUnsupported: "此代码托管平台不支持创建 PR。",
|
|
162
|
+
errorPrFailed: "无法创建 PR。请检查代码托管平台 CLI 是否已登录。",
|
|
90
163
|
checks: "检查",
|
|
91
164
|
none: "无检查",
|
|
92
165
|
pending: "进行中",
|
|
93
166
|
success: "通过",
|
|
94
167
|
failure: "失败",
|
|
95
168
|
unknown: "未知",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
169
|
+
lookupError: "无法获取 Git 状态。请打开“查看 PR”检查。",
|
|
170
|
+
integrateFf: "快进 {branch}",
|
|
171
|
+
integrateCherryPick: "Cherry-pick 到 {branch}",
|
|
172
|
+
integrateMerge: "合并到 {branch}",
|
|
173
|
+
integrateRebase: "变基到 {branch}",
|
|
174
|
+
integrateSquash: "Squash 到 {branch}",
|
|
175
|
+
integrationMenu: "选择集成方式",
|
|
176
|
+
integrationHint: "将此工作树的提交带入原始检出的当前分支",
|
|
177
|
+
integrating: "正在集成…",
|
|
178
|
+
blockedReadOnly: "此会话为只读,无法在原始检出中提交。",
|
|
179
|
+
blockedDetached: "原始检出没有检出任何分支。",
|
|
180
|
+
blockedInProgress: "原始检出中有正在进行的 Git 操作。",
|
|
181
|
+
blockedStaged: "原始检出中有已暂存的更改。",
|
|
182
|
+
blockedOverlap: "与原始检出中未提交的更改重叠:{paths}",
|
|
183
|
+
integrationDone: "已集成到 {branch}。",
|
|
184
|
+
integrationStale: "检出已变化,建议已刷新。请确认后重试。",
|
|
185
|
+
integrationBusy: "另一个集成或回合正在运行。请在其结束后重试。",
|
|
186
|
+
integrationFailed: "集成失败并已回滚。原始检出未被更改。",
|
|
187
|
+
integrationCleanupRefused: "集成已停止。其 Git 状态可能属于其他操作,因此保持原样;请检查原始检出。",
|
|
188
|
+
integrationError: "无法集成。请检查原始检出后重试。",
|
|
189
|
+
toolbar: "Git 操作",
|
|
190
|
+
shortcut: "Git 操作 {n}",
|
|
191
|
+
shortcutAlt: "Git 操作 {n}(备用)"
|
|
99
192
|
};
|
|
100
193
|
// locale/ja.json
|
|
101
194
|
var ja_default = {
|
|
102
195
|
meta: {
|
|
103
196
|
"title": "Forge チップ",
|
|
104
|
-
"description": "
|
|
197
|
+
"description": "入力欄のチップからコミット、プッシュ、PR の作成や表示を行います。Git はホストが直接実行し、コミットメッセージは補助モデルが作成します。"
|
|
105
198
|
},
|
|
106
|
-
commit: "
|
|
107
|
-
|
|
199
|
+
commit: "コミット",
|
|
200
|
+
commitPush: "コミット & プッシュ",
|
|
201
|
+
defaultAction: "既定の動作",
|
|
202
|
+
menu: "その他の Git 操作",
|
|
108
203
|
pr: "PR を作成",
|
|
109
|
-
updatePr: "PR を更新",
|
|
110
204
|
viewPr: "PR を表示",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
205
|
+
committing: "コミット中…",
|
|
206
|
+
pushing: "コミットしてプッシュ中…",
|
|
207
|
+
creatingPr: "PR を作成中…",
|
|
208
|
+
error: "Git 操作を実行できませんでした。再試行する前にセッションを確認してください。",
|
|
209
|
+
errorUnavailable: "セッションが処理中か、ブランチがチェックアウトされていません。待機中になってから再試行してください。",
|
|
210
|
+
errorNothingToCommit: "コミットする変更がありません。",
|
|
211
|
+
errorMessageFailed: "コミットメッセージを作成できませんでした。コミットメッセージのモデル設定を確認してください。",
|
|
212
|
+
errorCommitFailed: "Git がコミットを作成できませんでした。コミットフックと Git のユーザー情報を確認してください。",
|
|
213
|
+
errorNoRemote: "このブランチにはプッシュ先のリモートがありません。",
|
|
214
|
+
errorPushFailed: "コミットは作成されましたが、プッシュに失敗しました。リモートと認証情報を確認してください。",
|
|
215
|
+
errorNotPushed: "PR を作成する前にこのブランチをプッシュしてください。",
|
|
216
|
+
errorUnsupported: "このコードホストでは PR の作成に対応していません。",
|
|
217
|
+
errorPrFailed: "PR を作成できませんでした。コードホストの CLI にサインインしているか確認してください。",
|
|
117
218
|
checks: "チェック",
|
|
118
219
|
none: "チェックなし",
|
|
119
220
|
pending: "保留中",
|
|
120
221
|
success: "成功",
|
|
121
222
|
failure: "失敗",
|
|
122
223
|
unknown: "不明",
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
224
|
+
lookupError: "Git の状態を取得できません。「PR を表示」を選択して確認してください。",
|
|
225
|
+
integrateFf: "{branch} を fast-forward",
|
|
226
|
+
integrateCherryPick: "{branch} に cherry-pick",
|
|
227
|
+
integrateMerge: "{branch} にマージ",
|
|
228
|
+
integrateRebase: "{branch} にリベース",
|
|
229
|
+
integrateSquash: "{branch} に squash",
|
|
230
|
+
integrationMenu: "統合方法を選択",
|
|
231
|
+
integrationHint: "このワークツリーのコミットを元のチェックアウトの現在のブランチに取り込みます",
|
|
232
|
+
integrating: "統合しています…",
|
|
233
|
+
blockedReadOnly: "このセッションは読み取り専用のため、元のチェックアウトにコミットできません。",
|
|
234
|
+
blockedDetached: "元のチェックアウトでブランチがチェックアウトされていません。",
|
|
235
|
+
blockedInProgress: "元のチェックアウトで進行中の Git 操作があります。",
|
|
236
|
+
blockedStaged: "元のチェックアウトにステージ済みの変更があります。",
|
|
237
|
+
blockedOverlap: "元のチェックアウトの未コミットの変更と重なっています: {paths}",
|
|
238
|
+
integrationDone: "{branch} に統合しました。",
|
|
239
|
+
integrationStale: "チェックアウトが変わったため提案を更新しました。確認してから再試行してください。",
|
|
240
|
+
integrationBusy: "別の統合またはターンが実行中です。終了してから再試行してください。",
|
|
241
|
+
integrationFailed: "統合に失敗したため元に戻しました。元のチェックアウトは変更されていません。",
|
|
242
|
+
integrationCleanupRefused: "統合を中止しました。別の操作の Git 状態である可能性があるためそのままにしています。元のチェックアウトを確認してください。",
|
|
243
|
+
integrationError: "統合できませんでした。元のチェックアウトを確認してから再試行してください。",
|
|
244
|
+
toolbar: "Git 操作",
|
|
245
|
+
shortcut: "Git 操作 {n}",
|
|
246
|
+
shortcutAlt: "Git 操作 {n}(補助)"
|
|
126
247
|
};
|
|
127
248
|
// locale/es.json
|
|
128
249
|
var es_default = {
|
|
129
250
|
meta: {
|
|
130
251
|
"title": "Chips de Forge",
|
|
131
|
-
"description": "Haz commit, push y crea o consulta PR desde chips
|
|
252
|
+
"description": "Haz commit, push y crea o consulta PR desde chips del cuadro de entrada. Git se ejecuta en el host y un modelo auxiliar redacta los mensajes de commit."
|
|
132
253
|
},
|
|
133
|
-
commit: "
|
|
134
|
-
|
|
254
|
+
commit: "Commit",
|
|
255
|
+
commitPush: "Commit y push",
|
|
256
|
+
defaultAction: "Acción predeterminada",
|
|
257
|
+
menu: "Más acciones de Git",
|
|
135
258
|
pr: "Crear PR",
|
|
136
|
-
updatePr: "Actualizar PR",
|
|
137
259
|
viewPr: "Ver PR",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
260
|
+
committing: "Haciendo commit…",
|
|
261
|
+
pushing: "Haciendo commit y push…",
|
|
262
|
+
creatingPr: "Creando PR…",
|
|
263
|
+
error: "No se pudo ejecutar la acción de Git. Revisa la sesión antes de reintentar.",
|
|
264
|
+
errorUnavailable: "La sesión está ocupada o no hay una rama activa. Reintenta cuando esté inactiva.",
|
|
265
|
+
errorNothingToCommit: "No hay cambios para hacer commit.",
|
|
266
|
+
errorMessageFailed: "No se pudo redactar el mensaje de commit. Revisa la configuración del modelo de mensajes de commit.",
|
|
267
|
+
errorCommitFailed: "Git no pudo crear el commit. Revisa los hooks de commit y tu identidad de Git.",
|
|
268
|
+
errorNoRemote: "Esta rama no tiene un remoto al que hacer push.",
|
|
269
|
+
errorPushFailed: "Se creó el commit, pero falló el push. Revisa el remoto y tus credenciales.",
|
|
270
|
+
errorNotPushed: "Haz push de esta rama antes de crear un PR.",
|
|
271
|
+
errorUnsupported: "Este servicio de alojamiento de código no admite crear PR.",
|
|
272
|
+
errorPrFailed: "No se pudo crear el PR. Comprueba que la CLI del servicio de código tenga la sesión iniciada.",
|
|
144
273
|
checks: "Comprobaciones",
|
|
145
274
|
none: "Sin comprobaciones",
|
|
146
275
|
pending: "Pendiente",
|
|
147
276
|
success: "Correcto",
|
|
148
277
|
failure: "Fallido",
|
|
149
278
|
unknown: "Desconocido",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
279
|
+
lookupError: "El estado de Git no está disponible. Selecciona Ver PR para comprobarlo.",
|
|
280
|
+
integrateFf: "Avance rápido de {branch}",
|
|
281
|
+
integrateCherryPick: "Cherry-pick en {branch}",
|
|
282
|
+
integrateMerge: "Fusionar en {branch}",
|
|
283
|
+
integrateRebase: "Rebase sobre {branch}",
|
|
284
|
+
integrateSquash: "Squash en {branch}",
|
|
285
|
+
integrationMenu: "Elegir cómo integrar",
|
|
286
|
+
integrationHint: "Lleva los commits de este árbol de trabajo a la rama actual del checkout original",
|
|
287
|
+
integrating: "Integrando…",
|
|
288
|
+
blockedReadOnly: "Esta sesión es de solo lectura, así que no puede hacer commits en el checkout original.",
|
|
289
|
+
blockedDetached: "El checkout original no tiene ninguna rama activa.",
|
|
290
|
+
blockedInProgress: "Hay una operación de Git en curso en el checkout original.",
|
|
291
|
+
blockedStaged: "El checkout original tiene cambios preparados.",
|
|
292
|
+
blockedOverlap: "Se solapa con cambios sin confirmar del checkout original: {paths}",
|
|
293
|
+
integrationDone: "Integrado en {branch}.",
|
|
294
|
+
integrationStale: "Los checkouts cambiaron y la propuesta se actualizó. Revísala e inténtalo de nuevo.",
|
|
295
|
+
integrationBusy: "Hay otra integración o un turno en curso. Inténtalo de nuevo cuando termine.",
|
|
296
|
+
integrationFailed: "La integración falló y se revirtió. El checkout original no cambió.",
|
|
297
|
+
integrationCleanupRefused: "La integración se detuvo. Su estado de Git se dejó tal cual porque puede pertenecer a otra operación; revisa el checkout original.",
|
|
298
|
+
integrationError: "No se pudo integrar. Revisa el checkout original e inténtalo de nuevo.",
|
|
299
|
+
toolbar: "Acciones de Git",
|
|
300
|
+
shortcut: "Acción de Git {n}",
|
|
301
|
+
shortcutAlt: "Acción de Git {n} (alternativa)"
|
|
153
302
|
};
|
|
154
303
|
// locale/fr.json
|
|
155
304
|
var fr_default = {
|
|
156
305
|
meta: {
|
|
157
306
|
"title": "Pastilles Forge",
|
|
158
|
-
"description": "Effectuez des commits et des push, créez ou consultez des PR depuis des pastilles
|
|
307
|
+
"description": "Effectuez des commits et des push, créez ou consultez des PR depuis des pastilles de la zone de saisie. Git s’exécute sur l’hôte et un modèle auxiliaire rédige les messages de commit."
|
|
159
308
|
},
|
|
160
|
-
commit: "Commit
|
|
161
|
-
|
|
309
|
+
commit: "Commit",
|
|
310
|
+
commitPush: "Commit et push",
|
|
311
|
+
defaultAction: "Action par défaut",
|
|
312
|
+
menu: "Autres actions Git",
|
|
162
313
|
pr: "Créer une PR",
|
|
163
|
-
updatePr: "Mettre à jour la PR",
|
|
164
314
|
viewPr: "Voir la PR",
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
315
|
+
committing: "Commit en cours…",
|
|
316
|
+
pushing: "Commit et push en cours…",
|
|
317
|
+
creatingPr: "Création de la PR…",
|
|
318
|
+
error: "Impossible d’exécuter l’action Git. Vérifiez la session avant de réessayer.",
|
|
319
|
+
errorUnavailable: "La session est occupée ou aucune branche n’est extraite. Réessayez quand elle est inactive.",
|
|
320
|
+
errorNothingToCommit: "Aucune modification à committer.",
|
|
321
|
+
errorMessageFailed: "Impossible de rédiger le message de commit. Vérifiez les réglages du modèle des messages de commit.",
|
|
322
|
+
errorCommitFailed: "Git n’a pas pu créer le commit. Vérifiez les hooks de commit et votre identité Git.",
|
|
323
|
+
errorNoRemote: "Cette branche n’a pas de dépôt distant vers lequel pousser.",
|
|
324
|
+
errorPushFailed: "Le commit a été créé, mais le push a échoué. Vérifiez le dépôt distant et vos identifiants.",
|
|
325
|
+
errorNotPushed: "Poussez cette branche avant de créer une PR.",
|
|
326
|
+
errorUnsupported: "Cet hébergeur de code ne prend pas en charge la création de PR.",
|
|
327
|
+
errorPrFailed: "Impossible de créer la PR. Vérifiez que la CLI de l’hébergeur de code est connectée.",
|
|
171
328
|
checks: "Vérifications",
|
|
172
329
|
none: "Aucune vérification",
|
|
173
330
|
pending: "En attente",
|
|
174
331
|
success: "Réussies",
|
|
175
332
|
failure: "Échouées",
|
|
176
333
|
unknown: "Inconnu",
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
334
|
+
lookupError: "L’état Git est indisponible. Sélectionnez Voir la PR pour vérifier.",
|
|
335
|
+
integrateFf: "Avance rapide de {branch}",
|
|
336
|
+
integrateCherryPick: "Cherry-pick dans {branch}",
|
|
337
|
+
integrateMerge: "Fusionner dans {branch}",
|
|
338
|
+
integrateRebase: "Rebaser sur {branch}",
|
|
339
|
+
integrateSquash: "Squash dans {branch}",
|
|
340
|
+
integrationMenu: "Choisir le mode d’intégration",
|
|
341
|
+
integrationHint: "Apporte les commits de cet arbre de travail dans la branche actuelle du checkout d’origine",
|
|
342
|
+
integrating: "Intégration…",
|
|
343
|
+
blockedReadOnly: "Cette session est en lecture seule ; elle ne peut pas valider dans le checkout d’origine.",
|
|
344
|
+
blockedDetached: "Aucune branche n’est extraite dans le checkout d’origine.",
|
|
345
|
+
blockedInProgress: "Une opération Git est en cours dans le checkout d’origine.",
|
|
346
|
+
blockedStaged: "Le checkout d’origine contient des modifications indexées.",
|
|
347
|
+
blockedOverlap: "Chevauche des modifications non validées du checkout d’origine : {paths}",
|
|
348
|
+
integrationDone: "Intégré dans {branch}.",
|
|
349
|
+
integrationStale: "Les checkouts ont changé ; la proposition a été actualisée. Vérifiez-la puis réessayez.",
|
|
350
|
+
integrationBusy: "Une autre intégration ou un tour est en cours. Réessayez une fois terminé.",
|
|
351
|
+
integrationFailed: "L’intégration a échoué et a été annulée. Le checkout d’origine n’a pas changé.",
|
|
352
|
+
integrationCleanupRefused: "L’intégration s’est arrêtée. Son état Git a été laissé tel quel car il peut appartenir à une autre opération ; vérifiez le checkout d’origine.",
|
|
353
|
+
integrationError: "Intégration impossible. Vérifiez le checkout d’origine puis réessayez.",
|
|
354
|
+
toolbar: "Actions Git",
|
|
355
|
+
shortcut: "Action Git {n}",
|
|
356
|
+
shortcutAlt: "Action Git {n} (secondaire)"
|
|
180
357
|
};
|
|
181
358
|
// locale/de.json
|
|
182
359
|
var de_default = {
|
|
183
360
|
meta: {
|
|
184
361
|
"title": "Forge-Chips",
|
|
185
|
-
"description": "Committen, pushen und PRs erstellen oder anzeigen
|
|
362
|
+
"description": "Committen, pushen und PRs erstellen oder anzeigen über Chips im Eingabefeld. Git läuft auf dem Host, ein Hilfsmodell schreibt die Commit-Nachrichten."
|
|
186
363
|
},
|
|
187
|
-
commit: "
|
|
188
|
-
|
|
364
|
+
commit: "Commit",
|
|
365
|
+
commitPush: "Commit & Push",
|
|
366
|
+
defaultAction: "Standardaktion",
|
|
367
|
+
menu: "Weitere Git-Aktionen",
|
|
189
368
|
pr: "PR erstellen",
|
|
190
|
-
updatePr: "PR aktualisieren",
|
|
191
369
|
viewPr: "PR anzeigen",
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
370
|
+
committing: "Wird committet…",
|
|
371
|
+
pushing: "Wird committet und gepusht…",
|
|
372
|
+
creatingPr: "PR wird erstellt…",
|
|
373
|
+
error: "Die Git-Aktion konnte nicht ausgeführt werden. Prüfen Sie die Sitzung, bevor Sie es erneut versuchen.",
|
|
374
|
+
errorUnavailable: "Die Sitzung ist beschäftigt oder es ist kein Branch ausgecheckt. Versuchen Sie es erneut, wenn sie bereit ist.",
|
|
375
|
+
errorNothingToCommit: "Es gibt keine Änderungen zum Committen.",
|
|
376
|
+
errorMessageFailed: "Die Commit-Nachricht konnte nicht erstellt werden. Prüfen Sie die Modelleinstellungen für Commit-Nachrichten.",
|
|
377
|
+
errorCommitFailed: "Git konnte den Commit nicht erstellen. Prüfen Sie Commit-Hooks und Ihre Git-Identität.",
|
|
378
|
+
errorNoRemote: "Dieser Branch hat kein Remote zum Pushen.",
|
|
379
|
+
errorPushFailed: "Der Commit wurde erstellt, aber der Push ist fehlgeschlagen. Prüfen Sie Remote und Zugangsdaten.",
|
|
380
|
+
errorNotPushed: "Pushen Sie diesen Branch, bevor Sie einen PR erstellen.",
|
|
381
|
+
errorUnsupported: "Dieser Code-Host unterstützt das Erstellen von PRs nicht.",
|
|
382
|
+
errorPrFailed: "Der PR konnte nicht erstellt werden. Prüfen Sie, ob die CLI des Code-Hosts angemeldet ist.",
|
|
198
383
|
checks: "Prüfungen",
|
|
199
384
|
none: "Keine Prüfungen",
|
|
200
385
|
pending: "Ausstehend",
|
|
201
386
|
success: "Bestanden",
|
|
202
387
|
failure: "Fehlgeschlagen",
|
|
203
388
|
unknown: "Unbekannt",
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
389
|
+
lookupError: "Der Git-Status ist nicht verfügbar. Wählen Sie zur Prüfung PR anzeigen.",
|
|
390
|
+
integrateFf: "{branch} vorspulen",
|
|
391
|
+
integrateCherryPick: "Cherry-Pick in {branch}",
|
|
392
|
+
integrateMerge: "In {branch} mergen",
|
|
393
|
+
integrateRebase: "Auf {branch} rebasen",
|
|
394
|
+
integrateSquash: "In {branch} squashen",
|
|
395
|
+
integrationMenu: "Integrationsart wählen",
|
|
396
|
+
integrationHint: "Übernimmt die Commits dieses Worktrees in den aktuellen Branch des ursprünglichen Checkouts",
|
|
397
|
+
integrating: "Wird integriert…",
|
|
398
|
+
blockedReadOnly: "Diese Sitzung ist schreibgeschützt und kann im ursprünglichen Checkout nicht committen.",
|
|
399
|
+
blockedDetached: "Im ursprünglichen Checkout ist kein Branch ausgecheckt.",
|
|
400
|
+
blockedInProgress: "Im ursprünglichen Checkout läuft ein Git-Vorgang.",
|
|
401
|
+
blockedStaged: "Der ursprüngliche Checkout hat vorgemerkte Änderungen.",
|
|
402
|
+
blockedOverlap: "Überschneidet sich mit nicht committeten Änderungen im ursprünglichen Checkout: {paths}",
|
|
403
|
+
integrationDone: "In {branch} integriert.",
|
|
404
|
+
integrationStale: "Die Checkouts haben sich geändert, daher wurde der Vorschlag aktualisiert. Prüfen Sie ihn und versuchen Sie es erneut.",
|
|
405
|
+
integrationBusy: "Eine andere Integration oder ein Durchlauf läuft. Versuchen Sie es danach erneut.",
|
|
406
|
+
integrationFailed: "Die Integration ist fehlgeschlagen und wurde zurückgesetzt. Der ursprüngliche Checkout ist unverändert.",
|
|
407
|
+
integrationCleanupRefused: "Die Integration wurde angehalten. Ihr Git-Zustand blieb unverändert, da er zu einem anderen Vorgang gehören kann; prüfen Sie den ursprünglichen Checkout.",
|
|
408
|
+
integrationError: "Integration nicht möglich. Prüfen Sie den ursprünglichen Checkout und versuchen Sie es erneut.",
|
|
409
|
+
toolbar: "Git-Aktionen",
|
|
410
|
+
shortcut: "Git-Aktion {n}",
|
|
411
|
+
shortcutAlt: "Git-Aktion {n} (alternativ)"
|
|
207
412
|
};
|
|
208
413
|
// locale/ru.json
|
|
209
414
|
var ru_default = {
|
|
210
415
|
meta: {
|
|
211
416
|
"title": "Кнопки Forge",
|
|
212
|
-
"description": "Делайте коммиты, отправляйте изменения, создавайте и просматривайте PR с помощью
|
|
417
|
+
"description": "Делайте коммиты, отправляйте изменения, создавайте и просматривайте PR с помощью кнопок в поле ввода. Git выполняется на хосте, а сообщения коммитов пишет вспомогательная модель."
|
|
213
418
|
},
|
|
214
|
-
commit: "
|
|
215
|
-
|
|
419
|
+
commit: "Коммит",
|
|
420
|
+
commitPush: "Коммит и push",
|
|
421
|
+
defaultAction: "Действие по умолчанию",
|
|
422
|
+
menu: "Другие действия Git",
|
|
216
423
|
pr: "Создать PR",
|
|
217
|
-
updatePr: "Обновить PR",
|
|
218
424
|
viewPr: "Просмотреть PR",
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
425
|
+
committing: "Создание коммита…",
|
|
426
|
+
pushing: "Коммит и отправка…",
|
|
427
|
+
creatingPr: "Создание PR…",
|
|
428
|
+
error: "Не удалось выполнить действие Git. Проверьте сеанс перед повтором.",
|
|
429
|
+
errorUnavailable: "Сеанс занят или ветка не выбрана. Повторите, когда сеанс освободится.",
|
|
430
|
+
errorNothingToCommit: "Нет изменений для коммита.",
|
|
431
|
+
errorMessageFailed: "Не удалось составить сообщение коммита. Проверьте настройки модели для сообщений коммитов.",
|
|
432
|
+
errorCommitFailed: "Git не смог создать коммит. Проверьте хуки коммита и данные пользователя Git.",
|
|
433
|
+
errorNoRemote: "У этой ветки нет удалённого репозитория для отправки.",
|
|
434
|
+
errorPushFailed: "Коммит создан, но отправить его не удалось. Проверьте удалённый репозиторий и учётные данные.",
|
|
435
|
+
errorNotPushed: "Отправьте ветку перед созданием PR.",
|
|
436
|
+
errorUnsupported: "Этот хостинг кода не поддерживает создание PR.",
|
|
437
|
+
errorPrFailed: "Не удалось создать PR. Проверьте, выполнен ли вход в CLI хостинга кода.",
|
|
225
438
|
checks: "Проверки",
|
|
226
439
|
none: "Нет проверок",
|
|
227
440
|
pending: "Ожидание",
|
|
228
441
|
success: "Пройдены",
|
|
229
442
|
failure: "Не пройдены",
|
|
230
443
|
unknown: "Неизвестно",
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
444
|
+
lookupError: "Состояние Git недоступно. Выберите «Просмотреть PR» для проверки.",
|
|
445
|
+
integrateFf: "Перемотать {branch}",
|
|
446
|
+
integrateCherryPick: "Cherry-pick в {branch}",
|
|
447
|
+
integrateMerge: "Слить в {branch}",
|
|
448
|
+
integrateRebase: "Перебазировать на {branch}",
|
|
449
|
+
integrateSquash: "Squash в {branch}",
|
|
450
|
+
integrationMenu: "Выбрать способ интеграции",
|
|
451
|
+
integrationHint: "Переносит коммиты этого рабочего дерева в текущую ветку исходного рабочего каталога",
|
|
452
|
+
integrating: "Интеграция…",
|
|
453
|
+
blockedReadOnly: "Этот сеанс доступен только для чтения, поэтому не может создавать коммиты в исходном рабочем каталоге.",
|
|
454
|
+
blockedDetached: "В исходном рабочем каталоге не выбрана ветка.",
|
|
455
|
+
blockedInProgress: "В исходном рабочем каталоге выполняется операция Git.",
|
|
456
|
+
blockedStaged: "В исходном рабочем каталоге есть проиндексированные изменения.",
|
|
457
|
+
blockedOverlap: "Пересекается с незафиксированными изменениями исходного рабочего каталога: {paths}",
|
|
458
|
+
integrationDone: "Интегрировано в {branch}.",
|
|
459
|
+
integrationStale: "Рабочие каталоги изменились, предложение обновлено. Проверьте его и повторите попытку.",
|
|
460
|
+
integrationBusy: "Выполняется другая интеграция или ход. Повторите попытку после завершения.",
|
|
461
|
+
integrationFailed: "Интеграция не удалась и была отменена. Исходный рабочий каталог не изменён.",
|
|
462
|
+
integrationCleanupRefused: "Интеграция остановлена. Состояние Git оставлено как есть, так как оно может принадлежать другой операции; проверьте исходный рабочий каталог.",
|
|
463
|
+
integrationError: "Не удалось выполнить интеграцию. Проверьте исходный рабочий каталог и повторите попытку.",
|
|
464
|
+
toolbar: "Действия Git",
|
|
465
|
+
shortcut: "Действие Git {n}",
|
|
466
|
+
shortcutAlt: "Действие Git {n} (дополнительное)"
|
|
234
467
|
};
|
|
235
468
|
// locale/pt.json
|
|
236
469
|
var pt_default = {
|
|
237
470
|
meta: {
|
|
238
471
|
"title": "Chips do Forge",
|
|
239
|
-
"description": "Faça commit, push e crie ou veja PRs em chips
|
|
472
|
+
"description": "Faça commit, push e crie ou veja PRs em chips do campo de mensagem. O Git roda no host e um modelo auxiliar escreve as mensagens de commit."
|
|
240
473
|
},
|
|
241
|
-
commit: "
|
|
242
|
-
|
|
474
|
+
commit: "Commit",
|
|
475
|
+
commitPush: "Commit e push",
|
|
476
|
+
defaultAction: "Ação padrão",
|
|
477
|
+
menu: "Mais ações do Git",
|
|
243
478
|
pr: "Criar PR",
|
|
244
|
-
updatePr: "Atualizar PR",
|
|
245
479
|
viewPr: "Ver PR",
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
480
|
+
committing: "Fazendo commit…",
|
|
481
|
+
pushing: "Fazendo commit e push…",
|
|
482
|
+
creatingPr: "Criando PR…",
|
|
483
|
+
error: "Não foi possível executar a ação do Git. Verifique a sessão antes de tentar novamente.",
|
|
484
|
+
errorUnavailable: "A sessão está ocupada ou não há branch ativa. Tente novamente quando ela estiver ociosa.",
|
|
485
|
+
errorNothingToCommit: "Não há alterações para fazer commit.",
|
|
486
|
+
errorMessageFailed: "Não foi possível escrever a mensagem de commit. Verifique as configurações do modelo de mensagens de commit.",
|
|
487
|
+
errorCommitFailed: "O Git não conseguiu criar o commit. Verifique os hooks de commit e sua identidade do Git.",
|
|
488
|
+
errorNoRemote: "Esta branch não tem um remoto para push.",
|
|
489
|
+
errorPushFailed: "O commit foi criado, mas o push falhou. Verifique o remoto e suas credenciais.",
|
|
490
|
+
errorNotPushed: "Faça push desta branch antes de criar um PR.",
|
|
491
|
+
errorUnsupported: "Este serviço de hospedagem de código não permite criar PR.",
|
|
492
|
+
errorPrFailed: "Não foi possível criar o PR. Verifique se a CLI do serviço de código está conectada.",
|
|
252
493
|
checks: "Verificações",
|
|
253
494
|
none: "Sem verificações",
|
|
254
495
|
pending: "Pendente",
|
|
255
496
|
success: "Aprovado",
|
|
256
497
|
failure: "Falhou",
|
|
257
498
|
unknown: "Desconhecido",
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
499
|
+
lookupError: "O status do Git não está disponível. Selecione Ver PR para verificar.",
|
|
500
|
+
integrateFf: "Avanço rápido de {branch}",
|
|
501
|
+
integrateCherryPick: "Cherry-pick em {branch}",
|
|
502
|
+
integrateMerge: "Mesclar em {branch}",
|
|
503
|
+
integrateRebase: "Rebase sobre {branch}",
|
|
504
|
+
integrateSquash: "Squash em {branch}",
|
|
505
|
+
integrationMenu: "Escolher como integrar",
|
|
506
|
+
integrationHint: "Leva os commits desta árvore de trabalho para a branch atual do checkout original",
|
|
507
|
+
integrating: "Integrando…",
|
|
508
|
+
blockedReadOnly: "Esta sessão é somente leitura, então não pode fazer commits no checkout original.",
|
|
509
|
+
blockedDetached: "O checkout original não tem nenhuma branch ativa.",
|
|
510
|
+
blockedInProgress: "Há uma operação do Git em andamento no checkout original.",
|
|
511
|
+
blockedStaged: "O checkout original tem alterações preparadas.",
|
|
512
|
+
blockedOverlap: "Sobrepõe alterações não confirmadas do checkout original: {paths}",
|
|
513
|
+
integrationDone: "Integrado em {branch}.",
|
|
514
|
+
integrationStale: "Os checkouts mudaram e a proposta foi atualizada. Confira e tente novamente.",
|
|
515
|
+
integrationBusy: "Outra integração ou um turno está em andamento. Tente novamente quando terminar.",
|
|
516
|
+
integrationFailed: "A integração falhou e foi revertida. O checkout original não mudou.",
|
|
517
|
+
integrationCleanupRefused: "A integração parou. O estado do Git foi mantido porque pode pertencer a outra operação; verifique o checkout original.",
|
|
518
|
+
integrationError: "Não foi possível integrar. Verifique o checkout original e tente novamente.",
|
|
519
|
+
toolbar: "Ações do Git",
|
|
520
|
+
shortcut: "Ação do Git {n}",
|
|
521
|
+
shortcutAlt: "Ação do Git {n} (alternativa)"
|
|
261
522
|
};
|
|
262
523
|
// src/model.ts
|
|
524
|
+
/** The open PR whose head branch is the checked-out branch; PRs of other branches are never offered. */
|
|
263
525
|
function requestForCheckout(panel) {
|
|
264
526
|
if (panel.checkout.state !== "ready" || !panel.checkout.checkout.branch) return void 0;
|
|
265
527
|
const branch = panel.checkout.checkout.branch;
|
|
266
528
|
return panel.changeRequests.find((entry) => entry.snapshot?.headBranch === branch && entry.snapshot.state === "open");
|
|
267
529
|
}
|
|
268
|
-
|
|
269
|
-
|
|
530
|
+
/** Whether a feature branch with a code host repository can open a PR. */
|
|
531
|
+
function canCreatePr(panel) {
|
|
532
|
+
if (panel.checkout.state !== "ready" || !panel.checkout.checkout.branch || !panel.repository) return false;
|
|
533
|
+
if (requestForCheckout(panel)) return false;
|
|
270
534
|
const branch = panel.checkout.checkout.branch;
|
|
271
535
|
const base = panel.local?.base.replace(/^refs\/remotes\//u, "").replace(/^[^/]+\//u, "");
|
|
272
|
-
return
|
|
536
|
+
return !!base && branch !== base;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Identity of the facts the uncommitted-changes lookup depends on. Panel frames
|
|
540
|
+
* with the same key reuse the previous answer instead of asking Git again.
|
|
541
|
+
*/
|
|
542
|
+
function localKey(panel) {
|
|
543
|
+
if (panel.checkout.state !== "ready") return null;
|
|
544
|
+
const { root, branch, commit } = panel.checkout.checkout;
|
|
545
|
+
const files = panel.local?.files?.map((file) => `${file.path}:${file.additions}:${file.deletions}`).join("|") ?? "";
|
|
546
|
+
return JSON.stringify([
|
|
547
|
+
panel.directory,
|
|
548
|
+
root,
|
|
549
|
+
branch,
|
|
550
|
+
commit,
|
|
551
|
+
files
|
|
552
|
+
]);
|
|
553
|
+
}
|
|
554
|
+
/** Next roving focus index for a toolbar key, or null when the key does not move focus. */
|
|
555
|
+
function nextIndex(key, current, count) {
|
|
556
|
+
if (count === 0) return null;
|
|
557
|
+
if (key === "Home") return 0;
|
|
558
|
+
if (key === "End") return count - 1;
|
|
559
|
+
if (key === "ArrowRight") return (current + 1) % count;
|
|
560
|
+
if (key === "ArrowLeft") return (current - 1 + count) % count;
|
|
561
|
+
return null;
|
|
273
562
|
}
|
|
563
|
+
// src/protocol.ts
|
|
564
|
+
/** Owner-only RPC contract between the composer chips and the host Git actions. */
|
|
565
|
+
const channel = "/api";
|
|
566
|
+
const methods = {
|
|
567
|
+
settings: "dungsil-forge-chip/settings",
|
|
568
|
+
saveDefault: "dungsil-forge-chip/default",
|
|
569
|
+
commit: "dungsil-forge-chip/commit",
|
|
570
|
+
pr: "dungsil-forge-chip/pr"
|
|
571
|
+
};
|
|
572
|
+
const inspectMethod = "dungsil-forge-integration/inspect";
|
|
573
|
+
const runMethod = "dungsil-forge-integration/run";
|
|
274
574
|
// src/styles.ts
|
|
275
575
|
const styles = `
|
|
276
576
|
.dsh-forge-chip { box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; width: calc(100% - 2 * var(--dsh-composer-side-clearance) - 4 * var(--dsh-composer-dock-inset)); max-width: calc(var(--dsh-composer-card-max-width) - 4 * var(--dsh-composer-dock-inset)); margin: 0 auto; padding-bottom: 8px; }
|
|
577
|
+
.dsh-forge-chip:empty { display: none; }
|
|
277
578
|
.dsh-forge-chip-actions { display: inline-flex; align-items: center; max-width: 100%; min-width: 0; }
|
|
278
579
|
.dsh-forge-chip-actions > .dsh-forge-chip-trigger { border-radius: 14px 0 0 14px; }
|
|
279
580
|
.dsh-forge-chip-actions .dsh-forge-chip-menu { flex: none; border-radius: 0 14px 14px 0; border-left: 0; padding: 0 7px; }
|
|
@@ -281,6 +582,8 @@ const styles = `
|
|
|
281
582
|
.dsh-forge-chip-trigger svg { flex: none; width: 14px; height: 14px; }
|
|
282
583
|
.dsh-forge-chip-trigger:disabled { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-dimmed); cursor: default; }
|
|
283
584
|
.dsh-forge-chip-trigger:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 0; }
|
|
585
|
+
.dsh-forge-chip-note { min-width: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
|
|
586
|
+
.dsh-forge-chip-note[role="alert"] { color: var(--dsw-alias-label-primary); }
|
|
284
587
|
@media (pointer: coarse) { .dsh-forge-chip-trigger { min-height: 44px; } .dsh-forge-chip-actions .dsh-forge-chip-menu { min-width: 44px; } }
|
|
285
588
|
`;
|
|
286
589
|
// src/client.tsx
|
|
@@ -288,10 +591,11 @@ const name = "dungsil-ui-forge-chip";
|
|
|
288
591
|
const inject = [
|
|
289
592
|
"slots",
|
|
290
593
|
"locale",
|
|
291
|
-
"
|
|
594
|
+
"connection",
|
|
292
595
|
"remote",
|
|
293
596
|
"remote.forgePanel",
|
|
294
|
-
"sidebarRight"
|
|
597
|
+
"sidebarRight",
|
|
598
|
+
"shortcuts"
|
|
295
599
|
];
|
|
296
600
|
const translations = {
|
|
297
601
|
en: en_default,
|
|
@@ -304,30 +608,289 @@ const translations = {
|
|
|
304
608
|
ru: ru_default,
|
|
305
609
|
pt: pt_default
|
|
306
610
|
};
|
|
611
|
+
/** PR state stays current while the composer is visible without hammering the code host. */
|
|
612
|
+
const PR_POLL_MS = 6e4;
|
|
613
|
+
const SHORTCUT_SLOTS = 9;
|
|
614
|
+
const ITEM = "[data-forge-chip-item]:not(:disabled)";
|
|
615
|
+
const shortcutId = (slot, secondary) => `dungsil.forge-chip.${secondary ? "alternate" : "action"}-${slot}`;
|
|
616
|
+
const errorKeys = {
|
|
617
|
+
unavailable: "errorUnavailable",
|
|
618
|
+
"nothing-to-commit": "errorNothingToCommit",
|
|
619
|
+
"message-failed": "errorMessageFailed",
|
|
620
|
+
"commit-failed": "errorCommitFailed",
|
|
621
|
+
"no-remote": "errorNoRemote",
|
|
622
|
+
"push-failed": "errorPushFailed",
|
|
623
|
+
"not-pushed": "errorNotPushed",
|
|
624
|
+
unsupported: "errorUnsupported",
|
|
625
|
+
"pr-failed": "errorPrFailed"
|
|
626
|
+
};
|
|
627
|
+
const methodLabels = {
|
|
628
|
+
ff: "integrateFf",
|
|
629
|
+
"cherry-pick": "integrateCherryPick",
|
|
630
|
+
merge: "integrateMerge",
|
|
631
|
+
rebase: "integrateRebase",
|
|
632
|
+
squash: "integrateSquash"
|
|
633
|
+
};
|
|
634
|
+
const blockerLabels = {
|
|
635
|
+
"read-only": "blockedReadOnly",
|
|
636
|
+
detached: "blockedDetached",
|
|
637
|
+
"in-progress": "blockedInProgress",
|
|
638
|
+
staged: "blockedStaged",
|
|
639
|
+
overlap: "blockedOverlap"
|
|
640
|
+
};
|
|
641
|
+
const failureLabels = {
|
|
642
|
+
stale: "integrationStale",
|
|
643
|
+
busy: "integrationBusy",
|
|
644
|
+
blocked: "integrationStale",
|
|
645
|
+
failed: "integrationFailed",
|
|
646
|
+
"cleanup-refused": "integrationCleanupRefused"
|
|
647
|
+
};
|
|
648
|
+
const fill = (template, values) => template.replace(/\{(\w+)\}/gu, (match, name) => values[name] ?? match);
|
|
307
649
|
function apply(ctx) {
|
|
308
|
-
const
|
|
650
|
+
const connection = ctx.get("connection");
|
|
651
|
+
const call = async (method, payload, signal) => {
|
|
652
|
+
const result = await connection.rpc.call(channel, method, payload, signal);
|
|
653
|
+
if (!result.ok) throw Object.assign(/* @__PURE__ */ new Error("rpc"), { code: result.error.code });
|
|
654
|
+
return result.value;
|
|
655
|
+
};
|
|
656
|
+
const entries = /* @__PURE__ */ new Map();
|
|
657
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
658
|
+
const bars = /* @__PURE__ */ new Set();
|
|
659
|
+
const empty = {};
|
|
660
|
+
let defaultAction = "commit";
|
|
661
|
+
const read = (sessionId) => entries.get(sessionId) ?? empty;
|
|
662
|
+
const notify = () => {
|
|
663
|
+
for (const listener of listeners) listener();
|
|
664
|
+
};
|
|
665
|
+
const write = (sessionId, patch) => {
|
|
666
|
+
entries.set(sessionId, {
|
|
667
|
+
...read(sessionId),
|
|
668
|
+
...patch
|
|
669
|
+
});
|
|
670
|
+
notify();
|
|
671
|
+
};
|
|
672
|
+
const subscribe = (listener) => {
|
|
673
|
+
listeners.add(listener);
|
|
674
|
+
return () => {
|
|
675
|
+
listeners.delete(listener);
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
const defaultSnapshot = () => defaultAction;
|
|
679
|
+
ctx.effect(() => () => entries.clear(), "ui-forge-chip: session cache");
|
|
680
|
+
/** Run one host Git action. It lives here, not in the chip, so leaving the session cannot repeat it. */
|
|
681
|
+
async function start(sessionId, operation) {
|
|
682
|
+
if (read(sessionId).busy) return;
|
|
683
|
+
write(sessionId, {
|
|
684
|
+
busy: operation,
|
|
685
|
+
error: void 0
|
|
686
|
+
});
|
|
687
|
+
try {
|
|
688
|
+
if (operation === "pr") await call(methods.pr, { sessionId });
|
|
689
|
+
else await call(methods.commit, {
|
|
690
|
+
sessionId,
|
|
691
|
+
push: operation === "push"
|
|
692
|
+
});
|
|
693
|
+
} catch (failure) {
|
|
694
|
+
const code = failure.code;
|
|
695
|
+
write(sessionId, { error: code && errorKeys[code] || "error" });
|
|
696
|
+
} finally {
|
|
697
|
+
ctx.remote.forgePanel.refresh(sessionId).catch(() => {});
|
|
698
|
+
write(sessionId, {
|
|
699
|
+
busy: void 0,
|
|
700
|
+
nonce: (read(sessionId).nonce ?? 0) + 1
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
ctx.effect(() => {
|
|
705
|
+
const text = () => localizedCopy(translations, ctx.locale.getSnapshot().active);
|
|
706
|
+
const resolve = (index, secondary) => {
|
|
707
|
+
const visible = [...bars].filter((bar) => {
|
|
708
|
+
const element = bar.element();
|
|
709
|
+
return !!element && element.isConnected && element.getClientRects().length > 0;
|
|
710
|
+
});
|
|
711
|
+
return visible.length === 1 ? visible[0].resolve(index, secondary) : { status: "pass" };
|
|
712
|
+
};
|
|
713
|
+
const disposers = [];
|
|
714
|
+
for (let n = 1; n <= SHORTCUT_SLOTS; n++) for (const secondary of [false, true]) {
|
|
715
|
+
const binding = {
|
|
716
|
+
code: `Digit${n}`,
|
|
717
|
+
modifiers: secondary ? ["primary", "shift"] : ["primary"]
|
|
718
|
+
};
|
|
719
|
+
try {
|
|
720
|
+
disposers.push(ctx.shortcuts.register({
|
|
721
|
+
id: shortcutId(n, secondary),
|
|
722
|
+
label: () => fill(secondary ? text().shortcutAlt : text().shortcut, { n: String(n) }),
|
|
723
|
+
aliases: [
|
|
724
|
+
"git",
|
|
725
|
+
"forge",
|
|
726
|
+
"commit",
|
|
727
|
+
"PR"
|
|
728
|
+
],
|
|
729
|
+
defaults: {
|
|
730
|
+
"desktop:windows": binding,
|
|
731
|
+
"desktop:macos": binding,
|
|
732
|
+
"desktop:linux": binding
|
|
733
|
+
},
|
|
734
|
+
regions: ["page", "editable"],
|
|
735
|
+
modals: [],
|
|
736
|
+
resolve: () => resolve(n - 1, secondary)
|
|
737
|
+
}));
|
|
738
|
+
} catch {}
|
|
739
|
+
}
|
|
740
|
+
return () => {
|
|
741
|
+
for (const dispose of disposers) dispose();
|
|
742
|
+
};
|
|
743
|
+
}, "ui-forge-chip: shortcuts");
|
|
744
|
+
/** The one integration the Host proposes for a Session working in a linked worktree. */
|
|
745
|
+
function Integration({ sessionId, panel, blocked, text }) {
|
|
746
|
+
const linked = panel.checkout.state === "ready" && panel.checkout.checkout.linked;
|
|
747
|
+
const [proposal, setProposal] = (0, react.useState)(null);
|
|
748
|
+
const [notice, setNotice] = (0, react.useState)();
|
|
749
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
750
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
751
|
+
const [tick, setTick] = (0, react.useState)(0);
|
|
752
|
+
const pending = (0, react.useRef)(false);
|
|
753
|
+
(0, react.useEffect)(() => {
|
|
754
|
+
const refresh = () => {
|
|
755
|
+
if (pending.current) return;
|
|
756
|
+
setNotice(void 0);
|
|
757
|
+
setTick((n) => n + 1);
|
|
758
|
+
};
|
|
759
|
+
window.addEventListener("focus", refresh);
|
|
760
|
+
return () => window.removeEventListener("focus", refresh);
|
|
761
|
+
}, []);
|
|
762
|
+
(0, react.useEffect)(() => {
|
|
763
|
+
if (!linked) {
|
|
764
|
+
setProposal(null);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (blocked) return;
|
|
768
|
+
const abort = new AbortController();
|
|
769
|
+
connection.rpc.call("/api", inspectMethod, { sessionId }, abort.signal).then((result) => {
|
|
770
|
+
if (!abort.signal.aborted) setProposal(result.ok ? result.value : null);
|
|
771
|
+
}).catch(() => {
|
|
772
|
+
if (!abort.signal.aborted) setProposal(null);
|
|
773
|
+
});
|
|
774
|
+
return () => abort.abort();
|
|
775
|
+
}, [
|
|
776
|
+
sessionId,
|
|
777
|
+
panel,
|
|
778
|
+
linked,
|
|
779
|
+
blocked,
|
|
780
|
+
tick
|
|
781
|
+
]);
|
|
782
|
+
const disabled = blocked || busy || !proposal || !!proposal.blocker;
|
|
783
|
+
(0, react.useEffect)(() => {
|
|
784
|
+
if (disabled) setOpen(false);
|
|
785
|
+
}, [disabled]);
|
|
786
|
+
const branch = proposal?.target.branch ?? "HEAD";
|
|
787
|
+
const label = (method) => fill(text[methodLabels[method]], { branch });
|
|
788
|
+
const integrate = async (method) => {
|
|
789
|
+
if (disabled || pending.current || !proposal) return;
|
|
790
|
+
pending.current = true;
|
|
791
|
+
setBusy(true);
|
|
792
|
+
setOpen(false);
|
|
793
|
+
setNotice(void 0);
|
|
794
|
+
try {
|
|
795
|
+
const result = await connection.rpc.call("/api", runMethod, {
|
|
796
|
+
sessionId,
|
|
797
|
+
method,
|
|
798
|
+
targetBranch: proposal.target.branch,
|
|
799
|
+
targetHead: proposal.target.head,
|
|
800
|
+
sourceHead: proposal.source.head
|
|
801
|
+
});
|
|
802
|
+
if (result.ok) setNotice({
|
|
803
|
+
text: fill(text.integrationDone, { branch }),
|
|
804
|
+
alert: false
|
|
805
|
+
});
|
|
806
|
+
else {
|
|
807
|
+
const diagnostic = result.error.details.diagnostic;
|
|
808
|
+
setNotice({
|
|
809
|
+
text: text[failureLabels[result.error.code] ?? "integrationError"],
|
|
810
|
+
alert: true,
|
|
811
|
+
diagnostic: typeof diagnostic === "string" ? diagnostic : void 0
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
} catch {
|
|
815
|
+
setNotice({
|
|
816
|
+
text: text.integrationError,
|
|
817
|
+
alert: true
|
|
818
|
+
});
|
|
819
|
+
} finally {
|
|
820
|
+
pending.current = false;
|
|
821
|
+
setBusy(false);
|
|
822
|
+
setTick((n) => n + 1);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
if (!linked || !proposal && !notice) return null;
|
|
826
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
827
|
+
proposal && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
828
|
+
className: "dsh-forge-chip-actions",
|
|
829
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
830
|
+
className: "dsh-forge-chip-trigger",
|
|
831
|
+
"data-forge-chip-item": "",
|
|
832
|
+
disabled,
|
|
833
|
+
title: text.integrationHint,
|
|
834
|
+
"aria-busy": busy,
|
|
835
|
+
onClick: () => void integrate(proposal.method),
|
|
836
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { "aria-hidden": "true" }), busy ? text.integrating : label(proposal.method)]
|
|
837
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
838
|
+
open,
|
|
839
|
+
side: "top",
|
|
840
|
+
portal: true,
|
|
841
|
+
compact: true,
|
|
842
|
+
onClose: () => setOpen(false),
|
|
843
|
+
items: proposal.methods.map((method) => ({
|
|
844
|
+
id: method,
|
|
845
|
+
label: label(method)
|
|
846
|
+
})),
|
|
847
|
+
onSelect: (id) => void integrate(id),
|
|
848
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
849
|
+
className: "dsh-forge-chip-trigger dsh-forge-chip-menu",
|
|
850
|
+
"data-forge-chip-item": "",
|
|
851
|
+
disabled,
|
|
852
|
+
"aria-label": text.integrationMenu,
|
|
853
|
+
"aria-haspopup": "menu",
|
|
854
|
+
"aria-expanded": open,
|
|
855
|
+
onClick: () => setOpen((value) => !value),
|
|
856
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { "aria-hidden": "true" })
|
|
857
|
+
})
|
|
858
|
+
})]
|
|
859
|
+
}),
|
|
860
|
+
proposal?.blocker && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
861
|
+
className: "dsh-forge-chip-note",
|
|
862
|
+
children: fill(text[blockerLabels[proposal.blocker]], { paths: proposal.paths.join(", ") })
|
|
863
|
+
}),
|
|
864
|
+
notice && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
865
|
+
className: "dsh-forge-chip-note",
|
|
866
|
+
role: notice.alert ? "alert" : "status",
|
|
867
|
+
title: notice.diagnostic,
|
|
868
|
+
children: notice.text
|
|
869
|
+
})
|
|
870
|
+
] });
|
|
871
|
+
}
|
|
309
872
|
function Chip({ sessionId, useSession, useAccess, useProjection }) {
|
|
310
873
|
const { active } = useLocaleSnapshot(ctx.locale);
|
|
311
|
-
const text = translations
|
|
312
|
-
const
|
|
874
|
+
const text = localizedCopy(translations, active);
|
|
875
|
+
const entry = (0, react.useSyncExternalStore)(subscribe, () => read(sessionId));
|
|
876
|
+
const preferred = (0, react.useSyncExternalStore)(subscribe, defaultSnapshot);
|
|
877
|
+
const hidden = useSession((s) => s.blank || s.awaitingFirstTurn || s.removed || s.openState !== "open" || !!s.subagent);
|
|
313
878
|
const unavailable = useSession((s) => s.running || s.pendingSubmissions.length > 0 || s.removed || s.openState !== "open");
|
|
879
|
+
const turn = useSession((s) => !!s.running);
|
|
314
880
|
const canPrompt = useAccess("session.prompt");
|
|
315
881
|
const cwd = useProjection("workingDirectory");
|
|
316
|
-
const [
|
|
317
|
-
const [
|
|
318
|
-
const [lookupError, setLookupError] = (0, react.useState)(false);
|
|
319
|
-
const [error, setError] = (0, react.useState)(false);
|
|
320
|
-
const [sending, setSending] = (0, react.useState)(false);
|
|
882
|
+
const [streamFresh, setStreamFresh] = (0, react.useState)(false);
|
|
883
|
+
const [streamError, setStreamError] = (0, react.useState)(false);
|
|
321
884
|
const [open, setOpen] = (0, react.useState)(false);
|
|
322
885
|
const [generation, setGeneration] = (0, react.useState)(0);
|
|
323
|
-
const
|
|
324
|
-
const
|
|
325
|
-
(0, react.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
886
|
+
const [tick, setTick] = (0, react.useState)(0);
|
|
887
|
+
const toolbar = (0, react.useRef)(null);
|
|
888
|
+
const focusIndex = (0, react.useRef)(0);
|
|
889
|
+
const wasTurn = (0, react.useRef)(turn);
|
|
890
|
+
const shortcuts = (0, react.useRef)([]);
|
|
891
|
+
const openRef = (0, react.useRef)(open);
|
|
892
|
+
openRef.current = open;
|
|
893
|
+
const panel = entry.panel;
|
|
331
894
|
(0, react.useEffect)(() => {
|
|
332
895
|
const dispose = ctx.on("connection/reset", () => setGeneration((n) => n + 1));
|
|
333
896
|
return () => {
|
|
@@ -335,9 +898,26 @@ function apply(ctx) {
|
|
|
335
898
|
};
|
|
336
899
|
}, []);
|
|
337
900
|
(0, react.useEffect)(() => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
901
|
+
const controller = new AbortController();
|
|
902
|
+
call(methods.settings, {}, controller.signal).then((value) => {
|
|
903
|
+
const action = value?.defaultAction;
|
|
904
|
+
if (!controller.signal.aborted && (action === "commit" || action === "push") && action !== defaultAction) {
|
|
905
|
+
defaultAction = action;
|
|
906
|
+
notify();
|
|
907
|
+
}
|
|
908
|
+
}).catch(() => {});
|
|
909
|
+
return () => controller.abort();
|
|
910
|
+
}, [generation]);
|
|
911
|
+
(0, react.useEffect)(() => {
|
|
912
|
+
if (wasTurn.current && !turn) {
|
|
913
|
+
setTick((n) => n + 1);
|
|
914
|
+
ctx.remote.forgePanel.refresh(sessionId).catch(() => {});
|
|
915
|
+
}
|
|
916
|
+
wasTurn.current = turn;
|
|
917
|
+
}, [sessionId, turn]);
|
|
918
|
+
(0, react.useEffect)(() => {
|
|
919
|
+
setStreamFresh(false);
|
|
920
|
+
setStreamError(false);
|
|
341
921
|
setOpen(false);
|
|
342
922
|
if (hidden) return;
|
|
343
923
|
const controller = new AbortController();
|
|
@@ -346,12 +926,13 @@ function apply(ctx) {
|
|
|
346
926
|
try {
|
|
347
927
|
for await (const state of stream) {
|
|
348
928
|
if (controller.signal.aborted) return;
|
|
349
|
-
|
|
350
|
-
|
|
929
|
+
write(sessionId, { panel: state });
|
|
930
|
+
setStreamFresh(true);
|
|
931
|
+
setStreamError(false);
|
|
351
932
|
}
|
|
352
|
-
if (!controller.signal.aborted)
|
|
933
|
+
if (!controller.signal.aborted) setStreamError(true);
|
|
353
934
|
} catch {
|
|
354
|
-
if (!controller.signal.aborted)
|
|
935
|
+
if (!controller.signal.aborted) setStreamError(true);
|
|
355
936
|
} finally {
|
|
356
937
|
stream.dispose();
|
|
357
938
|
}
|
|
@@ -366,102 +947,185 @@ function apply(ctx) {
|
|
|
366
947
|
hidden,
|
|
367
948
|
generation
|
|
368
949
|
]);
|
|
950
|
+
const key = panel && streamFresh ? localKey(panel) : null;
|
|
951
|
+
const wanted = key === null ? null : `${key}#${tick}#${entry.nonce ?? 0}`;
|
|
369
952
|
(0, react.useEffect)(() => {
|
|
370
|
-
|
|
371
|
-
if (!panel || panel.checkout.state !== "ready" || unavailable) return;
|
|
953
|
+
if (wanted === null || unavailable || read(sessionId).local?.key === wanted) return;
|
|
372
954
|
const controller = new AbortController();
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
955
|
+
Promise.resolve(ctx.remote.forgePanel.localDiff(sessionId, { kind: "uncommitted" }, controller.signal)).then((local) => local.ok ? {
|
|
956
|
+
key: wanted,
|
|
957
|
+
failed: false,
|
|
958
|
+
dirty: local.value.files.length > 0 || local.value.omitted > 0
|
|
959
|
+
} : {
|
|
960
|
+
key: wanted,
|
|
961
|
+
failed: true,
|
|
962
|
+
dirty: false
|
|
963
|
+
}, () => ({
|
|
964
|
+
key: wanted,
|
|
965
|
+
failed: true,
|
|
966
|
+
dirty: false
|
|
967
|
+
})).then((local) => {
|
|
968
|
+
if (controller.signal.aborted) return;
|
|
969
|
+
write(sessionId, { local: local.failed ? {
|
|
970
|
+
...local,
|
|
971
|
+
dirty: !!read(sessionId).local?.dirty
|
|
972
|
+
} : local });
|
|
973
|
+
});
|
|
974
|
+
return () => controller.abort();
|
|
975
|
+
}, [
|
|
976
|
+
sessionId,
|
|
977
|
+
wanted,
|
|
978
|
+
unavailable
|
|
979
|
+
]);
|
|
980
|
+
const request = panel && requestForCheckout(panel);
|
|
981
|
+
(0, react.useEffect)(() => {
|
|
982
|
+
if (hidden) return;
|
|
983
|
+
const refreshPr = () => {
|
|
984
|
+
if (request && document.visibilityState === "visible") ctx.remote.forgePanel.refresh(sessionId).catch(() => {});
|
|
394
985
|
};
|
|
395
|
-
refresh();
|
|
396
986
|
const onFocus = () => {
|
|
397
|
-
|
|
398
|
-
|
|
987
|
+
setTick((n) => n + 1);
|
|
988
|
+
refreshPr();
|
|
399
989
|
};
|
|
990
|
+
const timer = setInterval(refreshPr, PR_POLL_MS);
|
|
400
991
|
window.addEventListener("focus", onFocus);
|
|
992
|
+
document.addEventListener("visibilitychange", refreshPr);
|
|
401
993
|
return () => {
|
|
402
|
-
|
|
994
|
+
clearInterval(timer);
|
|
403
995
|
window.removeEventListener("focus", onFocus);
|
|
996
|
+
document.removeEventListener("visibilitychange", refreshPr);
|
|
404
997
|
};
|
|
405
998
|
}, [
|
|
406
|
-
|
|
999
|
+
hidden,
|
|
407
1000
|
sessionId,
|
|
408
|
-
|
|
1001
|
+
!!request
|
|
409
1002
|
]);
|
|
410
|
-
const request = panel && requestForCheckout(panel);
|
|
411
|
-
const fresh = facts?.panel === panel && facts !== void 0;
|
|
412
|
-
const viewOnly = !!request && fresh && !facts.dirty && facts.ahead === 0;
|
|
413
|
-
const disabled = !canPrompt || unavailable || sending || !fresh || lookupError;
|
|
414
1003
|
(0, react.useEffect)(() => {
|
|
415
|
-
|
|
416
|
-
|
|
1004
|
+
const bar = {
|
|
1005
|
+
element: () => toolbar.current,
|
|
1006
|
+
resolve(index, secondary) {
|
|
1007
|
+
if (openRef.current) return {
|
|
1008
|
+
status: "blocked",
|
|
1009
|
+
reason: "Git action menu is open"
|
|
1010
|
+
};
|
|
1011
|
+
const shortcut = shortcuts.current[index];
|
|
1012
|
+
if (!shortcut || secondary && !shortcut.secondary) return { status: "pass" };
|
|
1013
|
+
if (shortcut.disabled) return {
|
|
1014
|
+
status: "blocked",
|
|
1015
|
+
reason: "Git action is unavailable"
|
|
1016
|
+
};
|
|
1017
|
+
return {
|
|
1018
|
+
status: "handled",
|
|
1019
|
+
run: secondary ? shortcut.secondary : shortcut.run
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
bars.add(bar);
|
|
1024
|
+
return () => {
|
|
1025
|
+
bars.delete(bar);
|
|
1026
|
+
};
|
|
1027
|
+
}, []);
|
|
1028
|
+
(0, react.useEffect)(() => {
|
|
1029
|
+
const items = [...toolbar.current?.querySelectorAll(ITEM) ?? []];
|
|
1030
|
+
const current = Math.min(focusIndex.current, items.length - 1);
|
|
1031
|
+
items.forEach((item, index) => item.tabIndex = index === current ? 0 : -1);
|
|
1032
|
+
});
|
|
1033
|
+
const local = entry.local;
|
|
1034
|
+
const fresh = !!local && local.key === wanted;
|
|
1035
|
+
const lookupError = streamError || fresh && local.failed;
|
|
1036
|
+
const busy = entry.busy;
|
|
1037
|
+
const error = entry.error;
|
|
1038
|
+
const disabled = !canPrompt || unavailable || !!busy || !fresh || lookupError;
|
|
1039
|
+
(0, react.useEffect)(() => {
|
|
1040
|
+
if (disabled) setOpen(false);
|
|
1041
|
+
}, [disabled]);
|
|
1042
|
+
if (hidden || !panel || panel.checkout.state !== "ready") {
|
|
1043
|
+
shortcuts.current = [];
|
|
1044
|
+
return null;
|
|
1045
|
+
}
|
|
417
1046
|
const showPanel = () => ctx.sidebarRight.openTab("forge-panel");
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
setSending(true);
|
|
1047
|
+
const openRequest = request ? () => window.open(request.url, "_blank", "noopener,noreferrer") : void 0;
|
|
1048
|
+
const viewRequest = (event) => event?.shiftKey && openRequest ? openRequest() : showPanel();
|
|
1049
|
+
const act = (operation) => {
|
|
422
1050
|
setOpen(false);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
} finally {
|
|
435
|
-
pending.current = false;
|
|
436
|
-
if (mounted.current) setSending(false);
|
|
437
|
-
}
|
|
1051
|
+
if (disabled) return;
|
|
1052
|
+
start(sessionId, operation);
|
|
1053
|
+
};
|
|
1054
|
+
const saveDefault = (action) => {
|
|
1055
|
+
const previous = defaultAction;
|
|
1056
|
+
defaultAction = action;
|
|
1057
|
+
notify();
|
|
1058
|
+
call(methods.saveDefault, { defaultAction: action }).catch(() => {
|
|
1059
|
+
defaultAction = previous;
|
|
1060
|
+
write(sessionId, { error: "error" });
|
|
1061
|
+
});
|
|
438
1062
|
};
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
const
|
|
1063
|
+
const dirty = !!local?.dirty;
|
|
1064
|
+
const showCreate = !dirty && fresh && canCreatePr(panel);
|
|
1065
|
+
const linked = panel.checkout.checkout.linked;
|
|
1066
|
+
const rows = [];
|
|
1067
|
+
if (dirty) rows.push({
|
|
1068
|
+
run: () => act(preferred),
|
|
1069
|
+
disabled
|
|
1070
|
+
});
|
|
1071
|
+
if (showCreate) rows.push({
|
|
1072
|
+
run: () => act("pr"),
|
|
1073
|
+
disabled
|
|
1074
|
+
});
|
|
1075
|
+
if (request) rows.push({
|
|
1076
|
+
run: showPanel,
|
|
1077
|
+
secondary: openRequest,
|
|
1078
|
+
disabled: false
|
|
1079
|
+
});
|
|
1080
|
+
if (request) rows.push({
|
|
1081
|
+
run: showPanel,
|
|
1082
|
+
secondary: openRequest,
|
|
1083
|
+
disabled: false
|
|
1084
|
+
});
|
|
1085
|
+
if (lookupError) rows.push({
|
|
1086
|
+
run: showPanel,
|
|
1087
|
+
disabled: false
|
|
1088
|
+
});
|
|
1089
|
+
shortcuts.current = rows;
|
|
1090
|
+
if (!dirty && !showCreate && !request && !lookupError && !error && !linked) return null;
|
|
1091
|
+
const commitLabel = busy === "commit" ? text.committing : busy === "push" ? text.pushing : text[preferred === "push" ? "commitPush" : "commit"];
|
|
442
1092
|
const checks = request?.snapshot?.checksRollup ?? "unknown";
|
|
443
1093
|
const stale = !!request?.update && "error" in request.update;
|
|
1094
|
+
const onKeyDown = (event) => {
|
|
1095
|
+
const items = [...toolbar.current?.querySelectorAll(ITEM) ?? []];
|
|
1096
|
+
const next = nextIndex(event.key, items.indexOf(event.target), items.length);
|
|
1097
|
+
if (next === null || items.indexOf(event.target) < 0) return;
|
|
1098
|
+
event.preventDefault();
|
|
1099
|
+
focusIndex.current = next;
|
|
1100
|
+
items[next].focus();
|
|
1101
|
+
};
|
|
444
1102
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1103
|
+
ref: toolbar,
|
|
445
1104
|
className: "dsh-forge-chip",
|
|
1105
|
+
role: "toolbar",
|
|
1106
|
+
"aria-label": text.toolbar,
|
|
1107
|
+
onKeyDown,
|
|
1108
|
+
onFocus: (event) => {
|
|
1109
|
+
const index = [...toolbar.current?.querySelectorAll(ITEM) ?? []].indexOf(event.target);
|
|
1110
|
+
if (index >= 0) focusIndex.current = index;
|
|
1111
|
+
},
|
|
446
1112
|
children: [
|
|
447
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1113
|
+
dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
448
1114
|
className: "dsh-forge-chip-actions",
|
|
449
1115
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
450
|
-
className: "dsh-forge-chip-trigger",
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
"aria-busy":
|
|
454
|
-
onClick: () =>
|
|
455
|
-
|
|
456
|
-
else send(operation);
|
|
457
|
-
},
|
|
458
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { "aria-hidden": "true" }), label]
|
|
1116
|
+
className: "dsh-forge-chip-trigger dsh-forge-chip-commit",
|
|
1117
|
+
"data-forge-chip-item": "",
|
|
1118
|
+
disabled,
|
|
1119
|
+
"aria-busy": busy === "commit" || busy === "push",
|
|
1120
|
+
onClick: () => act(preferred),
|
|
1121
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { "aria-hidden": "true" }), commitLabel]
|
|
459
1122
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
460
1123
|
open,
|
|
461
1124
|
side: "top",
|
|
462
1125
|
portal: true,
|
|
463
1126
|
compact: true,
|
|
464
1127
|
onClose: () => setOpen(false),
|
|
1128
|
+
selectedId: `default-${preferred}`,
|
|
465
1129
|
items: [
|
|
466
1130
|
{
|
|
467
1131
|
id: "commit",
|
|
@@ -469,23 +1133,34 @@ function apply(ctx) {
|
|
|
469
1133
|
},
|
|
470
1134
|
...panel.repository ? [{
|
|
471
1135
|
id: "push",
|
|
472
|
-
label: text.
|
|
473
|
-
}, {
|
|
474
|
-
id: "pr",
|
|
475
|
-
label: request ? text.updatePr : text.pr
|
|
1136
|
+
label: text.commitPush
|
|
476
1137
|
}] : [],
|
|
477
1138
|
{
|
|
478
|
-
|
|
479
|
-
|
|
1139
|
+
type: "separator",
|
|
1140
|
+
id: "separator"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
type: "label",
|
|
1144
|
+
id: "default",
|
|
1145
|
+
text: text.defaultAction
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
id: "default-commit",
|
|
1149
|
+
label: text.commit
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
id: "default-push",
|
|
1153
|
+
label: text.commitPush
|
|
480
1154
|
}
|
|
481
1155
|
],
|
|
482
1156
|
onSelect: (id) => {
|
|
483
1157
|
setOpen(false);
|
|
484
|
-
if (id === "
|
|
485
|
-
else
|
|
1158
|
+
if (id === "default-commit" || id === "default-push") saveDefault(id === "default-push" ? "push" : "commit");
|
|
1159
|
+
else act(id);
|
|
486
1160
|
},
|
|
487
1161
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
488
1162
|
className: "dsh-forge-chip-trigger dsh-forge-chip-menu",
|
|
1163
|
+
"data-forge-chip-item": "",
|
|
489
1164
|
disabled,
|
|
490
1165
|
"aria-label": text.menu,
|
|
491
1166
|
"aria-haspopup": "menu",
|
|
@@ -501,9 +1176,24 @@ function apply(ctx) {
|
|
|
501
1176
|
})
|
|
502
1177
|
})]
|
|
503
1178
|
}),
|
|
1179
|
+
showCreate && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
1180
|
+
className: "dsh-forge-chip-trigger dsh-forge-chip-create",
|
|
1181
|
+
"data-forge-chip-item": "",
|
|
1182
|
+
disabled,
|
|
1183
|
+
"aria-busy": busy === "pr",
|
|
1184
|
+
onClick: () => act("pr"),
|
|
1185
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { "aria-hidden": "true" }), busy === "pr" ? text.creatingPr : text.pr]
|
|
1186
|
+
}),
|
|
1187
|
+
request && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
1188
|
+
className: "dsh-forge-chip-trigger dsh-forge-chip-view",
|
|
1189
|
+
"data-forge-chip-item": "",
|
|
1190
|
+
onClick: viewRequest,
|
|
1191
|
+
children: text.viewPr
|
|
1192
|
+
}),
|
|
504
1193
|
request && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
505
|
-
className: "dsh-forge-chip-trigger",
|
|
506
|
-
|
|
1194
|
+
className: "dsh-forge-chip-trigger dsh-forge-chip-checks",
|
|
1195
|
+
"data-forge-chip-item": "",
|
|
1196
|
+
onClick: viewRequest,
|
|
507
1197
|
children: [
|
|
508
1198
|
text.checks,
|
|
509
1199
|
": ",
|
|
@@ -512,12 +1202,19 @@ function apply(ctx) {
|
|
|
512
1202
|
}),
|
|
513
1203
|
lookupError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
514
1204
|
className: "dsh-forge-chip-trigger",
|
|
1205
|
+
"data-forge-chip-item": "",
|
|
515
1206
|
onClick: showPanel,
|
|
516
1207
|
children: text.lookupError
|
|
517
1208
|
}),
|
|
518
1209
|
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
519
1210
|
role: "alert",
|
|
520
|
-
children: text
|
|
1211
|
+
children: text[error]
|
|
1212
|
+
}),
|
|
1213
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Integration, {
|
|
1214
|
+
sessionId,
|
|
1215
|
+
panel,
|
|
1216
|
+
blocked: !canPrompt || unavailable,
|
|
1217
|
+
text
|
|
521
1218
|
})
|
|
522
1219
|
]
|
|
523
1220
|
});
|