dsh-gufa-code 1.3.51 → 1.3.52
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 +4 -0
- package/client.js +20 -2
- 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/FLOAT-ACCEPTANCE.md +2 -2
- package/docs/RELEASE.md +32 -0
- package/host/dev.js +46 -2
- package/package.json +1 -1
- package/src/client/90-app.js +19 -1
package/README.md
CHANGED
|
@@ -105,6 +105,10 @@ dsh plugin add dsh-gufa-code
|
|
|
105
105
|
- 颜色全部走 DSH 主题 token,亮/暗主题自动跟随;界面宽度、开关状态持久化到 localStorage;
|
|
106
106
|
- 与皮肤插件兼容:如果装有「滑动变祖」这类皮肤,IDE 面板会半透明透出皮肤人像/粒子,编辑器区域也保持轻微透明。
|
|
107
107
|
|
|
108
|
+
## 发布(维护者)
|
|
109
|
+
|
|
110
|
+
打 tag + 建 GitHub Release 即可自动发布:`publish.yml` 用 npm trusted publishing(OIDC)发 npm 包,`build-float.yml` 编译三平台 helper 并挂到 Release assets。详见 [`docs/RELEASE.md`](docs/RELEASE.md)。
|
|
111
|
+
|
|
108
112
|
## 开发
|
|
109
113
|
|
|
110
114
|
```sh
|
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.52'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -9726,6 +9726,8 @@ G.GufaApp = function GufaApp(props) {
|
|
|
9726
9726
|
const [floatPicker, setFloatPicker] = useState(null)
|
|
9727
9727
|
/* 摸鱼自检:null | {status:'loading'|'ok'|'error', data:null|object, error:''} */
|
|
9728
9728
|
const [floatDoctor, setFloatDoctor] = useState(null)
|
|
9729
|
+
/* 自检「保存报告」的结果路径/错误(显示在弹窗底部) */
|
|
9730
|
+
const [floatReport, setFloatReport] = useState('')
|
|
9729
9731
|
/* 摸鱼模式(悬浮窗实例)与界面透明度 */
|
|
9730
9732
|
const [moyuMode] = useState(() => G.isFloatMode())
|
|
9731
9733
|
const [floatAlpha, setFloatAlpha] = useState(() => {
|
|
@@ -10530,6 +10532,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
10530
10532
|
|
|
10531
10533
|
/* 摸鱼自检:平台/helper/WebView2/辅助功能/X11 等现场信息,方便真机反馈 */
|
|
10532
10534
|
const openFloatDoctor = useCallback(async () => {
|
|
10535
|
+
setFloatReport('')
|
|
10533
10536
|
setFloatDoctor({ status: 'loading', data: null, error: '' })
|
|
10534
10537
|
try {
|
|
10535
10538
|
const value = await G.api('float.diagnostics')
|
|
@@ -12170,7 +12173,22 @@ G.GufaApp = function GufaApp(props) {
|
|
|
12170
12173
|
h(
|
|
12171
12174
|
'div',
|
|
12172
12175
|
{ className: 'gufa-modal-foot' },
|
|
12173
|
-
h('span', { style: { flex: '1 1 auto' } }),
|
|
12176
|
+
floatReport !== '' ? h('span', { className: 'gufa-hint', style: { flex: '1 1 auto', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, floatReport) : h('span', { style: { flex: '1 1 auto' } }),
|
|
12177
|
+
floatDoctor.status === 'ok'
|
|
12178
|
+
? h(
|
|
12179
|
+
G.Button,
|
|
12180
|
+
{
|
|
12181
|
+
onClick: () => {
|
|
12182
|
+
void G.api('float.saveReport').then((value) => {
|
|
12183
|
+
setFloatReport(typeof value?.path === 'string' ? `已保存:${value.path}` : '已保存')
|
|
12184
|
+
}).catch((error) => {
|
|
12185
|
+
setFloatReport(`保存失败:${G.errorText(error)}`)
|
|
12186
|
+
})
|
|
12187
|
+
},
|
|
12188
|
+
},
|
|
12189
|
+
'保存报告',
|
|
12190
|
+
)
|
|
12191
|
+
: null,
|
|
12174
12192
|
floatDoctor.status === 'ok'
|
|
12175
12193
|
? h(G.Button, { onClick: () => { void navigator.clipboard?.writeText(floatDoctorText) } }, '复制')
|
|
12176
12194
|
: 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.52</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.52</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/FLOAT-ACCEPTANCE.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
1. 在 IDE 标题栏点「摸鱼」(📺 图标按钮);
|
|
9
9
|
2. 选择器底部点「**自检**」;
|
|
10
10
|
3. 弹窗会显示平台、helper 路径/版本、运行时依赖、显示环境、辅助功能/WebView2 检测结果和 `notes` 提示;
|
|
11
|
-
4. 点「复制」把 JSON
|
|
11
|
+
4. 点「复制」把 JSON 保存下来;或点「**保存报告**」——会把自检 JSON + 最近日志写成一个 txt 文件(保存在 `~/.dsh/gufa-float-report-*.txt`)并自动在文件管理器中选中,直接把该文件发回来即可。`notes` 为空 = 没发现明显问题。
|
|
12
12
|
|
|
13
13
|
如果「摸鱼」按钮点了没反应、或选择器报错,也点「自检」,把报错/JSON 发出来。
|
|
14
14
|
|
|
@@ -80,6 +80,6 @@ Requirements: DSH 必须在 **X11 会话**里运行(`echo $XDG_SESSION_TYPE`
|
|
|
80
80
|
DSH 版本 + 插件版本:
|
|
81
81
|
操作步骤:
|
|
82
82
|
现象(截图更好):
|
|
83
|
-
自检 JSON
|
|
83
|
+
自检 JSON / 或「保存报告」生成的文件路径:
|
|
84
84
|
日志片段(/tmp 或 %TEMP% 里对应文件):
|
|
85
85
|
```
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 发布流程(维护者)
|
|
2
|
+
|
|
3
|
+
## 一键发布:打 tag + 建 GitHub Release
|
|
4
|
+
|
|
5
|
+
1. 确认 `package.json` 版本号已更新(`npm version patch --no-git-tag-version` 或手改);
|
|
6
|
+
2. 提交并推送 tag:
|
|
7
|
+
```bash
|
|
8
|
+
git tag v1.3.x && git push origin v1.3.x
|
|
9
|
+
```
|
|
10
|
+
3. 建一个 GitHub Release(网页或 CLI):
|
|
11
|
+
```bash
|
|
12
|
+
gh release create v1.3.x --title "..." --notes "..."
|
|
13
|
+
```
|
|
14
|
+
4. 触发两个 workflow:
|
|
15
|
+
- `.github/workflows/publish.yml`:**npm trusted publishing(OIDC provenance)自动发布**,不需要本地 npm token / 2FA;
|
|
16
|
+
- `.github/workflows/build-float.yml`:三平台编译 helper + 严格冒烟,并把二进制作为 release assets 附上。
|
|
17
|
+
5. 验证:`npm view dsh-gufa-code version`、Release 页面 assets。
|
|
18
|
+
|
|
19
|
+
## 本地发布(不推荐,需要 npm 2FA)
|
|
20
|
+
|
|
21
|
+
`npm publish`(会要求网页 2FA 验证)。优先用上面的 GitHub Release 流程。
|
|
22
|
+
|
|
23
|
+
## 发布前检查
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
node scripts/build-client.mjs
|
|
27
|
+
node --check client.js
|
|
28
|
+
node scripts/selftest-client.mjs # 99
|
|
29
|
+
node scripts/selftest-host.mjs # 30
|
|
30
|
+
node scripts/test-editor.mjs # 19
|
|
31
|
+
npm pack --dry-run | grep desktop/float/bin # 三平台二进制在包里
|
|
32
|
+
```
|
package/host/dev.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 开发/诊断信息:供客户端在启动时探测「Host 半是否为最新代码」。
|
|
3
3
|
* 旧版本 Host(没有本方法)会让 api('dev.version') 返回 not-found,客户端据此提示重启 Harness。
|
|
4
4
|
*/
|
|
5
|
-
import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
5
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
6
6
|
import { readFile, rm } from 'node:fs/promises'
|
|
7
7
|
import { homedir, release, tmpdir } from 'node:os'
|
|
8
8
|
import { execFile, spawn } from 'node:child_process'
|
|
@@ -425,7 +425,7 @@ export function register(router, env) {
|
|
|
425
425
|
})
|
|
426
426
|
|
|
427
427
|
/** 摸鱼自检:返回平台/helper/运行时依赖/显示环境信息,供客户端「自检」按钮展示与用户反馈。 */
|
|
428
|
-
|
|
428
|
+
const collectFloatDiagnostics = async () => {
|
|
429
429
|
const support = floatSupportStatus()
|
|
430
430
|
const result = {
|
|
431
431
|
plugin: { version: PLUGIN_VERSION },
|
|
@@ -548,6 +548,50 @@ export function register(router, env) {
|
|
|
548
548
|
}
|
|
549
549
|
try { debugLog(`float-diagnostics platform=${process.platform} supported=${support.supported} helper=${binary ?? 'none'} notes=${result.notes.length}`) } catch { /* ignore */ }
|
|
550
550
|
return result
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
router.method('float.diagnostics', collectFloatDiagnostics)
|
|
554
|
+
|
|
555
|
+
/** 保存自检报告(诊断 JSON + 日志尾部)到 ~/.dsh,并在文件管理器里选中,方便用户一次性发回。 */
|
|
556
|
+
router.method('float.saveReport', async () => {
|
|
557
|
+
const data = await collectFloatDiagnostics()
|
|
558
|
+
const reportDir = join(homedir(), '.dsh')
|
|
559
|
+
const reportPath = join(reportDir, `gufa-float-report-${Date.now()}.txt`)
|
|
560
|
+
const lines = [
|
|
561
|
+
'古法编程 · 摸鱼自检报告',
|
|
562
|
+
`generatedAt=${new Date().toISOString()}`,
|
|
563
|
+
'---- diagnostics JSON ----',
|
|
564
|
+
JSON.stringify(data, null, 2),
|
|
565
|
+
'',
|
|
566
|
+
'---- logs ----',
|
|
567
|
+
]
|
|
568
|
+
const logCandidates = ['/tmp/gufa-code-debug.log', join(tmpdir(), 'gufa-float-debug.log'), '/tmp/gufa-float-debug.log']
|
|
569
|
+
for (const logPath of logCandidates) {
|
|
570
|
+
lines.push(`## ${logPath}`)
|
|
571
|
+
try {
|
|
572
|
+
const raw = readFileSync(logPath, 'utf8')
|
|
573
|
+
const tail = raw.split('\n').filter((line) => line !== '').slice(-300)
|
|
574
|
+
if (tail.length === 0) lines.push('(empty)')
|
|
575
|
+
else lines.push(...tail)
|
|
576
|
+
} catch (error) {
|
|
577
|
+
lines.push(`(unreadable: ${String(error?.code ?? error)})`)
|
|
578
|
+
}
|
|
579
|
+
lines.push('')
|
|
580
|
+
}
|
|
581
|
+
try {
|
|
582
|
+
mkdirSync(reportDir, { recursive: true })
|
|
583
|
+
writeFileSync(reportPath, lines.join('\n'), { mode: 0o600 })
|
|
584
|
+
} catch (error) {
|
|
585
|
+
throw new ApiError('save-failed', `保存自检报告失败:${String(error?.message ?? error)}`, 500)
|
|
586
|
+
}
|
|
587
|
+
try {
|
|
588
|
+
if (isMac) spawn('open', ['-R', reportPath], { detached: true, stdio: 'ignore' }).unref()
|
|
589
|
+
else if (isWin) spawn('explorer', ['/select,', reportPath], { detached: true, stdio: 'ignore' }).unref()
|
|
590
|
+
else spawn('xdg-open', [reportDir], { detached: true, stdio: 'ignore' }).unref()
|
|
591
|
+
} catch {
|
|
592
|
+
/* 打不开文件管理器不影响保存结果 */
|
|
593
|
+
}
|
|
594
|
+
return { ok: true, path: reportPath }
|
|
551
595
|
})
|
|
552
596
|
|
|
553
597
|
router.method('float.openPrivacy', async () => {
|
package/package.json
CHANGED
package/src/client/90-app.js
CHANGED
|
@@ -161,6 +161,8 @@ G.GufaApp = function GufaApp(props) {
|
|
|
161
161
|
const [floatPicker, setFloatPicker] = useState(null)
|
|
162
162
|
/* 摸鱼自检:null | {status:'loading'|'ok'|'error', data:null|object, error:''} */
|
|
163
163
|
const [floatDoctor, setFloatDoctor] = useState(null)
|
|
164
|
+
/* 自检「保存报告」的结果路径/错误(显示在弹窗底部) */
|
|
165
|
+
const [floatReport, setFloatReport] = useState('')
|
|
164
166
|
/* 摸鱼模式(悬浮窗实例)与界面透明度 */
|
|
165
167
|
const [moyuMode] = useState(() => G.isFloatMode())
|
|
166
168
|
const [floatAlpha, setFloatAlpha] = useState(() => {
|
|
@@ -965,6 +967,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
965
967
|
|
|
966
968
|
/* 摸鱼自检:平台/helper/WebView2/辅助功能/X11 等现场信息,方便真机反馈 */
|
|
967
969
|
const openFloatDoctor = useCallback(async () => {
|
|
970
|
+
setFloatReport('')
|
|
968
971
|
setFloatDoctor({ status: 'loading', data: null, error: '' })
|
|
969
972
|
try {
|
|
970
973
|
const value = await G.api('float.diagnostics')
|
|
@@ -2605,7 +2608,22 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2605
2608
|
h(
|
|
2606
2609
|
'div',
|
|
2607
2610
|
{ className: 'gufa-modal-foot' },
|
|
2608
|
-
h('span', { style: { flex: '1 1 auto' } }),
|
|
2611
|
+
floatReport !== '' ? h('span', { className: 'gufa-hint', style: { flex: '1 1 auto', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, floatReport) : h('span', { style: { flex: '1 1 auto' } }),
|
|
2612
|
+
floatDoctor.status === 'ok'
|
|
2613
|
+
? h(
|
|
2614
|
+
G.Button,
|
|
2615
|
+
{
|
|
2616
|
+
onClick: () => {
|
|
2617
|
+
void G.api('float.saveReport').then((value) => {
|
|
2618
|
+
setFloatReport(typeof value?.path === 'string' ? `已保存:${value.path}` : '已保存')
|
|
2619
|
+
}).catch((error) => {
|
|
2620
|
+
setFloatReport(`保存失败:${G.errorText(error)}`)
|
|
2621
|
+
})
|
|
2622
|
+
},
|
|
2623
|
+
},
|
|
2624
|
+
'保存报告',
|
|
2625
|
+
)
|
|
2626
|
+
: null,
|
|
2609
2627
|
floatDoctor.status === 'ok'
|
|
2610
2628
|
? h(G.Button, { onClick: () => { void navigator.clipboard?.writeText(floatDoctorText) } }, '复制')
|
|
2611
2629
|
: null,
|