Problem
On Windows, many developers use Git Bash (which uses MinTTY for its terminal emulation). MinTTY creates a pseudo-TTY that golang.org/x/term's term.IsTerminal(syscall.Stdin) does not recognise as a TTY, because MinTTY doesn't use the Windows Console API.
Result: a user on Git Bash with no API key runs bare supermodel and gets:
Error: not authenticated — run `supermodel setup` or set SUPERMODEL_API_KEY
instead of the setup wizard — despite being at an interactive terminal.
Affected environments
- Git Bash (MSYS2/MinGW)
- Cygwin terminals
- Any Windows terminal not using the Windows Console API
Windows Terminal and PowerShell are unaffected (they use the Console API and register correctly).
Reproduction
- Install supermodel on Windows
- Open Git Bash with no config
- Run
supermodel
- Expected: setup wizard launches
- Actual: auth error
Possible fix
Check TERM, TERM_PROGRAM, or MSYSTEM env vars as a fallback when term.IsTerminal returns false. Alternatively, check if /dev/tty is openable (POSIX fallback that MinTTY supports):
var stdinIsTerminal = func() bool {
if term.IsTerminal(int(syscall.Stdin)) {
return true
}
// Fallback for MinTTY / Cygwin on Windows
if f, err := os.Open("/dev/tty"); err == nil {
f.Close()
return true
}
return false
}
Problem
On Windows, many developers use Git Bash (which uses MinTTY for its terminal emulation). MinTTY creates a pseudo-TTY that
golang.org/x/term'sterm.IsTerminal(syscall.Stdin)does not recognise as a TTY, because MinTTY doesn't use the Windows Console API.Result: a user on Git Bash with no API key runs bare
supermodeland gets:instead of the setup wizard — despite being at an interactive terminal.
Affected environments
Windows Terminal and PowerShell are unaffected (they use the Console API and register correctly).
Reproduction
supermodelPossible fix
Check
TERM,TERM_PROGRAM, orMSYSTEMenv vars as a fallback whenterm.IsTerminalreturns false. Alternatively, check if/dev/ttyis openable (POSIX fallback that MinTTY supports):