dsh-gufa-code 1.3.209 → 1.3.211

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 CHANGED
@@ -115,6 +115,17 @@ dsh plugin add dsh-gufa-code
115
115
  - 颜色全部走 DSH 主题 token,亮/暗主题自动跟随;界面宽度、开关状态持久化到 localStorage;
116
116
  - 与皮肤插件兼容:如果装有「滑动变祖」这类皮肤,IDE 面板会半透明透出皮肤人像/粒子,编辑器区域也保持轻微透明。
117
117
 
118
+ ## 更新日志
119
+
120
+ ### 1.3.211(最新)
121
+
122
+ - **Git 面板支持多个仓库**:自动列出工作区根目录和一级子目录里的全部 Git 仓库,可逐个查看状态、暂存、提交、推送、拉取、切换分支、查看 diff / Git Graph;子目录仓库摘要每 5 秒自动刷新。
123
+ - **Git 还原逻辑修正**:未跟踪的新文件不再报 `pathspec ... did not match`,改为删除文件并二次确认;未跟踪状态显示为 `U`;「撤销所有改动」会连同未跟踪新文件一起删除(保留 `.gitignore` 忽略的文件)。
124
+ - **资源管理器支持系统剪贴板粘贴**:在 Finder / 资源管理器里复制的文件或文件夹,可直接 `Cmd/Ctrl+V` 或右键「粘贴」进当前目录;支持多选、文件夹、同名自动生成「副本」(macOS / Windows / Linux)。
125
+ - **切换会话弹窗显示会话状态**:与经典侧边栏一致——运行中显示 spinner,待审批 / 计划待审 / 待回答显示黄色状态点和紧凑文案,已完成显示绿点,空闲留空。
126
+ - **修复 Cmd+K 清空终端失效**:命令改派支持懒注册命令、按当前快捷键目录动态识别实际绑定「主修饰键+K」的命令,并在 dispatch 层兜底;DSH 快捷键冲突或命令 id 变化时 IDE 内仍能接管为「清空终端」。
127
+ - **作者的话补充**:想清楚自己到底要什么,AI 交付的必须完完全全符合预期,包括每一处细节。
128
+
118
129
  ## 发布(维护者)
119
130
 
120
131
  打 tag + 建 GitHub Release 即可自动发布:`publish.yml` 用 npm trusted publishing(OIDC)发 npm 包,`build-float.yml` 编译三平台 helper 并挂到 Release assets。详见 [`docs/RELEASE.md`](docs/RELEASE.md)。
@@ -159,7 +170,7 @@ MIT
159
170
  3. **你是软件的第一责任人。** 署名是你,背锅也是你。过度崇信 AI 带来的线上事故、数据错误、安全漏洞,不会因为「是模型写的」就转移到别人头上——受损的是你自己的信心、公信力、权威和荣誉,严重的还会留下职业污点。真出了问题,亏的一定是你,而且亏得很大。
160
171
  4. **AI 该是降低工作压力、提升水平的工具,不是让资本家无限压榨的工具。** 遇到那种「什么都想要」的老板或公司,尽量远离:既要速度又要质量、既要降本又要创新,最后压力全落在你身上,出事时只换来一句「你很差、你的责任、你能力不行」。软件行业的本质从来没变,AI 只是把「既要又要」无限放大了——这本该是让软件更优秀、更精良的巨大技术飞跃,却硬生生被做成了十倍百倍的屎山,最后还要赖到程序员头上。
161
172
  5. **不要变蠢。** 把记忆外包给搜索、把思考外包给模型,短期很爽,长期是把吃饭的本事一点点交出去。刻意保留手写、读源码、自己定位问题的习惯——那才是 AI 加速器的底座。
162
- 6. **不要沉迷「AI 工作流组合」。** 把一堆 Agent、插件、提示词串成流程去解决场景,本质是「没苦硬吃」:这些流程能实现的事,大模型每进化一个版本就吃掉一批,说不定过不了多久一句话就全搞定了。想想 ChatGPT 最早那版和现在差多远——你我都是亲眼看着它一步步长起来的;参考扣子(Coze)这类工作流平台的结局就知道了。你辛辛苦苦东拼西凑的东西,可能抵不过一次模型升级;真正值得投入的,是理解问题、定义边界、验证结果——这些才是模型升级也拿不走的东西。
173
+ 6. **不要沉迷「AI 工作流组合」。** 把一堆 Agent、插件、提示词串成流程去解决场景,本质是「没苦硬吃」:这些流程能实现的事,大模型每进化一个版本就吃掉一批,说不定过不了多久一句话就全搞定了。想想 ChatGPT 最早那版和现在差多远——你我都是亲眼看着它一步步长起来的;参考扣子(Coze)这类工作流平台的结局就知道了。你辛辛苦苦东拼西凑的东西,可能抵不过一次模型升级;真正值得投入的,是理解问题、定义边界、验证结果——这些才是模型升级也拿不走的东西。 真正值得投入的,是你要想好、想清楚自己到底想要的是什么,并且 AI 给你的就是完完本本你想要的东西,包括每一处细节。
163
174
  7. **工具越强,判断力越贵。** AI 把「写」的成本压到极低,抬高的恰恰是「选什么写、写得对不对、值不值得写」的价钱。能自己验证、能自己回退、能自己解释——这三件事决定你是使用者,还是被使用者。
164
175
  8. **好的 AI 工具要看得见、可回退、可审计。** 这也是古法编程的设计底线:每个动作落在你眼前,每处改动可 diff、可撤销,右侧就是官方 DSH 会话本体——AI 在明处干活,你在明处验收。
165
176
  9. **DeepSeek 是历史上、也是将来最好的 AI。**
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.209'
19
+ G.BUILD = '1.3.211'
20
20
  G.PANEL_ID = 'gufa-code'
21
21
  /** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
22
22
  G.pendingEntryWorkspace = null
@@ -12517,6 +12517,12 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
12517
12517
 
12518
12518
  // 经典模式:不碰任何 DSH 原生命令
12519
12519
  if (G.mode.get() !== true) {
12520
+ /* IDE 模式退出时把 dispatch 补丁还原,经典模式继续走 DSH 原生派发 */
12521
+ if (registry.__gufaDispatchPatched === true && typeof registry.__gufaOriginalDispatch === 'function') {
12522
+ registry.dispatch = registry.__gufaOriginalDispatch
12523
+ delete registry.__gufaOriginalDispatch
12524
+ delete registry.__gufaDispatchPatched
12525
+ }
12520
12526
  try {
12521
12527
  if (window !== undefined && window !== null) {
12522
12528
  if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
@@ -12556,6 +12562,22 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
12556
12562
  'edrv.prevTab': 'prevTab',
12557
12563
  'edrv.nextTab': 'nextTab',
12558
12564
  }
12565
+ /* DSH 升级/用户自定义可能把 Cmd+K 改绑到别的命令 id:以当前快捷键目录为准,
12566
+ 把实际占用「主修饰键+K」的命令也改派成 clearTerminal(默认仍是 session.search)。 */
12567
+ try {
12568
+ const rows = registry.catalog !== null && registry.catalog !== undefined && typeof registry.catalog.getSnapshot === 'function'
12569
+ ? registry.catalog.getSnapshot()
12570
+ : []
12571
+ const wanted = G.isMacPlatform() ? '⌘K' : 'Ctrl+K'
12572
+ for (const row of Array.isArray(rows) ? rows : []) {
12573
+ const keys = Array.isArray(row?.keys) ? row.keys : []
12574
+ if (keys.join('') !== wanted) continue
12575
+ if (typeof row?.id !== 'string' || row.id === '') continue
12576
+ if (typeof commandActions[row.id] !== 'string') commandActions[row.id] = 'clearTerminal'
12577
+ }
12578
+ } catch {
12579
+ /* ignore */
12580
+ }
12559
12581
  service.__gufaCommandActions = commandActions
12560
12582
  const wrapped = []
12561
12583
  const commands = registry.commands
@@ -12572,6 +12594,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
12572
12594
  status: 'handled',
12573
12595
  run: () => {
12574
12596
  try {
12597
+ if ((window.__gufaCommandRemapLogs ?? 0) < 20) {
12598
+ window.__gufaCommandRemapLogs = (window.__gufaCommandRemapLogs ?? 0) + 1
12599
+ void G.api('dev.log', { message: `command-remap ${id} -> ${mapped}` }).catch(() => {})
12600
+ }
12575
12601
  if (mapped.startsWith('editor:')) {
12576
12602
  if (G.bus !== null && G.bus !== undefined) G.bus.emit('editor:command', mapped.slice('editor:'.length))
12577
12603
  return
@@ -12612,7 +12638,79 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
12612
12638
  service.__gufaPatchedCommands.push({ command, originalResolve })
12613
12639
  wrapped.push(id)
12614
12640
  }
12641
+ /* 懒加载的命令(例如 workspace 的 session.search 可能晚于插件初始化才注册):
12642
+ 包一次 commands.set,注册时立即补上 resolve 改派,避免 Cmd+K 又退回原生搜索。 */
12643
+ try {
12644
+ if (typeof commands.set === 'function' && commands.__gufaSetPatched !== true) {
12645
+ const originalSet = commands.set
12646
+ commands.set = function gufaShortcutCommandsSet(id, command) {
12647
+ const result = originalSet.call(this, id, command)
12648
+ try {
12649
+ const mapped = service.__gufaCommandActions === null || service.__gufaCommandActions === undefined
12650
+ ? undefined
12651
+ : service.__gufaCommandActions[id]
12652
+ if (typeof mapped === 'string' && command !== null && command !== undefined
12653
+ && typeof command.resolve === 'function' && command.__gufaWrapped !== true) {
12654
+ const originalResolve = command.resolve
12655
+ try {
12656
+ Object.defineProperty(command, '__gufaOriginalResolve', { value: originalResolve, configurable: true })
12657
+ } catch {
12658
+ /* ignore */
12659
+ }
12660
+ command.resolve = makeResolve(id, originalResolve)
12661
+ try {
12662
+ Object.defineProperty(command, '__gufaWrapped', { value: true, configurable: true })
12663
+ } catch {
12664
+ /* ignore */
12665
+ }
12666
+ if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
12667
+ service.__gufaPatchedCommands.push({ command, originalResolve })
12668
+ }
12669
+ } catch {
12670
+ /* ignore */
12671
+ }
12672
+ return result
12673
+ }
12674
+ commands.__gufaSetPatched = true
12675
+ }
12676
+ } catch {
12677
+ /* ignore */
12678
+ }
12615
12679
  }
12680
+ /* 兜底:如果 Cmd+K 在 DSH 里存在快捷键冲突,dispatch 会在调用 command.resolve 之前就
12681
+ 把按键 consume 掉(表现为快捷键完全没反应)。IDE 模式下直接在 dispatch 最前面接管
12682
+ 主修饰键+K → 清空终端,不依赖具体 command id 是否被包到。 */
12683
+ try {
12684
+ if (typeof registry.dispatch === 'function' && registry.__gufaDispatchPatched !== true) {
12685
+ const originalDispatch = registry.dispatch
12686
+ registry.dispatch = function gufaIdeDispatch(gesture, context, consume) {
12687
+ try {
12688
+ if (G.mode.get() === true
12689
+ && typeof document !== 'undefined'
12690
+ && document.querySelector('.gufa-overlay-root') !== null
12691
+ && typeof window.__gufaIdeShortcutDispatch === 'function') {
12692
+ const mac = G.isMacPlatform()
12693
+ const primary = mac ? gesture?.meta === true && gesture?.control !== true : gesture?.control === true
12694
+ if (primary && gesture?.code === 'KeyK' && gesture?.shift !== true && gesture?.alt !== true) {
12695
+ if (typeof consume === 'function') consume()
12696
+ if (gesture?.repeat !== true) {
12697
+ try { window.__gufaIdeShortcutDispatch('clearTerminal') } catch { /* ignore */ }
12698
+ }
12699
+ return { status: 'handled', commandId: 'gufa.ide.clearTerminal' }
12700
+ }
12701
+ }
12702
+ } catch {
12703
+ /* ignore */
12704
+ }
12705
+ return originalDispatch.call(this, gesture, context, consume)
12706
+ }
12707
+ registry.__gufaOriginalDispatch = originalDispatch
12708
+ registry.__gufaDispatchPatched = true
12709
+ }
12710
+ } catch {
12711
+ /* ignore */
12712
+ }
12713
+
12616
12714
  // ── 命令表/配置尚未就绪时重试(插件加载可能早于 ui-layout 注册命令)──
12617
12715
  const expected = Object.keys(commandActions).length
12618
12716
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.209",
3
+ "version": "1.3.211",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -257,6 +257,12 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
257
257
 
258
258
  // 经典模式:不碰任何 DSH 原生命令
259
259
  if (G.mode.get() !== true) {
260
+ /* IDE 模式退出时把 dispatch 补丁还原,经典模式继续走 DSH 原生派发 */
261
+ if (registry.__gufaDispatchPatched === true && typeof registry.__gufaOriginalDispatch === 'function') {
262
+ registry.dispatch = registry.__gufaOriginalDispatch
263
+ delete registry.__gufaOriginalDispatch
264
+ delete registry.__gufaDispatchPatched
265
+ }
260
266
  try {
261
267
  if (window !== undefined && window !== null) {
262
268
  if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
@@ -296,6 +302,22 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
296
302
  'edrv.prevTab': 'prevTab',
297
303
  'edrv.nextTab': 'nextTab',
298
304
  }
305
+ /* DSH 升级/用户自定义可能把 Cmd+K 改绑到别的命令 id:以当前快捷键目录为准,
306
+ 把实际占用「主修饰键+K」的命令也改派成 clearTerminal(默认仍是 session.search)。 */
307
+ try {
308
+ const rows = registry.catalog !== null && registry.catalog !== undefined && typeof registry.catalog.getSnapshot === 'function'
309
+ ? registry.catalog.getSnapshot()
310
+ : []
311
+ const wanted = G.isMacPlatform() ? '⌘K' : 'Ctrl+K'
312
+ for (const row of Array.isArray(rows) ? rows : []) {
313
+ const keys = Array.isArray(row?.keys) ? row.keys : []
314
+ if (keys.join('') !== wanted) continue
315
+ if (typeof row?.id !== 'string' || row.id === '') continue
316
+ if (typeof commandActions[row.id] !== 'string') commandActions[row.id] = 'clearTerminal'
317
+ }
318
+ } catch {
319
+ /* ignore */
320
+ }
299
321
  service.__gufaCommandActions = commandActions
300
322
  const wrapped = []
301
323
  const commands = registry.commands
@@ -312,6 +334,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
312
334
  status: 'handled',
313
335
  run: () => {
314
336
  try {
337
+ if ((window.__gufaCommandRemapLogs ?? 0) < 20) {
338
+ window.__gufaCommandRemapLogs = (window.__gufaCommandRemapLogs ?? 0) + 1
339
+ void G.api('dev.log', { message: `command-remap ${id} -> ${mapped}` }).catch(() => {})
340
+ }
315
341
  if (mapped.startsWith('editor:')) {
316
342
  if (G.bus !== null && G.bus !== undefined) G.bus.emit('editor:command', mapped.slice('editor:'.length))
317
343
  return
@@ -352,7 +378,79 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
352
378
  service.__gufaPatchedCommands.push({ command, originalResolve })
353
379
  wrapped.push(id)
354
380
  }
381
+ /* 懒加载的命令(例如 workspace 的 session.search 可能晚于插件初始化才注册):
382
+ 包一次 commands.set,注册时立即补上 resolve 改派,避免 Cmd+K 又退回原生搜索。 */
383
+ try {
384
+ if (typeof commands.set === 'function' && commands.__gufaSetPatched !== true) {
385
+ const originalSet = commands.set
386
+ commands.set = function gufaShortcutCommandsSet(id, command) {
387
+ const result = originalSet.call(this, id, command)
388
+ try {
389
+ const mapped = service.__gufaCommandActions === null || service.__gufaCommandActions === undefined
390
+ ? undefined
391
+ : service.__gufaCommandActions[id]
392
+ if (typeof mapped === 'string' && command !== null && command !== undefined
393
+ && typeof command.resolve === 'function' && command.__gufaWrapped !== true) {
394
+ const originalResolve = command.resolve
395
+ try {
396
+ Object.defineProperty(command, '__gufaOriginalResolve', { value: originalResolve, configurable: true })
397
+ } catch {
398
+ /* ignore */
399
+ }
400
+ command.resolve = makeResolve(id, originalResolve)
401
+ try {
402
+ Object.defineProperty(command, '__gufaWrapped', { value: true, configurable: true })
403
+ } catch {
404
+ /* ignore */
405
+ }
406
+ if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
407
+ service.__gufaPatchedCommands.push({ command, originalResolve })
408
+ }
409
+ } catch {
410
+ /* ignore */
411
+ }
412
+ return result
413
+ }
414
+ commands.__gufaSetPatched = true
415
+ }
416
+ } catch {
417
+ /* ignore */
418
+ }
419
+ }
420
+ /* 兜底:如果 Cmd+K 在 DSH 里存在快捷键冲突,dispatch 会在调用 command.resolve 之前就
421
+ 把按键 consume 掉(表现为快捷键完全没反应)。IDE 模式下直接在 dispatch 最前面接管
422
+ 主修饰键+K → 清空终端,不依赖具体 command id 是否被包到。 */
423
+ try {
424
+ if (typeof registry.dispatch === 'function' && registry.__gufaDispatchPatched !== true) {
425
+ const originalDispatch = registry.dispatch
426
+ registry.dispatch = function gufaIdeDispatch(gesture, context, consume) {
427
+ try {
428
+ if (G.mode.get() === true
429
+ && typeof document !== 'undefined'
430
+ && document.querySelector('.gufa-overlay-root') !== null
431
+ && typeof window.__gufaIdeShortcutDispatch === 'function') {
432
+ const mac = G.isMacPlatform()
433
+ const primary = mac ? gesture?.meta === true && gesture?.control !== true : gesture?.control === true
434
+ if (primary && gesture?.code === 'KeyK' && gesture?.shift !== true && gesture?.alt !== true) {
435
+ if (typeof consume === 'function') consume()
436
+ if (gesture?.repeat !== true) {
437
+ try { window.__gufaIdeShortcutDispatch('clearTerminal') } catch { /* ignore */ }
438
+ }
439
+ return { status: 'handled', commandId: 'gufa.ide.clearTerminal' }
440
+ }
441
+ }
442
+ } catch {
443
+ /* ignore */
444
+ }
445
+ return originalDispatch.call(this, gesture, context, consume)
446
+ }
447
+ registry.__gufaOriginalDispatch = originalDispatch
448
+ registry.__gufaDispatchPatched = true
449
+ }
450
+ } catch {
451
+ /* ignore */
355
452
  }
453
+
356
454
  // ── 命令表/配置尚未就绪时重试(插件加载可能早于 ui-layout 注册命令)──
357
455
  const expected = Object.keys(commandActions).length
358
456
  try {