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 <noreply@anthropic.com>
This commit is contained in:
Chris Wanstrath 2026-03-17 19:17:12 -07:00
parent a9f8a3885d
commit 0abf03e64e

View File

@ -234,4 +234,20 @@ program
await shell() 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 } export { program }