From 0abf03e64ee2b4ec3fadb267abefcae45272b8ab Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 17 Mar 2026 19:17:12 -0700 Subject: [PATCH 1/2] 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 } From 35a90533086c878200e2ed288d743620f5ae3825 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 17 Mar 2026 19:18:26 -0700 Subject: [PATCH 2/2] Reduce nesting in SSH-disabled command setup with early continue --- src/cli/setup.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cli/setup.ts b/src/cli/setup.ts index af03ca4..a7e5f60 100644 --- a/src/cli/setup.ts +++ b/src/cli/setup.ts @@ -239,14 +239,13 @@ 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) - }) - } + if (!cmd) continue + cmd.helpInformation = () => '' + ;(cmd as any)._hidden = true + cmd.action(() => { + console.error(`"${name}" is not available over SSH`) + process.exit(1) + }) } }