Skip to content

Commit 806a1df

Browse files
committed
feat: enhance debug logging for system dependencies installation
1 parent a576b1d commit 806a1df

2 files changed

Lines changed: 54 additions & 3 deletions

File tree

update/__update_install_package_manager_deps.fish

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ function __update_install_package_manager_deps -d 'Install dependencies from dep
44
# Parses dependencies.json and installs apt/brew/snap packages
55
# Returns: 0 on success
66

7+
set -l debug_log "/tmp/cauldron_update_debug.log"
8+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Starting" >> $debug_log
9+
710
if not test -f $CAULDRON_PATH/dependencies.json
11+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: No dependencies.json found" >> $debug_log
812
return 0
913
end
1014

1115
set -l apt_dependencies (cat $CAULDRON_PATH/dependencies.json | jq -r '.apt[]')
1216
set -l brew_dependencies (cat $CAULDRON_PATH/dependencies.json | jq -r '.brew[]')
1317
set -l snap_dependencies (cat $CAULDRON_PATH/dependencies.json | jq -r '.snap[]')
1418

19+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: APT deps: $apt_dependencies" >> $debug_log
20+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Brew deps: $brew_dependencies" >> $debug_log
21+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Snap deps: $snap_dependencies" >> $debug_log
22+
1523
sudo -v
1624

1725
# Create temp directory for parallel job status
@@ -34,6 +42,7 @@ function __update_install_package_manager_deps -d 'Install dependencies from dep
3442
# Brew is run synchronously because it has issues running in background
3543
if test (count $brew_dependencies) -gt 0
3644
echo "→ Installing Brew packages..."
45+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Installing Brew packages" >> $debug_log
3746
set -l missing_deps
3847
for dep in $brew_dependencies
3948
if not type -q $dep
@@ -42,9 +51,11 @@ function __update_install_package_manager_deps -d 'Install dependencies from dep
4251
end
4352

4453
if test (count $missing_deps) -gt 0
54+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Missing Brew deps: $missing_deps" >> $debug_log
4555
# Run brew synchronously with normal terminal output
4656
set -x HOMEBREW_NO_AUTO_UPDATE 1
47-
brew install $missing_deps
57+
brew install $missing_deps 2>> $debug_log
58+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Brew install completed" >> $debug_log
4859
end
4960

5061
# Save brew dependency info to database
@@ -56,9 +67,12 @@ function __update_install_package_manager_deps -d 'Install dependencies from dep
5667
end
5768
end
5869
echo " ✓ Brew packages installed"
70+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Brew database updated" >> $debug_log
5971
echo ""
6072
end
6173

74+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Starting parallel APT/Snap jobs" >> $debug_log
75+
6276
# Job 1: Install all APT dependencies in parallel
6377
if test (count $apt_dependencies) -gt 0
6478
fish -c "
@@ -195,5 +209,6 @@ function __update_install_package_manager_deps -d 'Install dependencies from dep
195209
# Cleanup temp files
196210
rm -rf "$temp_dir" 2>/dev/null
197211

212+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_package_manager_deps: Completed successfully" >> $debug_log
198213
return 0
199214
end

update/__update_install_system_deps.fish

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ function __update_install_system_deps -d 'Install essential system tools'
44
# Installs: brew, pipx, tte, gum, uv, richify
55
# Returns: 0 on success
66

7+
set -l debug_log "/tmp/cauldron_update_debug.log"
8+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Starting" >> $debug_log
9+
710
set -l OS (uname -s)
811

912
# If brew is not installed we need it
1013
if not command -q brew
11-
/bin/bash -c "(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
14+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing Homebrew" >> $debug_log
15+
# Run Homebrew installer in explicit subshell to isolate it
16+
fish -c '/bin/bash -c "(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' 2>> $debug_log
17+
set -l brew_status $status
18+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Homebrew install status: $brew_status" >> $debug_log
19+
else
20+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Homebrew already installed" >> $debug_log
1221
end
1322

1423
# If pipx not installed
1524
if not command -q pipx
25+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing pipx" >> $debug_log
1626
if test $OS = "Darwin"
1727
brew install pipx
1828
else
@@ -21,46 +31,72 @@ function __update_install_system_deps -d 'Install essential system tools'
2131
end
2232
pipx ensurepath
2333
register-python-argcomplete --shell fish pipx >~/.config/fish/completions/pipx.fish
34+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: pipx installed" >> $debug_log
35+
else
36+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: pipx already installed" >> $debug_log
2437
end
2538

2639
# Ensure tte is installed and working (reinstall if broken)
2740
if not command -q tte
41+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing tte" >> $debug_log
2842
pipx ensurepath
2943
pipx install terminaltexteffects --quiet
44+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: tte installed" >> $debug_log
3045
else
3146
# Check if tte actually works (module might be broken)
3247
if not tte --version >/dev/null 2>&1
48+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Reinstalling broken tte" >> $debug_log
3349
pipx reinstall terminaltexteffects --quiet
50+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: tte reinstalled" >> $debug_log
51+
else
52+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: tte already working" >> $debug_log
3453
end
3554
end
3655

3756
if not command -q gum
57+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing gum" >> $debug_log
3858
brew install gum
59+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: gum installed" >> $debug_log
60+
else
61+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: gum already installed" >> $debug_log
3962
end
4063

4164
# Install uv for Python script running (needed for richify)
4265
if not command -q uv
4366
echo "→ Installing uv..."
44-
curl -LsSf https://astral.sh/uv/install.sh | sh >/dev/null 2>&1
67+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing uv" >> $debug_log
68+
# Run uv installer in explicit subshell to isolate it
69+
fish -c 'curl -LsSf https://astral.sh/uv/install.sh | sh' >/dev/null 2>> $debug_log
70+
set -l uv_status $status
71+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: uv install status: $uv_status" >> $debug_log
4572
# Ensure uv is in path for current session
4673
set -gx PATH $HOME/.cargo/bin $PATH
74+
else
75+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: uv already installed" >> $debug_log
4776
end
4877

4978
# Install richify for markdown streaming
5079
if not test -d $HOME/.local/share/richify
5180
echo "→ Installing richify for enhanced markdown streaming..."
81+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Installing richify" >> $debug_log
5282
git clone --depth 1 https://github.com/gianlucatruda/richify.git $HOME/.local/share/richify >/dev/null 2>&1
5383
chmod +x $HOME/.local/share/richify/richify.py
5484

5585
# Create symlink in ~/.local/bin
5686
mkdir -p $HOME/.local/bin
5787
ln -sf $HOME/.local/share/richify/richify.py $HOME/.local/bin/richify
5888
echo " ✓ Richify installed"
89+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: richify installed" >> $debug_log
5990
else if not command -q richify
91+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Fixing richify symlink" >> $debug_log
6092
# Richify directory exists but symlink might be missing
6193
mkdir -p $HOME/.local/bin
6294
ln -sf $HOME/.local/share/richify/richify.py $HOME/.local/bin/richify
95+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: richify symlink fixed" >> $debug_log
96+
else
97+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: richify already installed" >> $debug_log
6398
end
6499

100+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] __update_install_system_deps: Completed successfully" >> $debug_log
65101
return 0
66102
end

0 commit comments

Comments
 (0)