Lines 1-35javascript
2// SPDX-License-Identifier: MIT
4// umadev — thin JS shim. npm picks the matching `@umacloud/cli-*`
5// platform sub-package (via optionalDependencies + the `os` / `cpu`
6// fields in each sub-package). This shim resolves that sub-package's
7// prebuilt Rust binary and exec's it with the user's argv.
9// The shim is deliberately minimal:
10// - no dependencies (zero install-time cost beyond node itself)
11// - only `update` is intercepted; every other flag goes straight to the binary
12// - stdio is inherited so the ratatui TUI gets a real TTY
16const { spawnSync } = require('node:child_process');
17const fs = require('node:fs');
18const path = require('node:path');
19const https = require('node:https');
20const os = require('node:os');
21const crypto = require('node:crypto');
23// Node platform/arch → our sub-package name.
24const PLATFORM_PACKAGES = {
25 'darwin-arm64': '@umacloud/cli-darwin-arm64',
26 'darwin-x64': '@umacloud/cli-darwin-x64',
27 'linux-x64': '@umacloud/cli-linux-x64',
28 'linux-arm64': '@umacloud/cli-linux-arm64',
29 'win32-x64': '@umacloud/cli-win32-x64',
30 // Windows on ARM runs x64 binaries via built-in emulation; reuse the x64 build.
31 'win32-arm64': '@umacloud/cli-win32-x64',
34function platformKey() {
35 return `${process.platform}-${process.arch}`;
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
bin/cli.jsView on unpkg · L15