chore: 初始化仓库(零源工具箱 0.1.0 基线)

- Go 主进程 cmd/zerorigin(托盘常驻 + 触发器/规则/动作引擎)
- Wails v3 设置进程 cmd/settings(独立 module)
- 监督进程 cmd/watchdog(-supervise 异常重启)
- 构建脚本 build.bat / NSIS 安装包 deploy/、便携版 portable/
- 架构与 MVP 计划文档 docs/、阶段 0-4 验收记录 deploy/acceptance-0-4.md
This commit is contained in:
zerorigin2019 committed 2026-08-05 00:42:45 +08:00
commit 0a1c1e82ea
188 files changed
+19926

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
[permissions]
allow = ["Bash=cd /d/WorkSpaces/Projects/ZerOriginToolBox && timeout 150 go test ./... -timeout 140s 2>&1 | grep -v \"no test files\" && (cd cmd/settings/frontend && npm run build 2>&1 | tail -2) && (cd cmd/settings && go build -o /dev/null ./... && echo SETTINGS_GO_OK) && go build -ldflags \"-H=windowsgui -X zerorigin/internal/version.Version=0.1.0-s7\" -o bin/ZerOriginTool.exe ./cmd/zerorigin && cp bin/ZerOriginTool.exe portable/ && echo MAIN_BUILD_OK", "Bash=cd /d/WorkSpaces/Projects/ZerOriginToolBox && cat >> deploy/acceptance-0-4.md <<'EOF'\n\n## 11. COM 精确音量(2026-08-01)\n\n用户反馈 Quicker 干扰媒体键注入。将音量动作升级为 **IAudioEndpointVolume COM 直调**(公开稳定的 Core Audio API,不走按键注入,不受按键监听软件干扰):\n\n- `volume_up` / `volume_down`:`steps` 语义改为**百分比步进**(1 = ±1%,线性 scalar 读写 + 0~100 clamp);`method: com`(默认)/ `hotkey`(媒体键回退,COM 失败自动回退);\n- `toggle_mute`:GetMute/SetMute COM 直调(同样带 hotkey 回退);\n- 平台层 `volume_com.go`:IMMDeviceEnumerator → GetDefaultAudioEndpoint → Activate(IAudioEndpointVolume),槽位 SetScalar=7/GetScalar=9/SetMute=14/GetMute=15,`withVolumeCOM` 完整生命周期(LockOSThread + MTA);\n- 已验证:本机读取当前音量 56%、读写往返 OK(GUID 与槽位正确性证据);前端 schema 更新(\"步进(百分比)\")。\nEOF\nls -la bin/ZerOriginTool.exe bin/ZerOriginTool_Setup.exe && echo \"=== 冒烟 ===\" && (./bin/ZerOriginTool.exe &) && sleep 2 && tasklist //FO CSV | grep -c '\"ZerOriginTool.exe\"' && taskkill //IM ZerOriginTool.exe //F >/dev/null 2>&1; echo done", "Bash=cd /d/WorkSpaces/Projects/ZerOriginToolBox && cat >> internal/rule/engine_test.go <<'EOF'\n\n// TestFullscreenSuppression 验证全屏抑制:默认规则忽略、allow 规则豁免、退出全屏恢复。\nfunc TestFullscreenSuppression(t *testing.T) {\n\treg := &fakeRegistry{acts: map[string]*fakeAction{\n\t\t\"a\": {id: \"a\"},\n\t\t\"b\": {id: \"b\"},\n\t}}\n\te := newTestEngine(t, reg)\n\n\tfs := true\n\te.SetFullscreenProvider(func() bool { return fs })\n\n\t// 两条同触发器规则:默认(ignore) + allow\n\tcfg := &config.Config{Global: config.GlobalConfig{Enabled: true}, Rules: []config.Rule{\n\t\t*testRule(\"default-rule\", 200, \"hotkey\", map[string]any{\"hotkey\": \"ctrl+alt+d\"}, []config.ActionConfig{{Type: \"a\"}}, 0),\n\t\t*testRule(\"allow-rule\", 100, \"hotkey\", map[string]any{\"hotkey\": \"ctrl+alt+d\"}, []config.ActionConfig{{Type: \"b\"}}, 0),\n\t}}\n\tcfg.Rules[1].Fullscreen = \"allow\"\n\te.SetSnapshot(BuildSnapshot(cfg, reg.newAction))\n\n\tev := trigger.Event{Type: \"hotkey\", Payload: map[string]any{\"hotkey\": \"ctrl+alt+d\"}}\n\n\t// 全屏:默认规则被忽略,allow 规则触发\n\tfs = true\n\te.HandleEvent(ev)\n\ttime.Sleep(50 * time.Millisecond)\n\tif got := reg.acts[\"a\"].Executed(); len(got) != 0 {\n\t\tt.Fatalf(\"default rule executed in fullscreen: %v\", got)\n\t}\n\tif got := reg.acts[\"b\"].Executed(); len(got) != 1 {\n\t\tt.Fatalf(\"allow rule executed = %v, want 1\", got)\n\t}\n\n\t// 退出全屏:默认规则恢复\n\tfs = false\n\te.HandleEvent(ev)\n\ttime.Sleep(50 * time.Millisecond)\n\tif got := reg.acts[\"a\"].Executed(); len(got) != 1 {\n\t\tt.Fatalf(\"default rule executed after fullscreen = %v, want 1\", got)\n\t}\n}\n\n// TestFullscreenProviderNil 验证未注入提供者时不抑制(默认行为兼容)。\nfunc TestFullscreenProviderNil(t *testing.T) {\n\treg := &fakeRegistry{acts: map[string]*fakeAction{\n\t\t\"a\": {id: \"a\"},\n\t}}\n\te := newTestEngine(t, reg) // 不注入 provider\n\tcfg := &config.Config{Global: config.GlobalConfig{Enabled: true}, Rules: []config.Rule{\n\t\t*testRule(\"r\", 100, \"hotkey\", map[string]any{\"hotkey\": \"ctrl+alt+d\"}, []config.ActionConfig{{Type: \"a\"}}, 0),\n\t}}\n\te.SetSnapshot(BuildSnapshot(cfg, reg.newAction))\n\te.HandleEvent(trigger.Event{Type: \"hotkey\", Payload: map[string]any{\"hotkey\": \"ctrl+alt+d\"}})\n\ttime.Sleep(50 * time.Millisecond)\n\tif got := reg.acts[\"a\"].Executed(); len(got) != 1 {\n\t\tt.Fatalf(\"executed = %v, want 1 (no provider = no suppression)\", got)\n\t}\n}\nEOF\ngofmt -w internal/rule/ && go test ./internal/rule/ -run \"TestFullscreen|TestProviderNil\" -v 2>&1 | grep -E \"PASS|FAIL|RUN\" | head -6"]