Running AppleScript via shell(bash/zsh) expands window to height of desktop. How can I make it fit?

New Contributor II

This is not a problem with Jamf per se, but I was wondering if someone else has experienced this problem that is quite annoying to me. I have a shell script in which I use osascript to display a prompt to the user for selection from a list. The problem here is, when the script is executed via shell, the osascript window size is extended to the size of the screen height, filling the list selection with empty space. When I run the same osascript code from the script editor, the selection fits to the window size. Is there a way to make the window fit the list items (like in the second picture listed below)?

Here's the sample script:

set magtitles to {"A", "B", "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "y", "Z"}
choose from list magtitles

Here's how it looks like when executed via shell:

And here's how it looks like when executed via Script Editor:

I have tested it on Big Sur 11.1 and Big Sur 11.2 beta, both with same results. Does anyone have a clue on how to address this?