diff --git a/.gitignore b/.gitignore index 68dd295..d0cbe45 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ !.gitignore !.gitattributes !.github/ -!.gitea/ !.dockerignore !.golangci.yml !.air.toml @@ -23,22 +22,22 @@ *.swo # 构建和依赖文件 +# 注意:目录规则锚定仓库根(/dist/),避免误伤源码目录(如 frontend/src/views/artifacts/) node_modules/ -dist/ -build/ +/dist/ +frontend/dist/ +/build/ *.log # 临时文件 -tmp/ -temp/ -logs/ +/tmp/ +/temp/ +/logs/ *.pid -# 本机构建产物(不入库;仅限仓库根目录,勿误伤 frontend/src/views/artifacts/ 等源码目录) +# 本机构建产物(不入库) /artifacts/ Academy -Academy -Academy-lite Academy-lite cmd/desktop/build/bin/ /models/ @@ -57,7 +56,6 @@ web/ frontend/.vite frontend/chrome-extension/ Academy-Chrome-Extension -Academy-Chrome-Extension packages/protoc-3.19.4-linux-x86_64.zip Claude.md @@ -71,7 +69,6 @@ miniprogram/project.private.config.json # Staging dir for the Docker sandbox self-check probe (removed after each run) .academy-sandbox-check-* -.academy-sandbox-check-* # Locally built BrowserSkill runtime and extension bundles /artifacts/browserskill/ diff --git a/cli/internal/build/build.go b/cli/internal/build/build.go new file mode 100644 index 0000000..6af7778 --- /dev/null +++ b/cli/internal/build/build.go @@ -0,0 +1,16 @@ +// Package build holds compile-time-injected build metadata. +// +// Values are set via -ldflags="-X github.com/Tencent/WeKnora/cli/internal/build.Version=..." at link time; +// the Makefile's `version` target wires them up. +package build + +var ( + Version = "dev" + Commit = "none" + Date = "unknown" +) + +// Info returns a snapshot of the build metadata. +func Info() (version, commit, date string) { + return Version, Commit, Date +} diff --git a/cli/internal/build/build_test.go b/cli/internal/build/build_test.go new file mode 100644 index 0000000..017760d --- /dev/null +++ b/cli/internal/build/build_test.go @@ -0,0 +1,25 @@ +package build + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestInfo_DefaultDevValues(t *testing.T) { + v, c, d := Info() + // In a non-ldflags-injected build, these are the package defaults; tests + // that vary them need to assign at run time, not via -ldflags (testing + // here only that Info returns whatever is current). + assert.NotEmpty(t, v) + assert.NotEmpty(t, c) + assert.NotEmpty(t, d) +} + +func TestInfo_ReflectsInjectedValues(t *testing.T) { + old := Version + t.Cleanup(func() { Version = old }) + Version = "v0.0.0-test" + v, _, _ := Info() + assert.Equal(t, "v0.0.0-test", v) +} diff --git a/cmd/desktop/build/appicon.png b/cmd/desktop/build/appicon.png new file mode 100644 index 0000000..63617fe Binary files /dev/null and b/cmd/desktop/build/appicon.png differ diff --git a/cmd/desktop/build/darwin/Info.plist b/cmd/desktop/build/darwin/Info.plist new file mode 100644 index 0000000..d17a747 --- /dev/null +++ b/cmd/desktop/build/darwin/Info.plist @@ -0,0 +1,63 @@ + + + + CFBundlePackageType + APPL + CFBundleName + {{.Info.ProductName}} + CFBundleExecutable + {{.OutputFilename}} + CFBundleIdentifier + com.wails.{{.Name}} + CFBundleVersion + {{.Info.ProductVersion}} + CFBundleGetInfoString + {{.Info.Comments}} + CFBundleShortVersionString + {{.Info.ProductVersion}} + CFBundleIconFile + iconfile + LSMinimumSystemVersion + 10.13.0 + NSHighResolutionCapable + true + NSHumanReadableCopyright + {{.Info.Copyright}} + {{if .Info.FileAssociations}} + CFBundleDocumentTypes + + {{range .Info.FileAssociations}} + + CFBundleTypeExtensions + + {{.Ext}} + + CFBundleTypeName + {{.Name}} + CFBundleTypeRole + {{.Role}} + CFBundleTypeIconFile + {{.IconName}} + + {{end}} + + {{end}} + {{if .Info.Protocols}} + CFBundleURLTypes + + {{range .Info.Protocols}} + + CFBundleURLName + com.wails.{{.Scheme}} + CFBundleURLSchemes + + {{.Scheme}} + + CFBundleTypeRole + {{.Role}} + + {{end}} + + {{end}} + + diff --git a/cmd/desktop/build/windows/installer/project.nsi b/cmd/desktop/build/windows/installer/project.nsi new file mode 100644 index 0000000..9bf5eba --- /dev/null +++ b/cmd/desktop/build/windows/installer/project.nsi @@ -0,0 +1,123 @@ +; Based on the Wails v2.12.0 default installer (MIT). +; See licenses/Wails-MIT.txt. Local change: install the notice/source bundle. +Unicode true + +#### +## Please note: Template replacements don't work in this file. They are provided with default defines like +## mentioned underneath. +## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo. +## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually +## from outside of Wails for debugging and development of the installer. +## +## For development first make a wails nsis build to populate the "wails_tools.nsh": +## > wails build --target windows/amd64 --nsis +## Then you can call makensis on this file with specifying the path to your binary: +## For a AMD64 only installer: +## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe +## For a ARM64 only installer: +## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe +## For a installer with both architectures: +## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe +#### +## The following information is taken from the ProjectInfo file, but they can be overwritten here. +#### +## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}" +## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}" +## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}" +## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}" +## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}" +### +## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe" +## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}" +#### +## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html +#### +## Include the wails tools +#### +!include "wails_tools.nsh" + +# The version information for this two must consist of 4 parts +VIProductVersion "${INFO_PRODUCTVERSION}.0" +VIFileVersion "${INFO_PRODUCTVERSION}.0" + +VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}" +VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer" +VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}" +VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}" +VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}" +VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}" + +# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware +ManifestDPIAware true + +!include "MUI.nsh" + +!define MUI_ICON "..\icon.ico" +!define MUI_UNICON "..\icon.ico" +# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314 +!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps +!define MUI_ABORTWARNING # This will warn the user if they exit from the installer. + +!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page. +# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer +!insertmacro MUI_PAGE_DIRECTORY # In which folder install page. +!insertmacro MUI_PAGE_INSTFILES # Installing page. +!insertmacro MUI_PAGE_FINISH # Finished installation page. + +!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page + +!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer + +## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1 +#!uninstfinalize 'signtool --file "%1"' +#!finalize 'signtool --file "%1"' + +Name "${INFO_PRODUCTNAME}" +OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file. +InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder). +ShowInstDetails show # This will always show the installation details. + +Function .onInit + !insertmacro wails.checkArchitecture +FunctionEnd + +Section + !insertmacro wails.setShellContext + + !insertmacro wails.webview2runtime + + SetOutPath $INSTDIR + + !insertmacro wails.files + + ; Paths are relative to cmd/desktop/build/windows/installer. + File "..\..\..\..\..\LICENSE" + File "..\..\..\..\..\THIRD_PARTY_NOTICES.md" + SetOutPath "$INSTDIR\licenses" + File /r "..\..\..\..\..\licenses\*" + SetOutPath $INSTDIR + + CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" + CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" + + !insertmacro wails.associateFiles + !insertmacro wails.associateCustomProtocols + + !insertmacro wails.writeUninstaller +SectionEnd + +Section "uninstall" + !insertmacro wails.setShellContext + + RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath + + RMDir /r $INSTDIR + + Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" + Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk" + + !insertmacro wails.unassociateFiles + !insertmacro wails.unassociateCustomProtocols + + !insertmacro wails.deleteUninstaller +SectionEnd diff --git a/frontend/src/views/artifacts/ArtifactLibrary.vue b/frontend/src/views/artifacts/ArtifactLibrary.vue new file mode 100644 index 0000000..4eddfc9 --- /dev/null +++ b/frontend/src/views/artifacts/ArtifactLibrary.vue @@ -0,0 +1,786 @@ + + + + + + +