fix(bundle): ship the CLI, which the installer had been leaving behind

The first bundle ever built for this project contained exactly one binary. NSIS payload:
`pipdock-app.exe`. MSI `app.cab`: one file. **`pipdock.exe` was not installed at all** — while
PRD P0-12 is "CLI core parity", CLI-SPEC documents the entire surface, `golden.rs` pins 58
snapshots of its output, and the README's own Quick start opens with `pipdock env list`. A
user who installed PipDock had none of it.

Found by listing the installer. `tauri.conf.json` declared no `externalBin` and no
`resources`, so there was nothing to notice in a diff — the config was correct for a
GUI-only app, and nobody had built one to see what came out.

`scripts/bundle-cli.mjs` builds the CLI and stages it as a sidecar under the host triple,
which Tauri strips at bundle time, so it installs as plain `pipdock.exe` beside the GUI. The
triple is asked of `rustc -vV` rather than assumed, since a guess breaks the moment anyone
cross-compiles.

It runs from `beforeBuildCommand`, not only from the release workflow. A locally built
installer and a released one have to be the same artifact; a bundle that differs by who
built it is how "works on my machine" reaches a release. This build proves the clean-checkout
case too — `src-tauri/binaries/` is gitignored and did not exist when the build started.

**`PATH` is deliberately left alone** (owner decision, 2026-08-13). PipDock does not modify
the user's environment, which is the restraint SECURITY §5 already applies to not shipping a
self-updater; the README says where the binary lands and gives the one-liner to add it if
that is what you want.

Verified by rebuilding and listing both installers: NSIS 5.7 → 8.8 MB carrying
`pipdock-app.exe` and `pipdock.exe`; MSI 7.6 → 11.6 MB carrying `Path` and `Bin_pipdock.exe`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5 committed 2026-08-13 20:59:43 +07:00
1 parent 1aee0bea6b
commit debc05edee
6 files changed
+63 -4

No files matched your search

+4 -2
View File
@@ -59,8 +59,10 @@ jobs:
- name: Install frontend dependencies
run: npm ci
# No separate frontend step: `tauri build` runs `beforeBuildCommand`, which is
# `npm run build`. Having both meant vite ran twice per release for no benefit.
# No separate frontend or CLI step: `tauri build` runs `beforeBuildCommand`, which is
# `npm run build && npm run bundle:cli`. Keeping them there rather than here is what makes a
# locally built installer identical to a released one — a bundle that differs by who built
# it is how "works on my machine" reaches a release.
- name: Build and bundle
# `--locked` is **cargo's** flag, not `tauri build`'s: everything after `--` is passed
# to the runner. Written the other way round it fails with "unexpected argument
+3
View File
@@ -55,3 +55,6 @@ tauri-signing-private.key*
# Spike tooling venvs (SP-1 needs several uv versions side by side)
/spikes/.venv*/
# Staged by scripts/bundle-cli.mjs so the installer ships the CLI; rebuilt every bundle.
src-tauri/binaries/
+8 -1
View File
@@ -59,7 +59,14 @@ PipDock does not update itself — grab a new build from the same page when you
**GUI:** launch PipDock → accept the first-run legal gate → pick an environment (auto-discovered or *Browse…*) → the *Updates* tab shows what's outdated → *Select all* → *Update* → review the preview → *Confirm*. Four clicks.
**CLI:**
**CLI:** the installer puts `pipdock.exe` next to the GUI — `%LOCALAPPDATA%\Programs\PipDock\`
for a per-user install, `C:\Program Files\PipDock\` for a machine-wide one. **PipDock does not
edit your `PATH`**; add that folder yourself if you want to type `pipdock` from anywhere:
```powershell
$dir = "$env:LOCALAPPDATA\Programs\PipDock"
[Environment]::SetEnvironmentVariable('Path', "$([Environment]::GetEnvironmentVariable('Path','User'));$dir", 'User')
```
```text
pipdock env list
+1
View File
@@ -16,6 +16,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"bundle:cli": "node scripts/bundle-cli.mjs",
"preview": "vite preview",
"lint": "eslint .",
"typecheck": "tsc --noEmit",
+45
View File
@@ -0,0 +1,45 @@
/**
* Build `pipdock.exe` and stage it as a Tauri sidecar, so the installer ships the CLI.
*
* **Why this exists.** The first bundle built for Phase 4 contained exactly one binary,
* `pipdock-app.exe`. PRD P0-12 is "CLI core parity", CLI-SPEC documents the whole surface, and the
* README's Quick start tells the user to run `pipdock env list` — none of which was on the machine
* after a real install. Found by listing the installer, not by reading the config.
*
* Tauri's `externalBin` wants the host target triple in the filename and strips it when bundling,
* so the installed name is plain `pipdock.exe`, next to the GUI. **`PATH` is deliberately not
* touched** (owner decision, 2026-08-13): PipDock does not modify the user's environment, which is
* the same restraint SECURITY §5 applies to not shipping a self-updater. The README says where the
* binary lands and how to put it on `PATH` if you want it there.
*
* Run from `beforeBuildCommand` rather than only from the release workflow, so a local
* `tauri build` and CI produce the same installer — a bundle that differs by who built it is how
* "works on my machine" gets into a release.
*/
import { execFileSync } from 'node:child_process'
import { copyFileSync, mkdirSync } from 'node:fs'
import { join } from 'node:path'
/** The host triple, asked of rustc rather than assumed — cross-compiling would break a guess. */
function hostTriple() {
const out = execFileSync('rustc', ['-vV'], { encoding: 'utf8' })
const line = out.split('\n').find((l) => l.startsWith('host:'))
if (line === undefined) throw new Error('rustc -vV printed no host line')
return line.slice('host:'.length).trim()
}
const triple = hostTriple()
const target = join('src-tauri', 'binaries')
mkdirSync(target, { recursive: true })
// `--locked` for the reason the release workflow passes it: a bundle is not the place to discover
// that a dependency resolved differently than the lockfile says.
execFileSync('cargo', ['build', '--release', '--locked', '-p', 'pipdock-cli'], {
stdio: 'inherit',
})
const from = join('target', 'release', 'pipdock.exe')
const to = join(target, `pipdock-${triple}.exe`)
copyFileSync(from, to)
console.log(`staged ${from} -> ${to}`)
+2 -1
View File
@@ -5,7 +5,7 @@
"identifier": "com.skullmute.pipdock",
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"beforeBuildCommand": "npm run build && npm run bundle:cli",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
@@ -28,6 +28,7 @@
"bundle": {
"active": true,
"targets": ["nsis", "msi"],
"externalBin": ["binaries/pipdock"],
"icon": ["icons/icon.ico"],
"copyright": "Copyright (C) 2026 Kokone (poli0981). Licensed under GPL-3.0-only.",
"category": "DeveloperTool",