feat(cli): fold the command line into reims-go.exe
Only reims-go.exe ships now; reims-go-cli.exe is gone. Without arguments it opens the window, with a command it runs command-line mode (cmd/reims-go moved to internal/cli). Missing standard handles are attached to the parent console; handles the caller passes in (pipes, files) are kept, so scripts and agents get output and exit codes. `vm start` hands the VM to the window process so it gets Guest Tools and the Win10 cold-reboot watcher, which a command that exits could not run: - a running window gets the request through Wails' single-instance protocol and stays hidden; - otherwise the command launches the window tray-only (--background), detached from the caller's console and handles; - the window writes the outcome, with the VM's last log lines on failure, to <DataRoot>\tmp\cli-start-*.json (it accepts no other path) and the command reports it. With --data-root the VM still starts in the command itself. The window now takes a single-instance lock: a second double-click brings the running window forward. `wails dev` builds use their own lock name. Tested on Win10 19045 with macos-tahoe: start from the command line with no window running (4 s, exit 0) and with one running (3 s, exit 0, same process); the cold-reboot monitor was held by the window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69803355bf
commit
2f1e0bb0e4
22 files changed
+774
-87
No files matched your search
@@ -38,9 +38,11 @@ jobs:
|
||||
go test ./...
|
||||
go vet ./...
|
||||
|
||||
- name: Build CLI & GUI binaries
|
||||
- name: Build reims-go.exe (window + command-line mode)
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path build/bin | Out-Null
|
||||
go build -trimpath -o build/bin/reims-go-cli.exe ./cmd/reims-go
|
||||
go build -trimpath -tags desktop,production -ldflags "-H windowsgui" -o build/bin/reims-go.exe .
|
||||
# Command-line mode must still answer through a pipe from the GUI-subsystem build.
|
||||
$out = & build/bin/reims-go.exe version | Out-String
|
||||
if ($LASTEXITCODE -ne 0 -or $out -notmatch '^reims-go ') { throw "reims-go.exe version failed: $out" }
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
shell: pwsh
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.17.1
|
||||
|
||||
- name: Build Windows x64 GUI & CLI binaries
|
||||
- name: Build Windows x64 binary
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -64,11 +64,10 @@ jobs:
|
||||
$dist = 'dist-release'
|
||||
New-Item -ItemType Directory -Force -Path $dist | Out-Null
|
||||
$verPkg = 'github.com/Nwflower/reims-go/internal/version'
|
||||
# One executable: the window without arguments, command-line mode with a command.
|
||||
$guiOut = Join-Path $dist "reims-go-$tag-windows-amd64.exe"
|
||||
$cliOut = Join-Path $dist "reims-go-cli-$tag-windows-amd64.exe"
|
||||
wails build -s -trimpath -ldflags "-s -w -X $verPkg.Version=$tag" -o "reims-go-$tag-windows-amd64.exe"
|
||||
Copy-Item (Join-Path 'build\bin' "reims-go-$tag-windows-amd64.exe") $guiOut
|
||||
go build -trimpath -ldflags "-s -w -X $verPkg.Version=$tag" -o $cliOut ./cmd/reims-go
|
||||
$lines = @(Get-ChildItem -LiteralPath $dist -File | Sort-Object Name | ForEach-Object {
|
||||
$h = (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLowerInvariant()
|
||||
"$h $($_.Name)"
|
||||
|
||||
Reference in new issue
Block a user