Files
code-utils/main.go
李琦 7c4109f687 feat: 提交详情能看 diff,也能丢给 AI 审这一次改动。文件检查可单独排除路径,TODO 只认大写,避免把 todo 表和模块当成待办标记。
热力图按容器宽度铺满一年,不再横向滚动。托盘右键换成可换皮肤的弹层;更新下载显示进度,退出后再由脚本拉起安装器,避免还占着 exe。
2026-08-19 15:46:03 +08:00

80 lines
2.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"embed"
"log/slog"
"os"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/services/notifications"
)
//go:embed all:frontend/dist
var assets embed.FS
func devtoolsArgs() []string {
if p := os.Getenv("CC_DEVTOOLS_PORT"); p != "" {
return []string{"--remote-debugging-port=" + p}
}
return nil
}
func main() {
app := NewApp()
notifier := notifications.New()
app.notifier = notifier
wapp := application.New(application.Options{
Name: "年糕崽崽项目管理PMS",
Description: "本地代码统计与项目工作台",
Services: []application.Service{
application.NewService(app),
application.NewService(notifier),
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
Middleware: remoteImageMiddleware,
},
LogLevel: slog.LevelError,
Windows: application.WindowsOptions{
// Opt-in DevTools protocol endpoint for automated UI testing; inert unless the env var is set.
AdditionalBrowserArgs: devtoolsArgs(),
// 托盘弹层是第二个窗口;被销毁时不能把整个进程一起带走。
DisableQuitOnLastWindowClosed: true,
},
// 单实例:第二个进程启动时通过 Wails 内置的 WM_COPYDATA / DBus 通道
// 通知首个进程,回调里唤起已存在的主窗口并切到前台。
SingleInstance: &application.SingleInstanceOptions{
UniqueID: "com.niangaozai.view-pms",
OnSecondInstanceLaunch: func(_ application.SecondInstanceData) {
// 回调运行在后台 goroutine需派发到 UI 线程操作窗口。
application.InvokeAsync(func() { app.showMainWindow() })
},
},
})
win := wapp.Window.NewWithOptions(application.WebviewWindowOptions{
Name: "main",
Title: "年糕崽崽项目管理PMS",
Width: 1280,
Height: 820,
MinWidth: 960,
MinHeight: 680,
URL: "/",
BackgroundColour: application.NewRGBA(13, 18, 28, 255),
// 无边框:标题栏由前端 TitleBar 自绘logo + 菜单 + 窗控同一行)。
Frameless: true,
// 发版等场景需拖入本地安装包;仅 data-file-drop-target 区域接受。
EnableFileDrop: true,
Windows: application.WindowsWindow{
DisableMenu: true,
},
})
app.SetupShell(wapp, win)
if err := wapp.Run(); err != nil {
println("Error:", err.Error())
}
}