dsh-gufa-code 1.3.100 → 1.3.102
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 +31 -34
- package/desktop/float/GufaFloat.m +4 -25
- 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/host/app-window.js +0 -2
- package/locale/en.json +6 -6
- package/locale/zh.json +8 -7
- package/package.json +1 -1
- package/src/client/00-core.js +22 -22
- package/src/client/58-insert-ref.js +3 -3
- package/src/client/90-app.js +4 -8
- package/src/client/99-main.js +1 -0
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ dsh plugin add dsh-gufa-code
|
|
|
44
44
|
- **Copilot 风格 Tab 行内补全**:光标停/打字后,基于 Harness 自己的 DeepSeek 模型(默认 `deepseek-flash`,不需要额外 Copilot 订阅)流式生成灰色 ghost text,Tab 接受、Esc 忽略;支持 JS/TS/Python/Java/Go/Rust/C++/C#/JSON/YAML/Shell 等常见语言;
|
|
45
45
|
- 保存走磁盘版本冲突检测 + 原子写;未保存标记;
|
|
46
46
|
- **⌘/Ctrl + 点击跳转定义 / 方法实现**:Python 走 **Pyright 语言服务(LSP)**,JS/TS 走 Monaco 内置 TypeScript 语言服务(点击前会按需把当前文件的 import 依赖加载进 Monaco,跨文件变量/函数由 TS 语言服务解析);其他语言暂用项目级定义搜索兜底;优先走 Monaco 语言服务;目标文件没在 Monaco 里打开、或语言没有内置语言服务时,自动用项目级定义搜索兜底(函数 / 类 / 方法 / const / type 等声明)。兜底会解析 import/require 直接定位来源文件,并跳过压缩产物/大文件;同一个文件里的声明、import 命中的定义、目录距离近的定义直接跳,只有多个真正同名的声明才弹「跳转到定义」列表,点同名属性/变量时不会拿远端无关的 const 来凑数;按住 ⌘/Ctrl 悬停时,可跳转的符号会显示下划线 + 手型光标;
|
|
47
|
-
- **⌘⇧N 新开实例窗口**:用古法编程自带原生 helper 打开一个普通 Harness 窗口(同一 Web GUI
|
|
47
|
+
- **⌘⇧N 新开实例窗口**:用古法编程自带原生 helper 打开一个普通 Harness 窗口(同一 Web GUI、共享登录态),新窗口**直接进入古法编程的空工作区**(提示新建或打开工作区,不继承当前项目/标签页),方便并行操作别的工作区;当前窗口全屏时新窗口也直接全屏;macOS 已支持,Windows/Linux 待 helper 实现 full 模式;
|
|
48
48
|
- **全局搜索 / 替换**(左栏放大镜 / `⌘⇧F`):整个项目的文本搜索,支持区分大小写、正则、包含/排除文件(glob);结果按文件分组、高亮匹配,点击跳转行列;替换栏支持保留大小写(AB)、全部替换(需确认)、按文件替换(悬停文件头铅笔)、按单行匹配替换与忽略(悬停结果行);替换前会自动保存未落盘的编辑器内容;Git 项目用 `git ls-files` 枚举文件(尊重 `.gitignore`、含未跟踪文件),非 Git 项目遍历目录并自动跳过 `node_modules` 等依赖/缓存目录;摸鱼悬浮窗里同样可用;
|
|
49
49
|
- 资源管理器文件/文件夹可直接**拖进右侧输入框**变成 @引用;
|
|
50
50
|
- 资源管理器右键:新建 / 重命名 / 删除 / 复制 / 粘贴 / 打开所在文件夹 / 两文件对比;
|
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.102'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -152,7 +152,7 @@ const DICT_ZH = {
|
|
|
152
152
|
'dock.retry': '重试连接',
|
|
153
153
|
'app.title': '古法编程',
|
|
154
154
|
'app.subtitle': 'GUFA CODE',
|
|
155
|
-
'app.newProject': '
|
|
155
|
+
'app.newProject': '新建工作区',
|
|
156
156
|
'app.newWorkspace': '新建工作区',
|
|
157
157
|
'app.switchWorkspace': '切换工作区',
|
|
158
158
|
'app.noWorkspace': '选择工作区',
|
|
@@ -162,14 +162,14 @@ const DICT_ZH = {
|
|
|
162
162
|
'workspace.empty': '还没有工作区,点下方「新建工作区」开始',
|
|
163
163
|
'workspace.unavailable': '当前环境未提供工作区服务;可以用「打开目录」方式进入',
|
|
164
164
|
'workspace.create': '新建工作区',
|
|
165
|
-
'app.openProject': '
|
|
165
|
+
'app.openProject': '打开工作区',
|
|
166
166
|
'app.refresh': '刷新',
|
|
167
167
|
'app.exit': '返回经典模式',
|
|
168
168
|
'app.exitHint': '退出古法编程,回到 DSH 经典界面',
|
|
169
169
|
'app.openFolder': '打开文件夹',
|
|
170
|
-
'app.noProject': '
|
|
171
|
-
'app.noProjectHint': '
|
|
172
|
-
'app.projectName': '
|
|
170
|
+
'app.noProject': '尚未打开工作区',
|
|
171
|
+
'app.noProjectHint': '打开一个工作区,或新建一个工作区,开始古法编程。',
|
|
172
|
+
'app.projectName': '工作区名',
|
|
173
173
|
'app.parentFolder': '父目录',
|
|
174
174
|
'app.cancel': '取消',
|
|
175
175
|
'app.confirm': '确定',
|
|
@@ -185,7 +185,7 @@ const DICT_ZH = {
|
|
|
185
185
|
'app.backdropStrengthHint': '拖动到任意浓度;双击恢复跟随皮肤档位',
|
|
186
186
|
'app.chooseFolder': '选择文件夹',
|
|
187
187
|
'app.manualPath': '或直接输入路径',
|
|
188
|
-
'app.pathPlaceholder': '例如 /Users/me/
|
|
188
|
+
'app.pathPlaceholder': '例如 /Users/me/workspace',
|
|
189
189
|
'activity.explorer': '资源管理器',
|
|
190
190
|
'activity.search': '搜索',
|
|
191
191
|
'activity.git': '源代码管理',
|
|
@@ -194,12 +194,12 @@ const DICT_ZH = {
|
|
|
194
194
|
'activity.chat': '古法 AI 助手',
|
|
195
195
|
'activity.collapseChat': '收起 AI 面板',
|
|
196
196
|
'activity.expandChat': '展开 AI 面板',
|
|
197
|
-
'search.placeholder': '
|
|
197
|
+
'search.placeholder': '搜索工作区中的文本,回车立即搜索',
|
|
198
198
|
'search.caseSensitive': '区分大小写',
|
|
199
199
|
'search.regex': '使用正则表达式',
|
|
200
200
|
'search.clear': '清空搜索',
|
|
201
201
|
'search.searching': '搜索中…',
|
|
202
|
-
'search.idle': '
|
|
202
|
+
'search.idle': '输入关键字搜索整个工作区',
|
|
203
203
|
'search.noResult': '没有找到匹配结果',
|
|
204
204
|
'search.summary': '{files} 个文件中有 {count} 个结果',
|
|
205
205
|
'search.truncated': '结果过多已截断,请缩小范围',
|
|
@@ -238,10 +238,10 @@ const DICT_ZH = {
|
|
|
238
238
|
'explorer.deleteConfirm': '确定删除 {name}?',
|
|
239
239
|
'explorer.refresh': '刷新目录',
|
|
240
240
|
'explorer.loading': '读取目录…',
|
|
241
|
-
'explorer.openProjectFirst': '
|
|
241
|
+
'explorer.openProjectFirst': '请先打开工作区',
|
|
242
242
|
'git.branch': '分支',
|
|
243
243
|
'git.changes': '更改',
|
|
244
|
-
'git.noRepo': '
|
|
244
|
+
'git.noRepo': '当前工作区不是 Git 仓库',
|
|
245
245
|
'git.noChanges': '工作区干净',
|
|
246
246
|
'git.stage': '暂存',
|
|
247
247
|
'git.unstage': '取消暂存',
|
|
@@ -271,7 +271,7 @@ const DICT_ZH = {
|
|
|
271
271
|
'graph.toggleAll': '切换显示范围',
|
|
272
272
|
'graph.allBranches': '全部分支',
|
|
273
273
|
'graph.currentBranch': '仅当前分支',
|
|
274
|
-
'graph.noProject': '
|
|
274
|
+
'graph.noProject': '请先打开工作区',
|
|
275
275
|
'graph.noCommits': '还没有提交',
|
|
276
276
|
'graph.copyHash': '复制完整 hash',
|
|
277
277
|
'graph.copied': '已复制',
|
|
@@ -410,15 +410,15 @@ const DICT_EN = {
|
|
|
410
410
|
'dock.retry': 'Retry connection',
|
|
411
411
|
'app.title': 'Gufa Code',
|
|
412
412
|
'app.subtitle': 'CLASSIC CODING',
|
|
413
|
-
'app.newProject': 'New
|
|
414
|
-
'app.openProject': 'Open
|
|
413
|
+
'app.newProject': 'New workspace',
|
|
414
|
+
'app.openProject': 'Open workspace',
|
|
415
415
|
'app.refresh': 'Refresh',
|
|
416
416
|
'app.exit': 'Classic mode',
|
|
417
417
|
'app.exitHint': 'Leave Gufa Code and return to the classic DSH UI',
|
|
418
418
|
'app.openFolder': 'Open folder',
|
|
419
|
-
'app.noProject': 'No
|
|
420
|
-
'app.noProjectHint': 'Open a
|
|
421
|
-
'app.projectName': '
|
|
419
|
+
'app.noProject': 'No workspace opened',
|
|
420
|
+
'app.noProjectHint': 'Open a workspace or create a new one to start classic coding.',
|
|
421
|
+
'app.projectName': 'Workspace name',
|
|
422
422
|
'app.parentFolder': 'Parent folder',
|
|
423
423
|
'app.cancel': 'Cancel',
|
|
424
424
|
'app.confirm': 'OK',
|
|
@@ -434,7 +434,7 @@ const DICT_EN = {
|
|
|
434
434
|
'app.backdropStrengthHint': 'Drag to any intensity; double-click to follow the skin again',
|
|
435
435
|
'app.chooseFolder': 'Choose folder',
|
|
436
436
|
'app.manualPath': 'Or type a path',
|
|
437
|
-
'app.pathPlaceholder': 'e.g. /Users/me/
|
|
437
|
+
'app.pathPlaceholder': 'e.g. /Users/me/workspace',
|
|
438
438
|
'activity.explorer': 'Explorer',
|
|
439
439
|
'activity.search': 'Search',
|
|
440
440
|
'activity.git': 'Source control',
|
|
@@ -443,12 +443,12 @@ const DICT_EN = {
|
|
|
443
443
|
'activity.chat': 'Gufa AI',
|
|
444
444
|
'activity.collapseChat': 'Collapse AI panel',
|
|
445
445
|
'activity.expandChat': 'Expand AI panel',
|
|
446
|
-
'search.placeholder': 'Search text across the
|
|
446
|
+
'search.placeholder': 'Search text across the workspace (Enter to run)',
|
|
447
447
|
'search.caseSensitive': 'Match case',
|
|
448
448
|
'search.regex': 'Use regular expression',
|
|
449
449
|
'search.clear': 'Clear search',
|
|
450
450
|
'search.searching': 'Searching…',
|
|
451
|
-
'search.idle': 'Type a keyword to search the whole
|
|
451
|
+
'search.idle': 'Type a keyword to search the whole workspace',
|
|
452
452
|
'search.noResult': 'No matches found',
|
|
453
453
|
'search.summary': '{count} results in {files} files',
|
|
454
454
|
'search.truncated': 'Too many results, truncated — narrow the query',
|
|
@@ -487,10 +487,10 @@ const DICT_EN = {
|
|
|
487
487
|
'explorer.deleteConfirm': 'Delete {name}?',
|
|
488
488
|
'explorer.refresh': 'Refresh folder',
|
|
489
489
|
'explorer.loading': 'Reading folder…',
|
|
490
|
-
'explorer.openProjectFirst': 'Open a
|
|
490
|
+
'explorer.openProjectFirst': 'Open a workspace first',
|
|
491
491
|
'git.branch': 'Branch',
|
|
492
492
|
'git.changes': 'Changes',
|
|
493
|
-
'git.noRepo': 'This
|
|
493
|
+
'git.noRepo': 'This workspace is not a Git repository',
|
|
494
494
|
'git.noChanges': 'Working tree clean',
|
|
495
495
|
'git.stage': 'Stage',
|
|
496
496
|
'git.unstage': 'Unstage',
|
|
@@ -520,7 +520,7 @@ const DICT_EN = {
|
|
|
520
520
|
'graph.toggleAll': 'Toggle scope',
|
|
521
521
|
'graph.allBranches': 'All branches',
|
|
522
522
|
'graph.currentBranch': 'Current branch only',
|
|
523
|
-
'graph.noProject': 'Open a
|
|
523
|
+
'graph.noProject': 'Open a workspace first',
|
|
524
524
|
'graph.noCommits': 'No commits yet',
|
|
525
525
|
'graph.copyHash': 'Copy full hash',
|
|
526
526
|
'graph.copied': 'Copied',
|
|
@@ -9790,7 +9790,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
9790
9790
|
if (list.length === 0) return
|
|
9791
9791
|
const root = typeof G.projectRoot === 'string' ? G.projectRoot : ''
|
|
9792
9792
|
if (root === '') {
|
|
9793
|
-
G.refToast('
|
|
9793
|
+
G.refToast('还没有打开工作区,无法把文件转成 @ 引用', 'err')
|
|
9794
9794
|
return
|
|
9795
9795
|
}
|
|
9796
9796
|
const payloads = []
|
|
@@ -9810,7 +9810,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
9810
9810
|
const result = await G.api('fs.matchFiles', { root, files: payloads })
|
|
9811
9811
|
matches = Array.isArray(result?.matches) ? result.matches : []
|
|
9812
9812
|
} catch (error) {
|
|
9813
|
-
G.refToast(
|
|
9813
|
+
G.refToast(`匹配工作区文件失败:${G.errorText(error)}`, 'err')
|
|
9814
9814
|
return
|
|
9815
9815
|
}
|
|
9816
9816
|
if (disposed) return
|
|
@@ -9826,7 +9826,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
9826
9826
|
else G.refToast('插入引用失败:输入框不可用', 'err')
|
|
9827
9827
|
}
|
|
9828
9828
|
if (missing.length > 0) {
|
|
9829
|
-
G.refToast(`${missing.join('、')}
|
|
9829
|
+
G.refToast(`${missing.join('、')} 不在当前工作区里,未插入引用`, 'err')
|
|
9830
9830
|
}
|
|
9831
9831
|
}
|
|
9832
9832
|
|
|
@@ -12195,6 +12195,8 @@ G.GufaApp = function GufaApp(props) {
|
|
|
12195
12195
|
}
|
|
12196
12196
|
}
|
|
12197
12197
|
if (G.isFloatMode()) return
|
|
12198
|
+
/* 实例窗口不继承当前项目,等用户自己新建/打开工作区 */
|
|
12199
|
+
if (G.instanceBoot === true) return
|
|
12198
12200
|
if (typeof sessionCwd === 'string' && sessionCwd !== '') {
|
|
12199
12201
|
try {
|
|
12200
12202
|
const value = await G.api('project.open', { path: sessionCwd })
|
|
@@ -13959,13 +13961,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
13959
13961
|
} catch {
|
|
13960
13962
|
fullscreen = false
|
|
13961
13963
|
}
|
|
13962
|
-
|
|
13963
|
-
try {
|
|
13964
|
-
state = buildFloatSnapshot()
|
|
13965
|
-
} catch {
|
|
13966
|
-
state = undefined
|
|
13967
|
-
}
|
|
13968
|
-
void G.api('app.newWindow', { state, fullscreen }).catch((error) => {
|
|
13964
|
+
void G.api('app.newWindow', { fullscreen }).catch((error) => {
|
|
13969
13965
|
let opened = null
|
|
13970
13966
|
try { opened = window.open(location.href, '_blank') } catch { opened = null }
|
|
13971
13967
|
if (opened !== null && opened !== undefined) {
|
|
@@ -14007,7 +14003,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
14007
14003
|
}
|
|
14008
14004
|
setShortcutsOpen((open) => open === false)
|
|
14009
14005
|
},
|
|
14010
|
-
}), [activePath, tabs, ui.terminalOpen, ui.sidebarOpen, saveFile, saveCompareTab, patchUi, closeTabWithConfirm
|
|
14006
|
+
}), [activePath, tabs, ui.terminalOpen, ui.sidebarOpen, saveFile, saveCompareTab, patchUi, closeTabWithConfirm])
|
|
14011
14007
|
G.useIdeShortcuts(ideShortcutHandlers)
|
|
14012
14008
|
|
|
14013
14009
|
/* 原生快捷键服务派发到当前 App 的动作表(IDE 模式内有效)。 */
|
|
@@ -15597,6 +15593,7 @@ const GUFA_PLUGIN = {
|
|
|
15597
15593
|
try {
|
|
15598
15594
|
const instanceMode = /[?&]gufa-instance=1/.test(String(location.search || ''))
|
|
15599
15595
|
if (instanceMode && document.documentElement.hasAttribute('data-gufa-float') !== true) {
|
|
15596
|
+
G.instanceBoot = true
|
|
15600
15597
|
document.documentElement.setAttribute('data-gufa-booting', '1')
|
|
15601
15598
|
let attempts = 0
|
|
15602
15599
|
let timer = 0
|
|
@@ -441,32 +441,11 @@ static NSURL *GufaInstanceURL(NSString *appUrl) {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
if (self.fullMode) {
|
|
444
|
-
/*
|
|
445
|
-
|
|
444
|
+
/* 实例窗口:不继承主窗口项目/标签页,保持干净的新工作区;
|
|
445
|
+
WKWebView data store 共享,先清掉上次摸鱼/实例残留的状态。 */
|
|
446
446
|
NSMutableString *js = [NSMutableString stringWithString:@"try{"];
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (fullState != nil) {
|
|
450
|
-
NSString *projectRoot = [fullState[@"projectRoot"] isKindOfClass:[NSString class]] ? fullState[@"projectRoot"] : @"";
|
|
451
|
-
if (projectRoot.length > 0) {
|
|
452
|
-
/* 客户端用 JSON.parse 读 project,本地存的是 JSON 字符串(带引号),这里用 JSON.stringify 生成 */
|
|
453
|
-
[js appendFormat:@"localStorage.setItem('gufa-code:project', JSON.stringify(%@));", GufaJSONLiteralString(projectRoot)];
|
|
454
|
-
}
|
|
455
|
-
NSString *stateText = GufaJSONLiteralString(fullState);
|
|
456
|
-
if (stateText.length > 0) {
|
|
457
|
-
NSString *escapedState = [stateText stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"];
|
|
458
|
-
escapedState = [escapedState stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
|
|
459
|
-
escapedState = [escapedState stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
|
|
460
|
-
escapedState = [escapedState stringByReplacingOccurrencesOfString:@"\r" withString:@""];
|
|
461
|
-
[js appendFormat:@"localStorage.setItem('gufa-code:float-state','%@');", escapedState];
|
|
462
|
-
}
|
|
463
|
-
NSDictionary *fullUi = [fullState[@"ui"] isKindOfClass:[NSDictionary class]] ? fullState[@"ui"] : nil;
|
|
464
|
-
if (fullUi != nil) {
|
|
465
|
-
NSString *uiText = GufaJSONLiteralString(fullUi);
|
|
466
|
-
NSString *escapedUi = [uiText stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"];
|
|
467
|
-
escapedUi = [escapedUi stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
|
|
468
|
-
[js appendFormat:@"localStorage.setItem('gufa-code:ui:v1','%@');", escapedUi];
|
|
469
|
-
}
|
|
447
|
+
for (NSString *key in @[@"gufa-code:float", @"gufa-code:float-state", @"gufa-code:project", @"gufa-code:ui:v1", @"gufa-code:tabs:v1", @"gufa-code:mode:v1"]) {
|
|
448
|
+
[js appendFormat:@"localStorage.removeItem('%@');", key];
|
|
470
449
|
}
|
|
471
450
|
[js appendString:@"}catch(e){}"];
|
|
472
451
|
WKUserScript *stateScript = [[WKUserScript alloc] initWithSource:js injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
|
|
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.101</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.101</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
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
- 实现:复用插件自带的原生 helper(`desktop/float/GufaFloat.m`),payload 传 `{full:true, authUrl, appUrl}` —— helper 建普通标题栏窗口、Regular 激活策略、跳过摸鱼 localStorage/隐藏主窗/吸附,加载同一个 DSH Web GUI;鉴权复用它已有的 `connection.authenticatedUrl()` token 流程。
|
|
60
60
|
- 客户端 ⌘⇧N 必须先调 Host `app.newWindow`,失败才回退 `window.open`(Electron 的 setWindowOpenHandler 会 deny 并用外部浏览器打开 http(s),不是应用内窗口)。
|
|
61
61
|
- 新窗口与 Electron 主窗口共享的是 **同一个 Host/服务端**,但 UI 进程独立(WKWebView,不走 Electron preload);所以别让新窗口依赖 `window.dshDesktop` 之类的 Electron preload API。
|
|
62
|
-
-
|
|
63
|
-
- helper 的 WKWebView data store 与摸鱼悬浮层共享;full
|
|
62
|
+
- **实例窗口不继承主窗口项目**(用户明确要求新窗口用来操作别的工作区):helper full 模式只清空 localStorage 里的 `gufa-code:float/float-state/project/ui/tabs/mode`,URL 带 `?gufa-instance=1`;客户端 boot 时反复调 `G.enterGufa()` 直到 `.gufa-overlay-root` 挂载,并通过 `G.instanceBoot` 跳过 App 的 `sessionCwd` 自动打开项目分支,最终停在「尚打开项目 / 打开项目 / 新建项目」空状态。
|
|
63
|
+
- helper 的 WKWebView data store 与摸鱼悬浮层共享;full 模式必须清残留标记,否则新窗口会误进摸鱼 UI 或恢复上次项目。
|
|
64
64
|
- **全屏继承**:客户端用 `innerWidth/innerHeight` 对比 `screen.width/height` 和 `screen.availWidth/availHeight` 判断当前是否全屏,payload 传 `fullscreen:true`,helper 在窗口显示后 `toggleFullScreen`;不要依赖 Electron preload 或 AX 查询(Host 在 Node 模式进程里拿不到 Electron)。
|
|
65
65
|
|
|
66
66
|
## 1. 弹窗/菜单层级:只有一个正确做法(反复踩过多次,最终定案)
|
package/host/app-window.js
CHANGED
|
@@ -47,12 +47,10 @@ export async function newWindow(body, env) {
|
|
|
47
47
|
}
|
|
48
48
|
const base = `${webServer.protocol}//127.0.0.1:${String(webServer.port)}`
|
|
49
49
|
const authUrl = connection.authenticatedUrl(`${base}/`)
|
|
50
|
-
const state = body !== null && typeof body === 'object' && body.state !== null && typeof body.state === 'object' ? body.state : undefined
|
|
51
50
|
const fullscreen = body !== null && typeof body === 'object' && body.fullscreen === true
|
|
52
51
|
const payload = JSON.stringify({
|
|
53
52
|
full: true,
|
|
54
53
|
fullscreen,
|
|
55
|
-
state,
|
|
56
54
|
authUrl,
|
|
57
55
|
appUrl: `${base}/`,
|
|
58
56
|
title: 'DeepSeek Harness',
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Gufa Code · AI Copilot",
|
|
4
|
-
"description": "One-click VS Code-style IDE inside DSH: Monaco editor, file tree, create/open
|
|
4
|
+
"description": "One-click VS Code-style IDE inside DSH: Monaco editor, file tree, create/open workspaces, Git, SSH, real terminal, and an AI chat panel that assists hand-written code."
|
|
5
5
|
},
|
|
6
6
|
"panel": {
|
|
7
7
|
"label": "Gufa Code"
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"app": {
|
|
10
10
|
"title": "Gufa Code",
|
|
11
11
|
"subtitle": "CLASSIC CODING",
|
|
12
|
-
"newProject": "New
|
|
13
|
-
"openProject": "Open
|
|
12
|
+
"newProject": "New workspace",
|
|
13
|
+
"openProject": "Open workspace",
|
|
14
14
|
"refresh": "Refresh",
|
|
15
15
|
"exit": "Leave Gufa Code",
|
|
16
16
|
"exitHint": "Back to DSH conversation",
|
|
17
17
|
"openFolder": "Open folder",
|
|
18
|
-
"noProject": "No
|
|
19
|
-
"noProjectHint": "Open a
|
|
20
|
-
"projectName": "
|
|
18
|
+
"noProject": "No workspace opened",
|
|
19
|
+
"noProjectHint": "Open a workspace or create a new one to start classic coding.",
|
|
20
|
+
"projectName": "Workspace name",
|
|
21
21
|
"parentFolder": "Parent folder",
|
|
22
22
|
"cancel": "Cancel",
|
|
23
23
|
"confirm": "OK",
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "古法编程 · AI 辅助",
|
|
4
|
-
"description": "一键进入 VS Code 风格 IDE:Monaco
|
|
4
|
+
"description": "一键进入 VS Code 风格 IDE:Monaco 编辑器、文件树、新建/打开工作区、Git、SSH、真实终端,右侧 AI 聊天辅助手写代码。"
|
|
5
5
|
},
|
|
6
6
|
"panel": {
|
|
7
7
|
"label": "古法编程"
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"app": {
|
|
10
10
|
"title": "古法编程",
|
|
11
11
|
"subtitle": "GUFA CODE",
|
|
12
|
-
"newProject": "
|
|
13
|
-
"openProject": "
|
|
12
|
+
"newProject": "新建工作区",
|
|
13
|
+
"openProject": "打开工作区",
|
|
14
14
|
"refresh": "刷新",
|
|
15
15
|
"exit": "退出古法编程",
|
|
16
16
|
"exitHint": "返回 DSH 对话",
|
|
17
17
|
"openFolder": "打开文件夹",
|
|
18
|
-
"noProject": "
|
|
19
|
-
"noProjectHint": "
|
|
20
|
-
"projectName": "
|
|
18
|
+
"noProject": "尚未打开工作区",
|
|
19
|
+
"noProjectHint": "打开一个工作区,或新建一个工作区,开始古法编程。",
|
|
20
|
+
"projectName": "工作区名",
|
|
21
21
|
"parentFolder": "父目录",
|
|
22
22
|
"cancel": "取消",
|
|
23
23
|
"confirm": "确定",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"loading": "加载中…",
|
|
26
26
|
"error": "出错了",
|
|
27
27
|
"retry": "重试",
|
|
28
|
-
"hostStale": "插件已升级:当前 Host 仍是旧版本。AI 对话与编辑器已可用;请退出并重新打开 DeepSeek Harness 以启用真实终端。"
|
|
28
|
+
"hostStale": "插件已升级:当前 Host 仍是旧版本。AI 对话与编辑器已可用;请退出并重新打开 DeepSeek Harness 以启用真实终端。",
|
|
29
|
+
"noRepo": "当前工作区不是 Git 仓库"
|
|
29
30
|
},
|
|
30
31
|
"activity": {
|
|
31
32
|
"explorer": "资源管理器",
|
package/package.json
CHANGED
package/src/client/00-core.js
CHANGED
|
@@ -144,7 +144,7 @@ const DICT_ZH = {
|
|
|
144
144
|
'dock.retry': '重试连接',
|
|
145
145
|
'app.title': '古法编程',
|
|
146
146
|
'app.subtitle': 'GUFA CODE',
|
|
147
|
-
'app.newProject': '
|
|
147
|
+
'app.newProject': '新建工作区',
|
|
148
148
|
'app.newWorkspace': '新建工作区',
|
|
149
149
|
'app.switchWorkspace': '切换工作区',
|
|
150
150
|
'app.noWorkspace': '选择工作区',
|
|
@@ -154,14 +154,14 @@ const DICT_ZH = {
|
|
|
154
154
|
'workspace.empty': '还没有工作区,点下方「新建工作区」开始',
|
|
155
155
|
'workspace.unavailable': '当前环境未提供工作区服务;可以用「打开目录」方式进入',
|
|
156
156
|
'workspace.create': '新建工作区',
|
|
157
|
-
'app.openProject': '
|
|
157
|
+
'app.openProject': '打开工作区',
|
|
158
158
|
'app.refresh': '刷新',
|
|
159
159
|
'app.exit': '返回经典模式',
|
|
160
160
|
'app.exitHint': '退出古法编程,回到 DSH 经典界面',
|
|
161
161
|
'app.openFolder': '打开文件夹',
|
|
162
|
-
'app.noProject': '
|
|
163
|
-
'app.noProjectHint': '
|
|
164
|
-
'app.projectName': '
|
|
162
|
+
'app.noProject': '尚未打开工作区',
|
|
163
|
+
'app.noProjectHint': '打开一个工作区,或新建一个工作区,开始古法编程。',
|
|
164
|
+
'app.projectName': '工作区名',
|
|
165
165
|
'app.parentFolder': '父目录',
|
|
166
166
|
'app.cancel': '取消',
|
|
167
167
|
'app.confirm': '确定',
|
|
@@ -177,7 +177,7 @@ const DICT_ZH = {
|
|
|
177
177
|
'app.backdropStrengthHint': '拖动到任意浓度;双击恢复跟随皮肤档位',
|
|
178
178
|
'app.chooseFolder': '选择文件夹',
|
|
179
179
|
'app.manualPath': '或直接输入路径',
|
|
180
|
-
'app.pathPlaceholder': '例如 /Users/me/
|
|
180
|
+
'app.pathPlaceholder': '例如 /Users/me/workspace',
|
|
181
181
|
'activity.explorer': '资源管理器',
|
|
182
182
|
'activity.search': '搜索',
|
|
183
183
|
'activity.git': '源代码管理',
|
|
@@ -186,12 +186,12 @@ const DICT_ZH = {
|
|
|
186
186
|
'activity.chat': '古法 AI 助手',
|
|
187
187
|
'activity.collapseChat': '收起 AI 面板',
|
|
188
188
|
'activity.expandChat': '展开 AI 面板',
|
|
189
|
-
'search.placeholder': '
|
|
189
|
+
'search.placeholder': '搜索工作区中的文本,回车立即搜索',
|
|
190
190
|
'search.caseSensitive': '区分大小写',
|
|
191
191
|
'search.regex': '使用正则表达式',
|
|
192
192
|
'search.clear': '清空搜索',
|
|
193
193
|
'search.searching': '搜索中…',
|
|
194
|
-
'search.idle': '
|
|
194
|
+
'search.idle': '输入关键字搜索整个工作区',
|
|
195
195
|
'search.noResult': '没有找到匹配结果',
|
|
196
196
|
'search.summary': '{files} 个文件中有 {count} 个结果',
|
|
197
197
|
'search.truncated': '结果过多已截断,请缩小范围',
|
|
@@ -230,10 +230,10 @@ const DICT_ZH = {
|
|
|
230
230
|
'explorer.deleteConfirm': '确定删除 {name}?',
|
|
231
231
|
'explorer.refresh': '刷新目录',
|
|
232
232
|
'explorer.loading': '读取目录…',
|
|
233
|
-
'explorer.openProjectFirst': '
|
|
233
|
+
'explorer.openProjectFirst': '请先打开工作区',
|
|
234
234
|
'git.branch': '分支',
|
|
235
235
|
'git.changes': '更改',
|
|
236
|
-
'git.noRepo': '
|
|
236
|
+
'git.noRepo': '当前工作区不是 Git 仓库',
|
|
237
237
|
'git.noChanges': '工作区干净',
|
|
238
238
|
'git.stage': '暂存',
|
|
239
239
|
'git.unstage': '取消暂存',
|
|
@@ -263,7 +263,7 @@ const DICT_ZH = {
|
|
|
263
263
|
'graph.toggleAll': '切换显示范围',
|
|
264
264
|
'graph.allBranches': '全部分支',
|
|
265
265
|
'graph.currentBranch': '仅当前分支',
|
|
266
|
-
'graph.noProject': '
|
|
266
|
+
'graph.noProject': '请先打开工作区',
|
|
267
267
|
'graph.noCommits': '还没有提交',
|
|
268
268
|
'graph.copyHash': '复制完整 hash',
|
|
269
269
|
'graph.copied': '已复制',
|
|
@@ -402,15 +402,15 @@ const DICT_EN = {
|
|
|
402
402
|
'dock.retry': 'Retry connection',
|
|
403
403
|
'app.title': 'Gufa Code',
|
|
404
404
|
'app.subtitle': 'CLASSIC CODING',
|
|
405
|
-
'app.newProject': 'New
|
|
406
|
-
'app.openProject': 'Open
|
|
405
|
+
'app.newProject': 'New workspace',
|
|
406
|
+
'app.openProject': 'Open workspace',
|
|
407
407
|
'app.refresh': 'Refresh',
|
|
408
408
|
'app.exit': 'Classic mode',
|
|
409
409
|
'app.exitHint': 'Leave Gufa Code and return to the classic DSH UI',
|
|
410
410
|
'app.openFolder': 'Open folder',
|
|
411
|
-
'app.noProject': 'No
|
|
412
|
-
'app.noProjectHint': 'Open a
|
|
413
|
-
'app.projectName': '
|
|
411
|
+
'app.noProject': 'No workspace opened',
|
|
412
|
+
'app.noProjectHint': 'Open a workspace or create a new one to start classic coding.',
|
|
413
|
+
'app.projectName': 'Workspace name',
|
|
414
414
|
'app.parentFolder': 'Parent folder',
|
|
415
415
|
'app.cancel': 'Cancel',
|
|
416
416
|
'app.confirm': 'OK',
|
|
@@ -426,7 +426,7 @@ const DICT_EN = {
|
|
|
426
426
|
'app.backdropStrengthHint': 'Drag to any intensity; double-click to follow the skin again',
|
|
427
427
|
'app.chooseFolder': 'Choose folder',
|
|
428
428
|
'app.manualPath': 'Or type a path',
|
|
429
|
-
'app.pathPlaceholder': 'e.g. /Users/me/
|
|
429
|
+
'app.pathPlaceholder': 'e.g. /Users/me/workspace',
|
|
430
430
|
'activity.explorer': 'Explorer',
|
|
431
431
|
'activity.search': 'Search',
|
|
432
432
|
'activity.git': 'Source control',
|
|
@@ -435,12 +435,12 @@ const DICT_EN = {
|
|
|
435
435
|
'activity.chat': 'Gufa AI',
|
|
436
436
|
'activity.collapseChat': 'Collapse AI panel',
|
|
437
437
|
'activity.expandChat': 'Expand AI panel',
|
|
438
|
-
'search.placeholder': 'Search text across the
|
|
438
|
+
'search.placeholder': 'Search text across the workspace (Enter to run)',
|
|
439
439
|
'search.caseSensitive': 'Match case',
|
|
440
440
|
'search.regex': 'Use regular expression',
|
|
441
441
|
'search.clear': 'Clear search',
|
|
442
442
|
'search.searching': 'Searching…',
|
|
443
|
-
'search.idle': 'Type a keyword to search the whole
|
|
443
|
+
'search.idle': 'Type a keyword to search the whole workspace',
|
|
444
444
|
'search.noResult': 'No matches found',
|
|
445
445
|
'search.summary': '{count} results in {files} files',
|
|
446
446
|
'search.truncated': 'Too many results, truncated — narrow the query',
|
|
@@ -479,10 +479,10 @@ const DICT_EN = {
|
|
|
479
479
|
'explorer.deleteConfirm': 'Delete {name}?',
|
|
480
480
|
'explorer.refresh': 'Refresh folder',
|
|
481
481
|
'explorer.loading': 'Reading folder…',
|
|
482
|
-
'explorer.openProjectFirst': 'Open a
|
|
482
|
+
'explorer.openProjectFirst': 'Open a workspace first',
|
|
483
483
|
'git.branch': 'Branch',
|
|
484
484
|
'git.changes': 'Changes',
|
|
485
|
-
'git.noRepo': 'This
|
|
485
|
+
'git.noRepo': 'This workspace is not a Git repository',
|
|
486
486
|
'git.noChanges': 'Working tree clean',
|
|
487
487
|
'git.stage': 'Stage',
|
|
488
488
|
'git.unstage': 'Unstage',
|
|
@@ -512,7 +512,7 @@ const DICT_EN = {
|
|
|
512
512
|
'graph.toggleAll': 'Toggle scope',
|
|
513
513
|
'graph.allBranches': 'All branches',
|
|
514
514
|
'graph.currentBranch': 'Current branch only',
|
|
515
|
-
'graph.noProject': 'Open a
|
|
515
|
+
'graph.noProject': 'Open a workspace first',
|
|
516
516
|
'graph.noCommits': 'No commits yet',
|
|
517
517
|
'graph.copyHash': 'Copy full hash',
|
|
518
518
|
'graph.copied': 'Copied',
|
|
@@ -94,7 +94,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
94
94
|
if (list.length === 0) return
|
|
95
95
|
const root = typeof G.projectRoot === 'string' ? G.projectRoot : ''
|
|
96
96
|
if (root === '') {
|
|
97
|
-
G.refToast('
|
|
97
|
+
G.refToast('还没有打开工作区,无法把文件转成 @ 引用', 'err')
|
|
98
98
|
return
|
|
99
99
|
}
|
|
100
100
|
const payloads = []
|
|
@@ -114,7 +114,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
114
114
|
const result = await G.api('fs.matchFiles', { root, files: payloads })
|
|
115
115
|
matches = Array.isArray(result?.matches) ? result.matches : []
|
|
116
116
|
} catch (error) {
|
|
117
|
-
G.refToast(
|
|
117
|
+
G.refToast(`匹配工作区文件失败:${G.errorText(error)}`, 'err')
|
|
118
118
|
return
|
|
119
119
|
}
|
|
120
120
|
if (disposed) return
|
|
@@ -130,7 +130,7 @@ G.installChatFilePaste = function installChatFilePaste(ctx) {
|
|
|
130
130
|
else G.refToast('插入引用失败:输入框不可用', 'err')
|
|
131
131
|
}
|
|
132
132
|
if (missing.length > 0) {
|
|
133
|
-
G.refToast(`${missing.join('、')}
|
|
133
|
+
G.refToast(`${missing.join('、')} 不在当前工作区里,未插入引用`, 'err')
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
package/src/client/90-app.js
CHANGED
|
@@ -354,6 +354,8 @@ G.GufaApp = function GufaApp(props) {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
if (G.isFloatMode()) return
|
|
357
|
+
/* 实例窗口不继承当前项目,等用户自己新建/打开工作区 */
|
|
358
|
+
if (G.instanceBoot === true) return
|
|
357
359
|
if (typeof sessionCwd === 'string' && sessionCwd !== '') {
|
|
358
360
|
try {
|
|
359
361
|
const value = await G.api('project.open', { path: sessionCwd })
|
|
@@ -2118,13 +2120,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2118
2120
|
} catch {
|
|
2119
2121
|
fullscreen = false
|
|
2120
2122
|
}
|
|
2121
|
-
|
|
2122
|
-
try {
|
|
2123
|
-
state = buildFloatSnapshot()
|
|
2124
|
-
} catch {
|
|
2125
|
-
state = undefined
|
|
2126
|
-
}
|
|
2127
|
-
void G.api('app.newWindow', { state, fullscreen }).catch((error) => {
|
|
2123
|
+
void G.api('app.newWindow', { fullscreen }).catch((error) => {
|
|
2128
2124
|
let opened = null
|
|
2129
2125
|
try { opened = window.open(location.href, '_blank') } catch { opened = null }
|
|
2130
2126
|
if (opened !== null && opened !== undefined) {
|
|
@@ -2166,7 +2162,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2166
2162
|
}
|
|
2167
2163
|
setShortcutsOpen((open) => open === false)
|
|
2168
2164
|
},
|
|
2169
|
-
}), [activePath, tabs, ui.terminalOpen, ui.sidebarOpen, saveFile, saveCompareTab, patchUi, closeTabWithConfirm
|
|
2165
|
+
}), [activePath, tabs, ui.terminalOpen, ui.sidebarOpen, saveFile, saveCompareTab, patchUi, closeTabWithConfirm])
|
|
2170
2166
|
G.useIdeShortcuts(ideShortcutHandlers)
|
|
2171
2167
|
|
|
2172
2168
|
/* 原生快捷键服务派发到当前 App 的动作表(IDE 模式内有效)。 */
|
package/src/client/99-main.js
CHANGED
|
@@ -435,6 +435,7 @@ const GUFA_PLUGIN = {
|
|
|
435
435
|
try {
|
|
436
436
|
const instanceMode = /[?&]gufa-instance=1/.test(String(location.search || ''))
|
|
437
437
|
if (instanceMode && document.documentElement.hasAttribute('data-gufa-float') !== true) {
|
|
438
|
+
G.instanceBoot = true
|
|
438
439
|
document.documentElement.setAttribute('data-gufa-booting', '1')
|
|
439
440
|
let attempts = 0
|
|
440
441
|
let timer = 0
|