Repository navigation
feat(packaging): ship command-line programs beside desktop apps - #2203
Conversation
80d8569 to
db2dd1e
Compare
|
Reviewed. The
On a local rebase onto main, the full It can't be merged yet. The branch still carries #2199's original commit (2421f91), and main already has that change as 8556e95, so GitHub reports the PR as conflicting. |
db2dd1e to
a38483a
Compare
|
Thanks for the review. Rebased onto main; the rebase dropped the #2199 commit, so the PR is now the single commands commit. go vet (host and GOOS=windows) and the command, NSIS, Homebrew and signing tests pass. |
|
The failing |
An app that ships a command-line program next to its GUI, such as a CLI working on the same data, could only add it as a resource: unsigned in a macOS app's Resources, where notarization refuses it, and on no PATH. nsgo.yaml's commands lists such programs, each a Go main package nsgo builds for the target, with the app's linker flags, its identity in core.App and its own ldflags. macOS apps hold them in Contents/MacOS, signed before the bundle as <id>.<name>, ad hoc or with sign.identity, the hardened runtime and a timestamp; universal apps join them as they join the app. Windows and Linux packages hold them beside the executable and Windows signs them as it signs the app. The Debian and Arch packages own a /usr/bin link to each, Homebrew's cask links each with a binary stanza, and windows.path has the NSIS installer put the app's folder on the user's Path, with the ownership windows.command_line has. The installer leaves out its own setup program by name rather than every *-setup.exe, which a command may be. nsgo dev watches the commands' packages. Store packages leave them out.
|
Rebased onto main after #2200 merged. The conflicts were in the Linux package comment, docs/architecture/tool.md and the shipping skill reference; each now keeps both the linux.share text from #2200 and the commands text. go vet (host and GOOS=windows), the command, NSIS, Homebrew, signing, Linux, AppImage and Flatpak tests, and the changelog check pass. |
a38483a to
dd35924
Compare
|
Reviewed. The rebase after #2200 keeps both the |
Why
Builds on #2199, whose Path ownership
windows.pathreuses; review that first. This branch is stacked on it and will be rebased once it merges. Until then this PR also shows #2199's commit; only the last commit (feat(cli): ship command-line programs beside desktop apps) is new here.Some desktop apps ship a command-line program next to the GUI, for example a CLI that works on the same data. Today
nsgo buildcan add one only as a resource:Contents/Resources, so notarization rejects the app.PATH.There is no supported way to ship a signed helper executable and make it callable from a terminal.
What changed
A new top-level
commandslist innsgo.yaml. Each entry is a name and a Go main package, whichnsgo buildbuilds for each desktop target with:CGO_ENABLED=0andbuild.tags;build.ldflags, then an optional per-commandldflags;core.App()reports the app's version.Per platform:
Contents/MacOS/<command>, signed before the bundle with identifier<id>.<command>, using the app's ad hoc orsign.identitysignature with the hardened runtime and a timestamp when notarizing. It carries none of the app's entitlements.macos_universaljoins the two architectures as it does for the app. The Homebrew cask gets abinarystanza per command./opt/<slug>. The.deband Arch packages own a/usr/bin/<command>link, which is removed with the package. The AppImage carries the command but changes nothing onPATH.<command>.exebeside the app, signed like the app's executable.windows.path: truemakes the installer put the install folder on the user'sPath, following fix(packaging): remove only the Path folder the Windows installer added #2199's ownership rules, so consoles find the commands.windows.path, the commands are still installed but not onPATH.windows.command_linealready puts the folder onPath, but it also adds the.comconsole wrapper for the GUI executable;windows.pathexposes the commands without that wrapper.mainfails the build.nsgo devwatches the commands' packages, so editing a command rebuilds the app.Scope
nsgotool (build, signing, Linux packages, NSIS installer, Homebrew cask) for macOS, Linux and Windows.Tradeoffs
commandsorwindows.path, with one exception: the NSIS script used to exclude every*-setup.exefrom the package. It now excludes only its own installer file, so a program named likehelper-setup.exeis installed. Package directories are recreated on each build, so no stale installer can be picked up.Blast Radius
Only apps that set
commandsorwindows.pathget new files, signatures, links or Path entries. For every Windows installer, the NSIS file exclusion now names the generated setup file exactly instead of*-setup.exe. Store packages and other targets are unaffected.Verification
go tool nsgo check, including-target macos,windows,linux;TestSkills;./cmd/nsgo.cmd/nsgo/commands_test.gocover:windows.path;binarylines.codesign --verify --deep --strict, ad hoc and with a Developer ID, hardened runtime and timestamp.Checklist: the title is a Conventional Commit; the docs whose facts change are updated; the change has a
changelog.d/fragment; no new third-party code, assets or dependencies.