Skip to content

Commit 63c7931

Browse files
avivsinaiclaude
andcommitted
fix: improve installer output and ASCII banner
- Route all output consistently to stderr for clean piping - Replace wide ASCII box with compact, centered 35-char design - Perfect text centering in banner (3 spaces padding each side) - Works properly in narrow terminals 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e2c02a1 commit 63c7931

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

packages/cli/scripts/install.sh

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ check_path() {
286286
if [[ -n "$shell_config" ]]; then
287287
# Check if PATH export already exists (idempotent)
288288
if ! grep -q "# PromptCode CLI PATH" "$shell_config" 2>/dev/null; then
289-
echo "Would you like to add ${INSTALL_DIR} to your PATH automatically? [Y/n]"
289+
echo "Would you like to add ${INSTALL_DIR} to your PATH automatically? [Y/n]" >&2
290290
response=$(safe_read "" "Y")
291291
if [[ ! "$response" =~ ^[Nn]$ ]]; then
292292
if [[ "$SHELL" == */fish ]]; then
@@ -298,17 +298,17 @@ check_path() {
298298
echo "export PATH=\"\$PATH:${INSTALL_DIR}\"" >> "$shell_config"
299299
fi
300300
print_success "PATH updated in $shell_config"
301-
echo "Please restart your shell or run: source $shell_config"
301+
echo "Please restart your shell or run: source $shell_config" >&2
302302
else
303-
echo "Add this to your shell configuration file ($shell_config):"
304-
echo " export PATH=\"\$PATH:${INSTALL_DIR}\""
303+
echo "Add this to your shell configuration file ($shell_config):" >&2
304+
echo " export PATH=\"\$PATH:${INSTALL_DIR}\"" >&2
305305
fi
306306
else
307307
print_info "PATH entry already exists in $shell_config"
308308
fi
309309
else
310-
echo "Add this to your shell configuration file:"
311-
echo " export PATH=\"\$PATH:${INSTALL_DIR}\""
310+
echo "Add this to your shell configuration file:" >&2
311+
echo " export PATH=\"\$PATH:${INSTALL_DIR}\"" >&2
312312
fi
313313
fi
314314
}
@@ -338,13 +338,13 @@ detect_claude_code() {
338338
fi
339339

340340
if [ "$claude_found" = true ]; then
341-
echo ""
341+
echo "" >&2
342342
print_info "🤖 Claude Code Integration Available!"
343-
echo "Run this command to set up the integration:"
344-
echo ""
345-
echo " ${CLI_NAME} cc"
346-
echo ""
347-
echo "This will configure cost approval hooks for AI commands."
343+
echo "Run this command to set up the integration:" >&2
344+
echo "" >&2
345+
echo " ${CLI_NAME} cc" >&2
346+
echo "" >&2
347+
echo "This will configure cost approval hooks for AI commands." >&2
348348
fi
349349
}
350350

@@ -376,16 +376,18 @@ uninstall() {
376376
fi
377377

378378
print_success "Uninstall complete"
379-
echo ""
380-
echo "Don't forget to remove ${INSTALL_DIR} from your PATH if you added it."
379+
echo "" >&2
380+
echo "Don't forget to remove ${INSTALL_DIR} from your PATH if you added it." >&2
381381
}
382382

383383
# Main installation flow
384384
main() {
385-
echo "╔══════════════════════════════════════╗"
386-
echo "║ PromptCode CLI Installer ║"
387-
echo "╚══════════════════════════════════════╝"
388-
echo ""
385+
# Simple, compact banner that works in narrow terminals (35 chars wide)
386+
echo "" >&2
387+
echo " ╭───────────────────────────────╮" >&2
388+
echo " │ PromptCode CLI Installer │" >&2
389+
echo " ╰───────────────────────────────╯" >&2
390+
echo "" >&2
389391

390392
# Handle uninstall
391393
if [ "${1:-}" = "--uninstall" ]; then
@@ -417,9 +419,9 @@ main() {
417419
# For dev versions, inform about --force option
418420
if [[ "$current_version" == *"-dev."* ]]; then
419421
print_info "Development version detected. To force update to $version:"
420-
echo ""
421-
echo " ${CLI_NAME} update --force"
422-
echo ""
422+
echo "" >&2
423+
echo " ${CLI_NAME} update --force" >&2
424+
echo "" >&2
423425
safe_read_char "Run this command now? [Y/n] " "Y"
424426
if [[ $REPLY =~ ^[Yy]$ ]] || [ -z "$REPLY" ]; then
425427
# Try to run update --force, but if it fails (old version), continue with direct install
@@ -436,7 +438,7 @@ main() {
436438
fi
437439
else
438440
print_info "Using built-in update to upgrade..."
439-
echo ""
441+
echo "" >&2
440442
"$CLI_NAME" update 2>&1
441443
exit 0 # Successful update
442444
fi
@@ -474,15 +476,15 @@ main() {
474476
# Detect Claude Code
475477
detect_claude_code
476478

477-
echo ""
479+
echo "" >&2
478480
print_success "Installation complete! 🎉"
479-
echo ""
480-
echo "Get started with:"
481-
echo " ${CLI_NAME} --help"
482-
echo ""
483-
echo "Generate prompts from your code:"
484-
echo " ${CLI_NAME} generate src/**/*.ts"
485-
echo ""
481+
echo "" >&2
482+
echo "Get started with:" >&2
483+
echo " ${CLI_NAME} --help" >&2
484+
echo "" >&2
485+
echo "Generate prompts from your code:" >&2
486+
echo " ${CLI_NAME} generate src/**/*.ts" >&2
487+
echo "" >&2
486488
}
487489

488490
# Handle errors

0 commit comments

Comments
 (0)