From dc267a63efe7925c60db8c4b8d7d83f41384d6e4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zhuk Date: Tue, 23 Jun 2026 20:34:59 +0300 Subject: [PATCH] fix: print clean cli version to fix publish verify step citty routes --version through consola, whose CI reporter prefixes output with [log], so node dist/ranch.mjs --version returned [log] 0.1.10 in CI and the publish stale-dist check failed. Intercept a top-level --version/-v in runMain and print the version with console.log before citty, so the output is clean everywhere. Co-Authored-By: Claude Opus 4.8 (1M context) --- cli/src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli/src/index.ts b/cli/src/index.ts index ec530f1..b9d4b6d 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -79,6 +79,16 @@ export function runMain(): void { return; } + // Print a clean, parseable version and exit before citty handles it. citty + // routes `--version` through consola, whose CI reporter (active when CI=1) + // prefixes output with "[log] " — that breaks scripts doing + // `ranch --version` and the publish-time stale-dist check. + const argv = process.argv.slice(2); + if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) { + console.log(currentVersion()); + process.exit(0); + } + if (!updatesDisabled()) scheduleBackgroundCheck(); if (!updatesDisabled() && !skipNoticeForCommand()) {