From 0abf03e64ee2b4ec3fadb267abefcae45272b8ab Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 17 Mar 2026 19:17:12 -0700 Subject: [PATCH] Disable shell, get, and open commands for SSH sessions These commands require local access and cannot function when connected over SSH (USER=cli). Co-Authored-By: Claude Opus 4.6 --- src/cli/setup.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/cli/setup.ts b/src/cli/setup.ts index b6c3bbc..af03ca4 100644 --- a/src/cli/setup.ts +++ b/src/cli/setup.ts @@ -234,4 +234,20 @@ program await shell() }) +// Hide and disable commands that don't work over SSH +if (process.env.USER === 'cli') { + const disabled = ['shell', 'get', 'open'] + for (const name of disabled) { + const cmd = program.commands.find((c) => c.name() === name) + if (cmd) { + cmd.helpInformation = () => '' + ;(cmd as any)._hidden = true + cmd.action(() => { + console.error(`"${name}" is not available over SSH`) + process.exit(1) + }) + } + } +} + export { program }