dsh-gufa-code 1.3.113 → 1.3.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client.js +20 -7
- package/desktop/float/bin/gufa-float-macos-arm64 +0 -0
- package/desktop/float/bin/gufa-float-macos-universal +0 -0
- package/desktop/float/bin/gufa-float-macos-x64 +0 -0
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/Info.plist +2 -2
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/MacOS/gufa-float +0 -0
- package/docs/KNOWN-PITFALLS.md +2 -2
- package/package.json +1 -1
- package/src/client/00-core.js +2 -0
- package/src/client/50-panels.js +17 -6
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ dsh plugin add dsh-gufa-code
|
|
|
64
64
|
### 左侧面板
|
|
65
65
|
|
|
66
66
|
- **资源管理器**:懒加载文件树、Git 状态颜色、错误/问题点、目录改动标记;
|
|
67
|
-
- **源代码管理**:分支、ahead/behind
|
|
67
|
+
- **源代码管理**:分支、ahead/behind(点击可推送/拉取)、更改列表、暂存/取消暂存、提交(`⌘⇧↵`:已有暂存时只提交暂存内容;一个都没暂存时才自动全部暂存后提交)、Git Graph(泳道图 + 提交文件 + 查看某次提交的文件)、撤销上次提交、丢弃全部、逐文件还原;
|
|
68
68
|
- **SSH**:解析 `~/.ssh/config`,点一下就在终端里 `ssh <alias>`;
|
|
69
69
|
- **终端**:真实 PTY + xterm,多标签、新建/关闭、自动 resize、明暗主题,SSH 与任意命令都行。
|
|
70
70
|
|
package/client.js
CHANGED
|
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
|
|
|
16
16
|
const G = {}
|
|
17
17
|
G.NS = GUFA_NS
|
|
18
18
|
/** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
|
|
19
|
-
G.BUILD = '1.3.
|
|
19
|
+
G.BUILD = '1.3.115'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -262,6 +262,7 @@ const DICT_ZH = {
|
|
|
262
262
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
263
263
|
'git.discardFile': '还原该文件的改动',
|
|
264
264
|
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
265
|
+
'git.autoStageHint': '完全没有暂存时,点提交会自动暂存全部改动再提交;已有暂存时只提交暂存内容',
|
|
265
266
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
266
267
|
'git.more': '更多操作',
|
|
267
268
|
'git.viewDiff': '查看改动对比',
|
|
@@ -512,6 +513,7 @@ const DICT_EN = {
|
|
|
512
513
|
'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
|
|
513
514
|
'git.discardFile': 'Revert this file',
|
|
514
515
|
'git.commitStagedOnlyHint': 'Only staged changes are committed; unstaged changes stay in the working tree',
|
|
516
|
+
'git.autoStageHint': 'If nothing is staged, Commit auto-stages everything first; once something is staged, only staged changes are committed',
|
|
515
517
|
'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
|
|
516
518
|
'git.more': 'More actions',
|
|
517
519
|
'git.viewDiff': 'View diff',
|
|
@@ -8794,19 +8796,29 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8794
8796
|
}
|
|
8795
8797
|
|
|
8796
8798
|
const commitRef = useRef(null)
|
|
8799
|
+
const messageRef = useRef(null)
|
|
8797
8800
|
const commit = () => {
|
|
8798
8801
|
if (root === null || pending) return
|
|
8799
8802
|
const text = typeof message === 'string' ? message.trim() : ''
|
|
8800
8803
|
if (text === '') {
|
|
8801
8804
|
setError(t('git.commitNeedsMessage'))
|
|
8805
|
+
try {
|
|
8806
|
+
messageRef.current?.focus()
|
|
8807
|
+
} catch {
|
|
8808
|
+
/* ignore */
|
|
8809
|
+
}
|
|
8802
8810
|
return
|
|
8803
8811
|
}
|
|
8804
|
-
if (
|
|
8805
|
-
setError(t('git.
|
|
8812
|
+
if (changes.length === 0) {
|
|
8813
|
+
setError(t('git.noChanges'))
|
|
8806
8814
|
return
|
|
8807
8815
|
}
|
|
8808
8816
|
void act(async () => {
|
|
8809
|
-
/*
|
|
8817
|
+
/* 有已暂存改动时只提交暂存内容;一个都没暂存时才自动全部暂存再提交(快捷模式) */
|
|
8818
|
+
if (staged.length === 0) {
|
|
8819
|
+
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
8820
|
+
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
8821
|
+
}
|
|
8810
8822
|
await G.api('git.commit', { root, message: text })
|
|
8811
8823
|
setMessage('')
|
|
8812
8824
|
})
|
|
@@ -8978,6 +8990,7 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8978
8990
|
? h(
|
|
8979
8991
|
'textarea',
|
|
8980
8992
|
{
|
|
8993
|
+
ref: messageRef,
|
|
8981
8994
|
className: 'gufa-textarea',
|
|
8982
8995
|
placeholder: t('git.commitPlaceholder'),
|
|
8983
8996
|
value: message,
|
|
@@ -8992,15 +9005,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8992
9005
|
},
|
|
8993
9006
|
)
|
|
8994
9007
|
: null,
|
|
8995
|
-
changes.length > 0
|
|
8996
|
-
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.
|
|
9008
|
+
changes.length > 0 && (staged.length === 0 || unstaged.length > 0)
|
|
9009
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.autoStageHint') : t('git.commitStagedOnlyHint'))
|
|
8997
9010
|
: null,
|
|
8998
9011
|
changes.length > 0
|
|
8999
9012
|
? h(
|
|
9000
9013
|
'div',
|
|
9001
9014
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
9002
9015
|
staged.length > 0 ? h('span', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|
|
9003
|
-
h(G.Button, { disabled: pending ||
|
|
9016
|
+
h(G.Button, { disabled: pending || changes.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
9004
9017
|
)
|
|
9005
9018
|
: null,
|
|
9006
9019
|
staged.length > 0 ? h('div', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
|
|
8
8
|
<key>CFBundleExecutable</key><string>gufa-float</string>
|
|
9
9
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
10
|
-
<key>CFBundleShortVersionString</key><string>1.3.
|
|
11
|
-
<key>CFBundleVersion</key><string>1.3.
|
|
10
|
+
<key>CFBundleShortVersionString</key><string>1.3.114</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.114</string>
|
|
12
12
|
<key>LSUIElement</key><true/>
|
|
13
13
|
<key>NSHighResolutionCapable</key><true/>
|
|
14
14
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
|
Binary file
|
package/docs/KNOWN-PITFALLS.md
CHANGED
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
|
|
73
73
|
## 0.13 Git 提交只提交已暂存(1.3.113)
|
|
74
74
|
|
|
75
|
-
-
|
|
76
|
-
-
|
|
75
|
+
- 旧实现点「提交」永远先 `git.stage` 所有未暂存文件再 `git.commit`,导致有暂存+未暂存时把两者都提交了,暂存失去意义。
|
|
76
|
+
- 正确策略(两层):`staged.length > 0` 时**只**调 `git.commit`(Host 是 `git commit -m`,只消费 index),未暂存保持不动;`staged.length === 0` 且存在改动时才自动 `git.stage` 全部再提交(快捷模式)。按钮只在没有改动或没填 message 时禁用。
|
|
77
77
|
- 单测覆盖:暂存 `src/staged.ts`、保留未跟踪 `src/unstaged.ts` 后提交,断言 unstaged 文件不在 HEAD 且仍出现在 status 的未暂存列表里。
|
|
78
78
|
|
|
79
79
|
## 1. 弹窗/菜单层级:只有一个正确做法(反复踩过多次,最终定案)
|
package/package.json
CHANGED
package/src/client/00-core.js
CHANGED
|
@@ -254,6 +254,7 @@ const DICT_ZH = {
|
|
|
254
254
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
255
255
|
'git.discardFile': '还原该文件的改动',
|
|
256
256
|
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
257
|
+
'git.autoStageHint': '完全没有暂存时,点提交会自动暂存全部改动再提交;已有暂存时只提交暂存内容',
|
|
257
258
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
258
259
|
'git.more': '更多操作',
|
|
259
260
|
'git.viewDiff': '查看改动对比',
|
|
@@ -504,6 +505,7 @@ const DICT_EN = {
|
|
|
504
505
|
'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
|
|
505
506
|
'git.discardFile': 'Revert this file',
|
|
506
507
|
'git.commitStagedOnlyHint': 'Only staged changes are committed; unstaged changes stay in the working tree',
|
|
508
|
+
'git.autoStageHint': 'If nothing is staged, Commit auto-stages everything first; once something is staged, only staged changes are committed',
|
|
507
509
|
'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
|
|
508
510
|
'git.more': 'More actions',
|
|
509
511
|
'git.viewDiff': 'View diff',
|
package/src/client/50-panels.js
CHANGED
|
@@ -1140,19 +1140,29 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
1142
|
const commitRef = useRef(null)
|
|
1143
|
+
const messageRef = useRef(null)
|
|
1143
1144
|
const commit = () => {
|
|
1144
1145
|
if (root === null || pending) return
|
|
1145
1146
|
const text = typeof message === 'string' ? message.trim() : ''
|
|
1146
1147
|
if (text === '') {
|
|
1147
1148
|
setError(t('git.commitNeedsMessage'))
|
|
1149
|
+
try {
|
|
1150
|
+
messageRef.current?.focus()
|
|
1151
|
+
} catch {
|
|
1152
|
+
/* ignore */
|
|
1153
|
+
}
|
|
1148
1154
|
return
|
|
1149
1155
|
}
|
|
1150
|
-
if (
|
|
1151
|
-
setError(t('git.
|
|
1156
|
+
if (changes.length === 0) {
|
|
1157
|
+
setError(t('git.noChanges'))
|
|
1152
1158
|
return
|
|
1153
1159
|
}
|
|
1154
1160
|
void act(async () => {
|
|
1155
|
-
/*
|
|
1161
|
+
/* 有已暂存改动时只提交暂存内容;一个都没暂存时才自动全部暂存再提交(快捷模式) */
|
|
1162
|
+
if (staged.length === 0) {
|
|
1163
|
+
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
1164
|
+
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
1165
|
+
}
|
|
1156
1166
|
await G.api('git.commit', { root, message: text })
|
|
1157
1167
|
setMessage('')
|
|
1158
1168
|
})
|
|
@@ -1324,6 +1334,7 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1324
1334
|
? h(
|
|
1325
1335
|
'textarea',
|
|
1326
1336
|
{
|
|
1337
|
+
ref: messageRef,
|
|
1327
1338
|
className: 'gufa-textarea',
|
|
1328
1339
|
placeholder: t('git.commitPlaceholder'),
|
|
1329
1340
|
value: message,
|
|
@@ -1338,15 +1349,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1338
1349
|
},
|
|
1339
1350
|
)
|
|
1340
1351
|
: null,
|
|
1341
|
-
changes.length > 0
|
|
1342
|
-
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.
|
|
1352
|
+
changes.length > 0 && (staged.length === 0 || unstaged.length > 0)
|
|
1353
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.autoStageHint') : t('git.commitStagedOnlyHint'))
|
|
1343
1354
|
: null,
|
|
1344
1355
|
changes.length > 0
|
|
1345
1356
|
? h(
|
|
1346
1357
|
'div',
|
|
1347
1358
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
1348
1359
|
staged.length > 0 ? h('span', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|
|
1349
|
-
h(G.Button, { disabled: pending ||
|
|
1360
|
+
h(G.Button, { disabled: pending || changes.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
1350
1361
|
)
|
|
1351
1362
|
: null,
|
|
1352
1363
|
staged.length > 0 ? h('div', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|