From 551de9593685d8e9c2ae967a2253c1f06dc0ef33 Mon Sep 17 00:00:00 2001 From: AYANscyy2 Date: Wed, 30 Sep 2026 22:24:22 +0530 Subject: [PATCH 1/2] fix(sim-setup): stop suggesting re-setup when no install is found --- packages/sim-setup/src/lifecycle.test.ts | 16 +++++++++++ packages/sim-setup/src/lifecycle.ts | 34 +++++++++++++++++++----- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/packages/sim-setup/src/lifecycle.test.ts b/packages/sim-setup/src/lifecycle.test.ts index 46e104a9b3f..d68c9aba8e5 100644 --- a/packages/sim-setup/src/lifecycle.test.ts +++ b/packages/sim-setup/src/lifecycle.test.ts @@ -8,6 +8,7 @@ import { composeServiceQuery, composeServiceState, type Install, + noInstallHint, serviceStatusRows, } from './lifecycle' @@ -131,3 +132,18 @@ describe('status service rows', () => { ]) }) }) + +describe('no-install hint', () => { + it('blames Docker, not the install, when Docker is unreachable', () => { + const lines = noInstallHint({ dockerReachable: false, cwd: '/home/dev' }) + expect(lines.join(' ')).toContain('Docker is not reachable') + expect(lines.join(' ')).not.toContain('npx sim-setup') + }) + + it('points an existing user at the sim/ folder or --dir before suggesting setup', () => { + const lines = noInstallHint({ dockerReachable: true, cwd: '/home/dev' }) + expect(lines[0]).toContain('/home/dev') + expect(lines[1]).toContain('--dir') + expect(lines[2]).toContain('npx sim-setup') + }) +}) diff --git a/packages/sim-setup/src/lifecycle.ts b/packages/sim-setup/src/lifecycle.ts index 53f781edc1f..c9daf1b8d5f 100644 --- a/packages/sim-setup/src/lifecycle.ts +++ b/packages/sim-setup/src/lifecycle.ts @@ -360,6 +360,26 @@ function describeInstall(install: Install): string { return `Kubernetes (context ${install.context}${scope})` } +/** + * What to say when no install was found. "Run npx sim-setup" reads as "install + * again", which is wrong in the two common cases: Docker is down (a Compose + * stack is invisible, not missing), or the stack was taken `down` and the + * command runs outside its directory, where only `--dir` can find it. + */ +export function noInstallHint(options: { dockerReachable: boolean; cwd: string }): string[] { + if (!options.dockerReachable) { + return [ + 'Docker is not reachable, so a Compose install cannot be detected.', + 'Start Docker Desktop (or OrbStack), then re-run this command.', + ] + } + return [ + `No Sim install found from ${options.cwd}.`, + `Already set up? Run this from the folder that contains your sim/ directory, or pass ${theme.command('--dir ')}.`, + `New here? Run ${theme.command('npx sim-setup')}.`, + ] +} + /** One install → use it; several → let the user pick; none → null. */ async function resolveInstall(installs: Install[]): Promise { if (installs.length <= 1) return installs[0] ?? null @@ -656,11 +676,13 @@ async function status(): Promise { console.log(` ${theme.muted('start Docker Desktop (or OrbStack), then re-run this.')}\n`) } if (installs.length === 0) { - console.log( - docker - ? ` ${glyph.warn} No Sim install detected — run ${theme.command('npx sim-setup')}.` - : ` ${glyph.warn} No install detected, but that may just be Docker being down.` - ) + if (!docker) { + console.log(` ${glyph.warn} No install detected, but that may just be Docker being down.`) + return + } + const [first, ...rest] = noInstallHint({ dockerReachable: true, cwd: process.cwd() }) + console.log(` ${glyph.warn} ${first}`) + for (const line of rest) console.log(` ${theme.muted(line)}`) return } for (const install of installs) console.log(` ${glyph.pass} ${describeInstall(install)}`) @@ -696,7 +718,7 @@ export async function runLifecycle(command: LifecycleCommand): Promise { const install = await resolveInstall(installs) if (!install) { - p.log.warn(`No Sim install detected. Run ${theme.command('npx sim-setup')} first.`) + p.log.warn(noInstallHint({ dockerReachable: dockerReachable(), cwd: process.cwd() }).join('\n')) return } switch (command) { From 41bc4c36c9cd31a286e46bcf5bf85f9faa765e28 Mon Sep 17 00:00:00 2001 From: AYANscyy2 Date: Thu, 1 Oct 2026 00:29:46 +0530 Subject: [PATCH 2/2] fix(sim-setup): address review feedback on no-install hint --- packages/sim-setup/src/lifecycle.test.ts | 3 ++- packages/sim-setup/src/lifecycle.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/sim-setup/src/lifecycle.test.ts b/packages/sim-setup/src/lifecycle.test.ts index d68c9aba8e5..7b49f9ae617 100644 --- a/packages/sim-setup/src/lifecycle.test.ts +++ b/packages/sim-setup/src/lifecycle.test.ts @@ -144,6 +144,7 @@ describe('no-install hint', () => { const lines = noInstallHint({ dockerReachable: true, cwd: '/home/dev' }) expect(lines[0]).toContain('/home/dev') expect(lines[1]).toContain('--dir') - expect(lines[2]).toContain('npx sim-setup') + expect(lines[2]).toContain('kubectl') + expect(lines[3]).toContain('npx sim-setup') }) }) diff --git a/packages/sim-setup/src/lifecycle.ts b/packages/sim-setup/src/lifecycle.ts index c9daf1b8d5f..241610b9c3d 100644 --- a/packages/sim-setup/src/lifecycle.ts +++ b/packages/sim-setup/src/lifecycle.ts @@ -370,12 +370,13 @@ export function noInstallHint(options: { dockerReachable: boolean; cwd: string } if (!options.dockerReachable) { return [ 'Docker is not reachable, so a Compose install cannot be detected.', - 'Start Docker Desktop (or OrbStack), then re-run this command.', + 'Start Docker (Docker Desktop or OrbStack, or the docker service on Linux), then re-run this command.', ] } return [ `No Sim install found from ${options.cwd}.`, - `Already set up? Run this from the folder that contains your sim/ directory, or pass ${theme.command('--dir ')}.`, + `Docker Compose install? Run this from the folder that contains your sim/ directory, or pass ${theme.command('--dir ')}.`, + 'Kubernetes install? Check that your current kubectl context is the one Sim was installed in.', `New here? Run ${theme.command('npx sim-setup')}.`, ] }