Description
The CLI binary always calls getLatestVersion() (which fetches from https://registry.npmjs.org/@holistics/cli-core) before checking the local cache. This means the binary cannot run offline, even if @holistics/cli-core is already downloaded and cached at ~/.cache/holistics/.
Problem
In src/downloader.ts:
export async function ensureModule(pkg: string, version?: string) {
if (!version) version = await getLatestVersion(pkg); // ← always hits npm
const modulePath = getModulePath(pkg, version);
// ...
}
Since index.ts calls loadModule('@holistics/cli-core') without a version, getLatestVersion() is always invoked. If the network is unavailable, the binary crashes with ConnectionRefused — even though the package is already cached locally.
Impact
This makes it impossible to use the holistics CLI in network-restricted environments such as:
- Docker containers running with
--network none
- Air-gapped CI/CD environments
- Pre-baked Docker images where
@holistics/cli-core is downloaded at build time but unavailable at runtime
- Production environments where outbound connections to npm registry are not whitelisted
Suggested fix
Two changes to ensureModule in src/downloader.ts:
- Support a
HOLISTICS_CLI_CORE_VERSION env var — if set, skip the npm call entirely and use the specified version from cache
- Offline fallback — if
getLatestVersion() fails (network error), scan the cache directory for any previously downloaded version instead of crashing
This would allow:
# Pin version explicitly (no network call at all)
HOLISTICS_CLI_CORE_VERSION=0.6.13 holistics --version
# Or just work offline if cache exists
holistics --version # falls back to cached version when npm is unreachable
Steps to reproduce
# 1. Run once to populate cache
holistics --version
# 2. Verify cache exists
ls ~/.cache/holistics/@holistics/cli-core@0.6.13/
# 3. Run without network — crashes
docker run --network none <image-with-holistics> holistics --version
# error: Unable to connect. Is the computer able to access the url?
# path: "https://registry.npmjs.org/@holistics/cli-core"
# code: "ConnectionRefused"
Description
The CLI binary always calls
getLatestVersion()(which fetches fromhttps://registry.npmjs.org/@holistics/cli-core) before checking the local cache. This means the binary cannot run offline, even if@holistics/cli-coreis already downloaded and cached at~/.cache/holistics/.Problem
In
src/downloader.ts:Since
index.tscallsloadModule('@holistics/cli-core')without a version,getLatestVersion()is always invoked. If the network is unavailable, the binary crashes withConnectionRefused— even though the package is already cached locally.Impact
This makes it impossible to use the holistics CLI in network-restricted environments such as:
--network none@holistics/cli-coreis downloaded at build time but unavailable at runtimeSuggested fix
Two changes to
ensureModuleinsrc/downloader.ts:HOLISTICS_CLI_CORE_VERSIONenv var — if set, skip the npm call entirely and use the specified version from cachegetLatestVersion()fails (network error), scan the cache directory for any previously downloaded version instead of crashingThis would allow:
Steps to reproduce