dsh-gufa-code 1.3.112 → 1.3.114
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 +17 -9
- 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 +6 -0
- package/package.json +1 -1
- package/scripts/selftest-host.mjs +15 -0
- package/src/client/00-core.js +4 -2
- package/src/client/50-panels.js +12 -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.114'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -261,7 +261,8 @@ const DICT_ZH = {
|
|
|
261
261
|
'git.pull': '拉取',
|
|
262
262
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
263
263
|
'git.discardFile': '还原该文件的改动',
|
|
264
|
-
'git.
|
|
264
|
+
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
265
|
+
'git.autoStageHint': '完全没有暂存时,点提交会自动暂存全部改动再提交;已有暂存时只提交暂存内容',
|
|
265
266
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
266
267
|
'git.more': '更多操作',
|
|
267
268
|
'git.viewDiff': '查看改动对比',
|
|
@@ -511,7 +512,8 @@ const DICT_EN = {
|
|
|
511
512
|
'git.pull': 'Pull',
|
|
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
|
-
'git.
|
|
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',
|
|
@@ -8801,10 +8803,16 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8801
8803
|
setError(t('git.commitNeedsMessage'))
|
|
8802
8804
|
return
|
|
8803
8805
|
}
|
|
8806
|
+
if (changes.length === 0) {
|
|
8807
|
+
setError(t('git.noChanges'))
|
|
8808
|
+
return
|
|
8809
|
+
}
|
|
8804
8810
|
void act(async () => {
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8811
|
+
/* 有已暂存改动时只提交暂存内容;一个都没暂存时才自动全部暂存再提交(快捷模式) */
|
|
8812
|
+
if (staged.length === 0) {
|
|
8813
|
+
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
8814
|
+
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
8815
|
+
}
|
|
8808
8816
|
await G.api('git.commit', { root, message: text })
|
|
8809
8817
|
setMessage('')
|
|
8810
8818
|
})
|
|
@@ -8990,15 +8998,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8990
8998
|
},
|
|
8991
8999
|
)
|
|
8992
9000
|
: null,
|
|
8993
|
-
changes.length > 0 && unstaged.length > 0
|
|
8994
|
-
? h('div', { className: 'gufa-hint' }, t('git.autoStageHint'))
|
|
9001
|
+
changes.length > 0 && (staged.length === 0 || unstaged.length > 0)
|
|
9002
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.autoStageHint') : t('git.commitStagedOnlyHint'))
|
|
8995
9003
|
: null,
|
|
8996
9004
|
changes.length > 0
|
|
8997
9005
|
? h(
|
|
8998
9006
|
'div',
|
|
8999
9007
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
9000
9008
|
staged.length > 0 ? h('span', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|
|
9001
|
-
h(G.Button, { disabled: pending || message.trim() === '', primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
9009
|
+
h(G.Button, { disabled: pending || message.trim() === '' || changes.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
9002
9010
|
)
|
|
9003
9011
|
: null,
|
|
9004
9012
|
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
|
@@ -70,6 +70,12 @@
|
|
|
70
70
|
- 更新 Monaco model 不能只靠 App 的 props 同步:编辑器聚焦时同步 effect 会故意跳过外部内容以避免覆盖输入。App 通过 `G.bus.emit('editor:external-reload', {path, content})` 通知 EditorPane 直接 `model.setValue`,用 `suppressChangeRef` 防止把这次更新当用户输入回传,并恢复光标/滚动;同时写 `lastPropContentRef` 避免后续 props 同步再灌一次。
|
|
71
71
|
- 点击已打开文件(文件树/搜索)时也要先 `reloadTabFromDisk`,否则用户点文件列表看不到 AI 改动。
|
|
72
72
|
|
|
73
|
+
## 0.13 Git 提交只提交已暂存(1.3.113)
|
|
74
|
+
|
|
75
|
+
- 旧实现点「提交」永远先 `git.stage` 所有未暂存文件再 `git.commit`,导致有暂存+未暂存时把两者都提交了,暂存失去意义。
|
|
76
|
+
- 正确策略(两层):`staged.length > 0` 时**只**调 `git.commit`(Host 是 `git commit -m`,只消费 index),未暂存保持不动;`staged.length === 0` 且存在改动时才自动 `git.stage` 全部再提交(快捷模式)。按钮只在没有改动或没填 message 时禁用。
|
|
77
|
+
- 单测覆盖:暂存 `src/staged.ts`、保留未跟踪 `src/unstaged.ts` 后提交,断言 unstaged 文件不在 HEAD 且仍出现在 status 的未暂存列表里。
|
|
78
|
+
|
|
73
79
|
## 1. 弹窗/菜单层级:只有一个正确做法(反复踩过多次,最终定案)
|
|
74
80
|
|
|
75
81
|
**现象**:弹窗被右侧「古法 AI」聊天栏压住、只显示一半、关闭按钮点不到;或者反过来把官方设置/会话弹窗盖住。
|
package/package.json
CHANGED
|
@@ -178,6 +178,21 @@ try {
|
|
|
178
178
|
check('git.show HEAD content', headShow.text === 'const answer = 42\n', JSON.stringify(headShow.text))
|
|
179
179
|
const indexShow = await call(router, 'git.show', { root, path: 'src/main.ts', rev: 'index' })
|
|
180
180
|
check('git.show index content', indexShow.text === 'const answer = 42\n', JSON.stringify(indexShow.text))
|
|
181
|
+
/* 只提交已暂存改动:未暂存文件不能进 commit */
|
|
182
|
+
await call(router, 'fs.create', { root, path: 'src/staged.ts', kind: 'file' })
|
|
183
|
+
await call(router, 'fs.write', { root, path: 'src/staged.ts', content: 'export const stagedOnly = 1\n' })
|
|
184
|
+
await call(router, 'fs.create', { root, path: 'src/unstaged.ts', kind: 'file' })
|
|
185
|
+
await call(router, 'fs.write', { root, path: 'src/unstaged.ts', content: 'export const unstagedOnly = 2\n' })
|
|
186
|
+
await call(router, 'git.stage', { root, paths: ['src/staged.ts'] })
|
|
187
|
+
await call(router, 'git.commit', { root, message: 'feat: staged only' })
|
|
188
|
+
const afterStagedOnly = await call(router, 'git.status', { root })
|
|
189
|
+
check('commit keeps unstaged file out', afterStagedOnly.changes.some((change) => change.path === 'src/unstaged.ts' && change.staged !== true), JSON.stringify(afterStagedOnly.changes))
|
|
190
|
+
check('commit includes staged file', !afterStagedOnly.changes.some((change) => change.path === 'src/staged.ts'), JSON.stringify(afterStagedOnly.changes))
|
|
191
|
+
const stagedOnlyHead = await call(router, 'git.show', { root, path: 'src/staged.ts', rev: 'head' })
|
|
192
|
+
check('staged file in commit', stagedOnlyHead.text === 'export const stagedOnly = 1\n', JSON.stringify(stagedOnlyHead.text))
|
|
193
|
+
const unstagedHead = await call(router, 'git.show', { root, path: 'src/unstaged.ts', rev: 'head' })
|
|
194
|
+
check('unstaged file not in commit', unstagedHead.missing === true)
|
|
195
|
+
|
|
181
196
|
const gitSearch = await call(router, 'fs.search', { root, query: 'answer' })
|
|
182
197
|
check('search uses git file list', gitSearch.viaGit === true, String(gitSearch.viaGit))
|
|
183
198
|
check('search finds committed file', gitSearch.files.some((file) => file.path === 'src/main.ts'))
|
package/src/client/00-core.js
CHANGED
|
@@ -253,7 +253,8 @@ const DICT_ZH = {
|
|
|
253
253
|
'git.pull': '拉取',
|
|
254
254
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
255
255
|
'git.discardFile': '还原该文件的改动',
|
|
256
|
-
'git.
|
|
256
|
+
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
257
|
+
'git.autoStageHint': '完全没有暂存时,点提交会自动暂存全部改动再提交;已有暂存时只提交暂存内容',
|
|
257
258
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
258
259
|
'git.more': '更多操作',
|
|
259
260
|
'git.viewDiff': '查看改动对比',
|
|
@@ -503,7 +504,8 @@ const DICT_EN = {
|
|
|
503
504
|
'git.pull': 'Pull',
|
|
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
|
-
'git.
|
|
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
|
@@ -1147,10 +1147,16 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1147
1147
|
setError(t('git.commitNeedsMessage'))
|
|
1148
1148
|
return
|
|
1149
1149
|
}
|
|
1150
|
+
if (changes.length === 0) {
|
|
1151
|
+
setError(t('git.noChanges'))
|
|
1152
|
+
return
|
|
1153
|
+
}
|
|
1150
1154
|
void act(async () => {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1155
|
+
/* 有已暂存改动时只提交暂存内容;一个都没暂存时才自动全部暂存再提交(快捷模式) */
|
|
1156
|
+
if (staged.length === 0) {
|
|
1157
|
+
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
1158
|
+
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
1159
|
+
}
|
|
1154
1160
|
await G.api('git.commit', { root, message: text })
|
|
1155
1161
|
setMessage('')
|
|
1156
1162
|
})
|
|
@@ -1336,15 +1342,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1336
1342
|
},
|
|
1337
1343
|
)
|
|
1338
1344
|
: null,
|
|
1339
|
-
changes.length > 0 && unstaged.length > 0
|
|
1340
|
-
? h('div', { className: 'gufa-hint' }, t('git.autoStageHint'))
|
|
1345
|
+
changes.length > 0 && (staged.length === 0 || unstaged.length > 0)
|
|
1346
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.autoStageHint') : t('git.commitStagedOnlyHint'))
|
|
1341
1347
|
: null,
|
|
1342
1348
|
changes.length > 0
|
|
1343
1349
|
? h(
|
|
1344
1350
|
'div',
|
|
1345
1351
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
1346
1352
|
staged.length > 0 ? h('span', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|
|
1347
|
-
h(G.Button, { disabled: pending || message.trim() === '', primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
1353
|
+
h(G.Button, { disabled: pending || message.trim() === '' || changes.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
1348
1354
|
)
|
|
1349
1355
|
: null,
|
|
1350
1356
|
staged.length > 0 ? h('div', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|