dsh-gufa-code 1.3.112 → 1.3.113
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 +11 -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 +2 -2
- package/src/client/50-panels.js +8 -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.113'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -261,7 +261,7 @@ const DICT_ZH = {
|
|
|
261
261
|
'git.pull': '拉取',
|
|
262
262
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
263
263
|
'git.discardFile': '还原该文件的改动',
|
|
264
|
-
'git.
|
|
264
|
+
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
265
265
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
266
266
|
'git.more': '更多操作',
|
|
267
267
|
'git.viewDiff': '查看改动对比',
|
|
@@ -511,7 +511,7 @@ const DICT_EN = {
|
|
|
511
511
|
'git.pull': 'Pull',
|
|
512
512
|
'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
|
|
513
513
|
'git.discardFile': 'Revert this file',
|
|
514
|
-
'git.
|
|
514
|
+
'git.commitStagedOnlyHint': 'Only staged changes are committed; unstaged changes stay in the working tree',
|
|
515
515
|
'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
|
|
516
516
|
'git.more': 'More actions',
|
|
517
517
|
'git.viewDiff': 'View diff',
|
|
@@ -8801,10 +8801,12 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8801
8801
|
setError(t('git.commitNeedsMessage'))
|
|
8802
8802
|
return
|
|
8803
8803
|
}
|
|
8804
|
+
if (staged.length === 0) {
|
|
8805
|
+
setError(t('git.noStagedHint'))
|
|
8806
|
+
return
|
|
8807
|
+
}
|
|
8804
8808
|
void act(async () => {
|
|
8805
|
-
|
|
8806
|
-
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
8807
|
-
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
8809
|
+
/* 只提交「已暂存」的改动;未暂存改动保持原样(需要时用「全部暂存」) */
|
|
8808
8810
|
await G.api('git.commit', { root, message: text })
|
|
8809
8811
|
setMessage('')
|
|
8810
8812
|
})
|
|
@@ -8990,15 +8992,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
8990
8992
|
},
|
|
8991
8993
|
)
|
|
8992
8994
|
: null,
|
|
8993
|
-
changes.length > 0
|
|
8994
|
-
? h('div', { className: 'gufa-hint' }, t('git.
|
|
8995
|
+
changes.length > 0
|
|
8996
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.noStagedHint') : t('git.commitStagedOnlyHint'))
|
|
8995
8997
|
: null,
|
|
8996
8998
|
changes.length > 0
|
|
8997
8999
|
? h(
|
|
8998
9000
|
'div',
|
|
8999
9001
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
9000
9002
|
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')),
|
|
9003
|
+
h(G.Button, { disabled: pending || message.trim() === '' || staged.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
9002
9004
|
)
|
|
9003
9005
|
: null,
|
|
9004
9006
|
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.113</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.113</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.noStagedHint` 并禁用提交;有暂存时只调 `git.commit`(Host 本来就是 `git commit -m`,只消费 index)。未暂存改动保留在工作区,需要时用「全部暂存」。
|
|
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,7 @@ const DICT_ZH = {
|
|
|
253
253
|
'git.pull': '拉取',
|
|
254
254
|
'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
|
|
255
255
|
'git.discardFile': '还原该文件的改动',
|
|
256
|
-
'git.
|
|
256
|
+
'git.commitStagedOnlyHint': '只提交「已暂存」的改动;未暂存的改动会留在工作区',
|
|
257
257
|
'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
|
|
258
258
|
'git.more': '更多操作',
|
|
259
259
|
'git.viewDiff': '查看改动对比',
|
|
@@ -503,7 +503,7 @@ const DICT_EN = {
|
|
|
503
503
|
'git.pull': 'Pull',
|
|
504
504
|
'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
|
|
505
505
|
'git.discardFile': 'Revert this file',
|
|
506
|
-
'git.
|
|
506
|
+
'git.commitStagedOnlyHint': 'Only staged changes are committed; unstaged changes stay in the working tree',
|
|
507
507
|
'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
|
|
508
508
|
'git.more': 'More actions',
|
|
509
509
|
'git.viewDiff': 'View diff',
|
package/src/client/50-panels.js
CHANGED
|
@@ -1147,10 +1147,12 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1147
1147
|
setError(t('git.commitNeedsMessage'))
|
|
1148
1148
|
return
|
|
1149
1149
|
}
|
|
1150
|
+
if (staged.length === 0) {
|
|
1151
|
+
setError(t('git.noStagedHint'))
|
|
1152
|
+
return
|
|
1153
|
+
}
|
|
1150
1154
|
void act(async () => {
|
|
1151
|
-
|
|
1152
|
-
const toStage = changes.filter((item) => item.staged !== true).map((item) => item.path)
|
|
1153
|
-
if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
|
|
1155
|
+
/* 只提交「已暂存」的改动;未暂存改动保持原样(需要时用「全部暂存」) */
|
|
1154
1156
|
await G.api('git.commit', { root, message: text })
|
|
1155
1157
|
setMessage('')
|
|
1156
1158
|
})
|
|
@@ -1336,15 +1338,15 @@ G.GitPanel = function GitPanel(props) {
|
|
|
1336
1338
|
},
|
|
1337
1339
|
)
|
|
1338
1340
|
: null,
|
|
1339
|
-
changes.length > 0
|
|
1340
|
-
? h('div', { className: 'gufa-hint' }, t('git.
|
|
1341
|
+
changes.length > 0
|
|
1342
|
+
? h('div', { className: 'gufa-hint' }, staged.length === 0 ? t('git.noStagedHint') : t('git.commitStagedOnlyHint'))
|
|
1341
1343
|
: null,
|
|
1342
1344
|
changes.length > 0
|
|
1343
1345
|
? h(
|
|
1344
1346
|
'div',
|
|
1345
1347
|
{ className: 'gufa-row', style: { justifyContent: 'flex-end', alignItems: 'center', gap: 8 } },
|
|
1346
1348
|
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')),
|
|
1349
|
+
h(G.Button, { disabled: pending || message.trim() === '' || staged.length === 0, primary: true, onClick: commit }, pending ? h(G.Spinner) : null, t('git.commit')),
|
|
1348
1350
|
)
|
|
1349
1351
|
: null,
|
|
1350
1352
|
staged.length > 0 ? h('div', { className: 'gufa-hint' }, `${t('git.staged')} (${staged.length})`) : null,
|