fix(cli): sh1pt remove silently uninstalls nothing on non-TTY stdin - #999
Merged
ralyodio merged 1 commit intoAug 30, 2026
Merged
Conversation
removeCmd asks "also delete ~/.config/sh1pt/?" via prompts() before calling run(argv), the line that actually shells out to the package manager to uninstall sh1pt. prompts() reads keystrokes from stdin; when stdin is not a TTY (CI, `< /dev/null`, a piped uninstall script) it never receives input that resolves or cancels the prompt. Once nothing else keeps the event loop alive, Node exits on its own, abandoning the still-pending `await prompts(...)` before run(argv) further down ever executes — so `sh1pt remove` used to exit 0 having uninstalled nothing at all in a non-interactive shell. Skip the prompt when there's no TTY and keep its existing safe default (`initial: false`, i.e. behave like --keep-config) instead of hanging in front of the actual uninstall, so the primary "remove sh1pt" effect still happens. --keep-config already bypasses the question the same way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
sh1pt remove(aliasuninstall) asks "Also delete ~/.config/sh1pt/ ...?" viaprompts()before callingrun(argv)— the line that actually shells out tonpm/pnpm/etc. to uninstall the package. On non-TTY stdin (CI,< /dev/null, a piped uninstall script)prompts()never resolves for the same reason described in #992: it never receives input that would resolve or cancel it, and once nothing else is keeping the event loop alive Node exits on its own — abandoning the pending prompt beforerun(argv)ever runs.Net effect:
sh1pt removein a non-interactive shell exits0having uninstalled nothing at all, silently.Fix
Skip the prompt when there's no TTY and keep its existing safe default (
initial: false, same as passing--keep-config) instead of hanging in front of the actual uninstall — so the primary effect of the command (actually uninstalling) still happens, and the config directory is conservatively kept rather than guessed at.Tests
Added
packages/cli/src/commands/self.test.ts(4 tests, mockingprompts,../installer.js,../run-command.js,node:fs,@profullstack/sh1pt-core, andprocess.exit— no real package-manager command or filesystem delete is ever executed):run(argv)still executes,promptsnever called~/.config/sh1pt/is kept (not deleted) by default--keep-config→ skips the prompt entirely regardless of TTYpnpm test→ 716/716 test files, 3619/3620 tests passing (1 pre-existing unrelated skip).pnpm --filter @profullstack/sh1pt typecheckpasses clean.Related: #992 (same root cause, different command —
sh1pt init).