@@ -97,9 +97,7 @@ __launchpad_switch_environment() {
97
97
fi
98
98
export __LAUNCHPAD_LAST_VERBOSE_KEY="$__lp_verbose_key"
99
99
100
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
101
- printf "⏱️ [0ms] Shell integration started for PWD=%s\\n" "$PWD" >&2
102
- fi
100
+ # Removed verbose shell integration start message
103
101
104
102
# Known dependency filenames (keep in sync with DEPENDENCY_FILE_NAMES in src/env.ts)
105
103
local _dep_names=(
@@ -150,14 +148,7 @@ __launchpad_switch_environment() {
150
148
done
151
149
fi
152
150
153
- # Verbose: show project detection result
154
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
155
- if [[ -n "$project_dir" ]]; then
156
- printf "📁 Project detected: %s\n" "$project_dir" >&2
157
- else
158
- printf "📁 No project detected (global mode)\n" >&2
159
- fi
160
- fi
151
+ # Removed verbose project detection message
161
152
162
153
# Step 2: Always ensure global paths are available (even in projects)
163
154
# Use ~/.local/bin first, then launchpad global bin to ensure proper path priority
@@ -178,9 +169,7 @@ __launchpad_switch_environment() {
178
169
local ready_cache_marker="$HOME/.cache/launchpad/global_ready"
179
170
local ready_global_marker="$HOME/.local/share/launchpad/global/.ready"
180
171
if [[ -f "$ready_cache_marker" || -f "$ready_global_marker" ]]; then
181
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
182
- printf "♻️ Reusing existing global tools (ready marker found)\n" >&2
183
- fi
172
+ # Removed verbose reuse message
184
173
# No-op: presence of the marker simply informs reuse; installs remain on-demand per env needs
185
174
186
175
# TTL-based background update check to keep globals fresh without blocking the prompt
@@ -260,10 +249,7 @@ __launchpad_switch_environment() {
260
249
fi
261
250
fi
262
251
263
- # Show refresh message if verbose
264
- if [[ "$verbose_mode" == "true" ]]; then
265
- printf "🔄 Shell environment refreshed for newly installed tools\n" >&2
266
- fi
252
+ # Removed verbose refresh message
267
253
fi
268
254
269
255
# Step 2.2: If a global update notice is present, display it once and remove
@@ -324,9 +310,7 @@ __launchpad_switch_environment() {
324
310
fi
325
311
fi
326
312
327
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
328
- printf "🔎 dep_file=%q dep_short=%s env_dir=%q\n" "$dep_file" "$dep_short" "$env_dir" >&2
329
- fi
313
+ # Removed verbose dependency file info message
330
314
331
315
# Check if we're switching projects
332
316
if [[ -n "$LAUNCHPAD_CURRENT_PROJECT" && "$LAUNCHPAD_CURRENT_PROJECT" != "$project_dir" ]]; then
@@ -350,15 +334,12 @@ __launchpad_switch_environment() {
350
334
# Show activation message if enabled (only when env changes)
351
335
if [[ "${ showMessages } " == "true" ]]; then
352
336
if [[ "$__LAUNCHPAD_LAST_ACTIVATION_KEY" != "$env_dir" ]]; then
353
- printf "${ activationMessage } \\n " >&2
337
+ printf "${ activationMessage } " >&2
354
338
fi
355
339
fi
356
340
export __LAUNCHPAD_LAST_ACTIVATION_KEY="$env_dir"
357
341
358
- # Verbose: show activated env path
359
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
360
- printf "✅ Activated environment: %s\n" "$env_dir" >&2
361
- fi
342
+ # Removed verbose activated environment path message
362
343
363
344
# Ensure dynamic linker can find Launchpad-managed libraries (macOS/Linux)
364
345
# Build a list of library directories from the active environment and global install
@@ -410,79 +391,12 @@ __launchpad_switch_environment() {
410
391
fi
411
392
done
412
393
else
413
- # Non-blocking on-demand install with retry backoff (no artificial timeout)
414
- local cache_dir="$HOME/.cache/launchpad/shell_cache"
415
- mkdir -p "$cache_dir" 2>/dev/null || true
416
- local backoff_marker="$cache_dir/install_backoff_$(echo "$env_dir" | tr '/' '_')"
417
-
418
- local now_s=$(date +%s 2>/dev/null || echo 0)
419
- local retry_after=600 # 10 minutes
420
- local should_attempt=1
421
- if [[ -f "$backoff_marker" ]]; then
422
- local mtime=$(date -r "$backoff_marker" +%s 2>/dev/null || echo 0)
423
- if [[ $(( now_s - mtime )) -lt $retry_after ]]; then
424
- should_attempt=0
425
- fi
426
- fi
427
-
428
- if [[ "$should_attempt" -eq 1 ]]; then
429
- # Run installer; show output if verbose, otherwise suppress to keep prompt clean
430
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
431
- printf "🚀 Starting on-demand install for %q\n" "$project_dir" >&2
432
- fi
433
-
434
- if [[ "$verbose_mode" == "true" ]]; then
435
- # In verbose mode, avoid LAUNCHPAD_SHELL_INTEGRATION=1 so installer prints logs
436
- LAUNCHPAD_DISABLE_SHELL_INTEGRATION=1 ${ launchpadBinary } install "$project_dir"
437
- install_status=$?
438
- else
439
- LAUNCHPAD_DISABLE_SHELL_INTEGRATION=1 LAUNCHPAD_SHELL_INTEGRATION=1 ${ launchpadBinary } install "$project_dir" >/dev/null 2>&1
440
- install_status=$?
441
- fi
442
-
443
- if [[ $install_status -eq 0 ]]; then
444
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
445
- printf "📦 Installed project dependencies (on-demand)\n" >&2
446
- fi
447
- if [[ -d "$env_dir/bin" ]]; then
448
- export LAUNCHPAD_CURRENT_PROJECT="$project_dir"
449
- export LAUNCHPAD_ENV_BIN_PATH="$env_dir/bin"
450
- export PATH="$env_dir/bin:$PATH"
451
- if [[ "${ showMessages } " == "true" ]]; then
452
- printf "${ activationMessage } \\n" >&2
453
- fi
454
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
455
- printf "✅ Activated environment after install: %s\n" "$env_dir" >&2
456
- fi
457
- # Clear any backoff marker after successful install
458
- rm -f "$backoff_marker" 2>/dev/null || true
459
- fi
460
- else
461
- # Touch backoff marker only on failure to avoid repeated attempts
462
- : > "$backoff_marker" 2>/dev/null || true
463
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
464
- printf "❌ On-demand install failed (exit %d). Run 'launchpad install %q' manually.\n" "$install_status" "$project_dir" >&2
465
- fi
466
- fi
467
- else
468
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
469
- printf "⏳ Install backoff active; not attempting on-demand install.\n" >&2
470
- fi
471
- fi
394
+ # Environment not ready - skip setup during shell integration to prevent hanging
395
+ # User can run 'launchpad install <project>' manually when needed
472
396
fi
473
397
fi
474
398
475
- # Show completion time if verbose
476
- if [[ "$verbose_mode" == "true" && "$__lp_should_verbose_print" == "1" ]]; then
477
- local end_time=$(lp_now_ms)
478
- # Only print if both are integers
479
- if [[ "$start_time" =~ ^[0-9]+$ && "$end_time" =~ ^[0-9]+$ ]]; then
480
- local elapsed=$(( end_time - start_time ))
481
- if [[ "$elapsed" -ge 0 ]]; then
482
- printf "⏱️ [%sms] Shell integration completed\n" "$elapsed" >&2
483
- fi
484
- fi
485
- fi
399
+ # Removed verbose shell integration completion message
486
400
}
487
401
488
402
# CRITICAL: Prevent infinite loops - if we're already processing, exit immediately
548
462
# Clean up processing flag before exit
549
463
unset __LAUNCHPAD_PROCESSING 2>/dev/null || true
550
464
465
+ # Ensure we exit cleanly and don't hang the shell
551
466
return 0 2>/dev/null || exit 0`
552
467
}
553
468
0 commit comments