* Bundle mosh-client via CI build pipeline Add a GitHub Actions workflow that builds a static, distro-portable mosh-client for linux-x64, linux-arm64, darwin-universal (arm64+x86_64) from upstream mobile-shell/mosh source, plus a pinned win32-x64 binary sourced from FluentTerminal (GPL-3.0). Releases attach SHA256SUMS so scripts/fetch-mosh-binaries.cjs can verify and pull the right binary into resources/mosh/<platform-arch>/ during npm run pack. electron-builder.config.cjs gains a moshExtraResources() helper that adds the binary to extraResources only when present on disk, keeping local dev packages working without bundled mosh. terminalBridge.cjs now exports bundledMoshClient() and prefers the bundled static client over whatever the system mosh wrapper would resolve via PATH (via the MOSH_CLIENT env var). The Windows branch throws a clear error pointing at Settings instead of silently falling back to a literal "mosh.exe" string when no wrapper is installed. This is Phase 1 — Phase 2 (follow-up) replaces the FluentTerminal Windows binary with an in-CI Cygwin static build and adds a Node-side mosh-server bootstrap so Mosh works out-of-the-box on Windows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Phase 2: Node-side Mosh handshake (no Perl wrapper required) Reimplement what the upstream Mosh Perl wrapper does in pure Node: spawn `ssh [user@]host -- mosh-server new`, sniff the byte stream for `MOSH CONNECT <port> <key>`, then spawn `mosh-client` locally with MOSH_KEY in the environment. The new electron/bridges/moshHandshake.cjs module exposes the parser, sniffer, and command builders as pure functions so they can be unit tested without spawning real ssh. terminalBridge.startMoshSession now prefers this path whenever a bare mosh-client (bundled, explicit, or system) and ssh (in-box OpenSSH on Win10 1809+, system everywhere else) are both detectable. The legacy path through the system mosh Perl wrapper is preserved as a fallback so users with custom mosh setups don't regress. Auth is delegated to system ssh, so keys, agent, ssh_config, and known_hosts all keep working. Password / 2FA need a controlling TTY which the bootstrap doesn't provide; affected users keep the legacy wrapper path until interactive UI lands. Tests: - moshHandshake.test.cjs (20 tests) — parser corner cases, command builders, sniffer split-chunk handling, ring-buffer trim, exec resolver - terminalBridge.bareMoshClient.test.cjs (4 tests) — explicit-path basename gating 317 → 341 passing tests; lint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Phase 3: in-CI Cygwin Windows build + visible PTY handshake Phase 3a — in-CI Cygwin Windows build - scripts/build-mosh/build-windows.sh builds mosh-client.exe from upstream mobile-shell/mosh source inside Cygwin, then walks the cygcheck import graph to bundle every required Cygwin DLL (cygwin1.dll, cygcrypto, cygprotobuf, cygncursesw, etc) into a tar.gz alongside the exe. - The `build-mosh-binaries` workflow swaps the FluentTerminal-pinned fetch job for a real Cygwin build (windows-latest + cygwin-install- action). fetch-windows.sh is preserved as an emergency fallback but no longer wired into the matrix. - fetch-mosh-binaries.cjs unpacks the tar.gz into resources/mosh/ win32-x64/ so mosh-client.exe sits next to its DLLs. - mosh-extra-resources.cjs ships the entire win32-x64/ dir (exe + DLL bundle) into Resources/mosh/, so the packaged installer runs on a stock Windows host with no Cygwin install. Phase 3b — visible PTY handshake (password / 2FA prompts) - terminalBridge.startMoshSession now spawns ssh inside node-pty so the user sees and can answer password / 2FA / known-hosts prompts in their terminal. When `MOSH CONNECT` is sniffed from the byte stream, session.proc is atomically swapped from the ssh PTY to a freshly-spawned mosh-client PTY. The MOSH CONNECT line itself is redacted from the visible output. - writeToSession / resizeSession read session.proc lazily, so input arriving after the swap goes to mosh-client without extra wiring. - The ZMODEM sentry is recreated for the new proc since its writeToRemote closure captured the previous handle. - Removes the earlier non-PTY child_process.spawn handshake — the PTY-based one supersedes it. Phase 3c — win32-arm64 deferred - Cygwin's arm64 port has no stable cygwin1.dll release yet, so we do not attempt an arm64 Windows build. arm64 Windows installs fall through to the legacy `mosh` wrapper path that the bridge already handles. Documented in the workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Allow branch/PR pushes to test the mosh-binaries workflow Mirrors the build-packages workflow change in #868: any push or PR that touches the mosh build pipeline triggers the matrix (artifacts only, no release), while only `mosh-bin-*` tag pushes (or an explicit workflow_dispatch with release_tag) publish a release. `paths` filter keeps unrelated commits from running this expensive workflow (~30min for the Cygwin leg). Concurrency group cancels superseded branch/PR builds; tag builds use a unique group so a follow-up commit can't kill an in-progress release. Release job's `if:` enforces the same rule independently — even if the trigger gets re-broadened, branches/PRs can't leak a release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix mosh binary workflow runners * Fix Windows mosh workflow invocation * Keep shell scripts LF in workflow checkouts * Trigger mosh workflow on attributes changes * Fix mosh build tool dependencies * Fix Linux mosh static build * Fix macOS mosh build tool lookup * Skip macOS ncurses terminfo install * Fix mosh PR review findings * Allow Linux system mosh dependencies * Fix Windows mosh DLL bundling * Limit bundled Windows mosh DLLs * Honor configured PATH for mosh handshake --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
149 lines
5.1 KiB
JavaScript
149 lines
5.1 KiB
JavaScript
const { moshExtraResources } = require('./scripts/mosh-extra-resources.cjs');
|
|
|
|
/**
|
|
* @type {import('electron-builder').Configuration}
|
|
*/
|
|
module.exports = {
|
|
appId: 'com.netcatty.app',
|
|
productName: 'Netcatty',
|
|
artifactName: '${productName}-${version}-${os}-${arch}.${ext}',
|
|
// Platform-split icons (#813):
|
|
// - public/icon.png keeps Apple's HIG grid margin so the rendered
|
|
// squircle sits at ~88% of the PNG canvas. macOS needs this —
|
|
// the dock renders icons with its own rounding/shadow and most
|
|
// third-party apps (#803) leave that grid margin alone so the
|
|
// squircle lines up with neighbors.
|
|
// - public/icon-win.png uses a tight-crop viewBox so the squircle
|
|
// fills 100% of the PNG. Windows / Linux taskbars render icons
|
|
// full-bleed, so the Apple margin showed up as visible padding,
|
|
// making the app icon look smaller than other apps in taskbar /
|
|
// Start menu / desktop shortcuts.
|
|
icon: 'public/icon.png',
|
|
// npmRebuild must stay enabled for macOS and Windows builds — without it,
|
|
// node-pty's native module is not recompiled for the Electron ABI, causing
|
|
// "posix_spawnp failed" on macOS. Linux builds set npm_config_arch in CI
|
|
// and run ensure-node-pty-linux.sh before packaging, so the rebuild is
|
|
// redundant but harmless there.
|
|
npmRebuild: true,
|
|
directories: {
|
|
buildResources: 'build',
|
|
output: 'release'
|
|
},
|
|
files: [
|
|
'dist/**/*',
|
|
'electron/**/*',
|
|
'lib/**/*.cjs',
|
|
'!electron/.dev-config.json',
|
|
'skills/**/*',
|
|
'public/**/*',
|
|
'node_modules/**/*'
|
|
],
|
|
asarUnpack: [
|
|
'node_modules/node-pty/**/*',
|
|
'node_modules/ssh2/**/*',
|
|
'node_modules/cpu-features/**/*',
|
|
'node_modules/@vscode/windows-process-tree/**/*',
|
|
'node_modules/@zed-industries/claude-agent-acp/**/*',
|
|
'node_modules/@agentclientprotocol/sdk/**/*',
|
|
'node_modules/@anthropic-ai/claude-agent-sdk/**/*',
|
|
'node_modules/@zed-industries/codex-acp/**/*',
|
|
'node_modules/@zed-industries/codex-acp-*/**/*',
|
|
'node_modules/@modelcontextprotocol/sdk/**/*',
|
|
'node_modules/zod/**/*',
|
|
'node_modules/zod-to-json-schema/**/*',
|
|
'node_modules/ajv/**/*',
|
|
'node_modules/ajv-formats/**/*',
|
|
'node_modules/fast-deep-equal/**/*',
|
|
'node_modules/fast-uri/**/*',
|
|
'node_modules/json-schema-traverse/**/*',
|
|
'electron/cli/**/*',
|
|
'electron/mcp/**/*'
|
|
,
|
|
'skills/**/*'
|
|
],
|
|
mac: {
|
|
target: [
|
|
{
|
|
target: 'dmg',
|
|
arch: ['arm64', 'x64']
|
|
},
|
|
{
|
|
target: 'zip',
|
|
arch: ['arm64', 'x64']
|
|
}
|
|
],
|
|
category: 'public.app-category.developer-tools',
|
|
hardenedRuntime: true,
|
|
notarize: true,
|
|
entitlements: 'electron/entitlements.mac.plist',
|
|
entitlementsInherit: 'electron/entitlements.mac.plist',
|
|
extendInfo: {
|
|
NSCameraUsageDescription: 'Netcatty may use the camera for video calls',
|
|
NSMicrophoneUsageDescription: 'Netcatty may use the microphone for audio',
|
|
NSLocalNetworkUsageDescription: 'Netcatty needs local network access for SSH connections'
|
|
},
|
|
extraResources: moshExtraResources('darwin')
|
|
},
|
|
dmg: {
|
|
title: '${productName}',
|
|
iconSize: 100,
|
|
iconTextSize: 12,
|
|
window: {
|
|
width: 540,
|
|
height: 380
|
|
},
|
|
contents: [
|
|
{ x: 140, y: 158 },
|
|
{ x: 400, y: 158, type: 'link', path: '/Applications' }
|
|
]
|
|
},
|
|
win: {
|
|
icon: 'public/icon-win.png',
|
|
target: [
|
|
{
|
|
target: 'nsis',
|
|
arch: ['x64', 'arm64']
|
|
},
|
|
{
|
|
target: 'portable',
|
|
arch: ['x64', 'arm64']
|
|
}
|
|
],
|
|
extraResources: moshExtraResources('win32')
|
|
},
|
|
portable: {
|
|
artifactName: '${productName}-${version}-portable-${os}-${arch}.${ext}',
|
|
},
|
|
nsis: {
|
|
oneClick: false,
|
|
perMachine: false,
|
|
allowElevation: true,
|
|
allowToChangeInstallationDirectory: true,
|
|
createDesktopShortcut: true,
|
|
createStartMenuShortcut: true,
|
|
shortcutName: 'Netcatty'
|
|
},
|
|
linux: {
|
|
// Linux desktop icons render full-bleed like Windows — use the
|
|
// tight-crop source so the app icon doesn't look padded in KDE /
|
|
// GNOME launchers or AppImage integrations.
|
|
icon: 'public/icon-win.png',
|
|
target: ['AppImage', 'deb', 'rpm'],
|
|
category: 'Development',
|
|
extraResources: moshExtraResources('linux')
|
|
},
|
|
deb: {
|
|
// Use gzip instead of default xz(lzma) for better compatibility with
|
|
// Deepin OS and other distros that have issues with lzma decompression
|
|
compression: 'gz'
|
|
},
|
|
publish: [
|
|
{
|
|
provider: 'github',
|
|
owner: 'binaricat',
|
|
repo: 'Netcatty',
|
|
releaseType: 'release'
|
|
}
|
|
]
|
|
};
|