speedy gmux#22
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughRefactors gmux to precomputed lookup tables and single-pass tmux queries, adds a gmux regression test, restructures zsh startup for lazy initialization and a tiered .zshrc, updates Übersicht Gmux widget caching and cadence, and adds zsh startup profiling and shellcheck adjustments. ChangesZsh Shell Startup Optimization & Restructuring
gmux Tmux Launcher Refactoring & Testing
Developer Tools & Quality Assurance
🎯 4 (Complex) | ⏱️ ~65 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
zsh/.zshrc (2)
14-31: ⚡ Quick winClarify the cache format for Python user-bin path.
The cache creation (line 29) stores
$(python3 -m site --user-base)/bin, but the cache reading logic checks both$_pybinas a directory (line 18) and$_pybin/binas a directory (line 21-23). If the cache always stores the full path including/bin, then the second check on line 21-23 would look for/bin/bin, which is unlikely to exist. This suggests either:
- The cache format changed and line 21-23 provides backward compatibility, or
- There's an inconsistency in the logic
Consider simplifying to check only
$_pybinas a directory since the cache stores the complete path.♻️ Suggested simplification
_pybin_cache="${XDG_CACHE_HOME:-$HOME/.cache}/python-user-bin.path" -_pybin_added= if [[ -f "$_pybin_cache" ]]; then _pybin="$(<"$_pybin_cache")" if [[ -d "$_pybin" ]]; then export PATH="$_pybin:$PATH" - _pybin_added=1 - elif [[ -d "$_pybin/bin" ]]; then - export PATH="$_pybin/bin:$PATH" - _pybin_added=1 fi fi unset _pybin -if [[ -z $_pybin_added ]] && command -v python3 >/dev/null; then +if [[ ! -f "$_pybin_cache" ]] && command -v python3 >/dev/null; then ( _c="$_pybin_cache"; mkdir -p "${_c:h}"; print -r -- "$(python3 -m site --user-base)/bin" >| "$_c" ) &! fi -unset _pybin_cache _pybin_added +unset _pybin_cache🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@zsh/.zshrc` around lines 14 - 31, The cache logic is inconsistent: the writer stores "$(python3 -m site --user-base)/bin" but the reader checks both "$_pybin" and "$_pybin/bin", which can produce a "/bin/bin" lookup; fix by making the reader only check "$_pybin" and remove the elif branch that tests "$_pybin/bin", and keep the writer that writes "$(python3 -m site --user-base)/bin" (references: variables _pybin_cache and _pybin_added and the cache write command using python3 -m site --user-base).
55-63: Reduce portability risk forstatin gitstatus cache cleanupIn
zsh/.zshrc,stat -f %monly executes when_gs_bin[1]exists (derived fromgitstatusd-darwin-*), so it won’t run on Linux by default. For extra robustness if a darwin-named binary ends up in the cache on non-darwin hosts, usestat -c %Ythere.🔧 Proposed fix for cross-platform compatibility
_gs_cache="${XDG_CACHE_HOME:-$HOME/.cache}/gitstatus" _gs_bin=( "$_gs_cache"/gitstatusd-darwin-*(N) ) # Cached daemon older than 90 days — wipe the dir so p10k fetches a fresh one. -if (( ${+_gs_bin[1]} )) && (( $(date +%s) - $(stat -f %m ${_gs_bin[1]}) > 90 * 86400 )); then +if (( ${+_gs_bin[1]} )); then + if [[ "$OSTYPE" == darwin* ]]; then + _mtime=$(stat -f %m ${_gs_bin[1]}) + else + _mtime=$(stat -c %Y ${_gs_bin[1]}) + fi + if (( $(date +%s) - $_mtime > 90 * 86400 )); then - rm -rf "$_gs_cache" + rm -rf "$_gs_cache" + fi + unset _mtime fi unset _gs_cache _gs_bin🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@zsh/.zshrc` around lines 55 - 63, The gitstatus cache cleanup uses stat -f %m which is macOS-only; update the mtime retrieval for _gs_bin[1] to be cross-platform by attempting stat -f %m first and falling back to stat -c %Y if the former fails (or detect stat flavor), store the resulting epoch in a variable (e.g., cached_mtime) and use that in the existing arithmetic check inside the if that references _gs_cache and _gs_bin; keep the existing symbols (_gs_cache, _gs_bin, gitstatusd-darwin-*) and ensure all command substitutions are quoted and the fallback preserves the same numeric comparison against 90 * 86400.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/zsh-startup-profile.sh`:
- Around line 139-157: The health checks assume macOS arm64 binary and BSD stat
(gitstatusd-darwin-arm64 + stat -f) and use ripgrep without verifying it (zsh
-ic 'exit' | rg -q), causing failures on other platforms or when rg is missing;
update the gitstatus date/version logic (gitstatus_date, gitstatus_ver) to
detect the platform/arch or try macOS stat then fall back to GNU stat (e.g., try
stat -f then stat --printf) and resolve binary name dynamically (or document
macOS-only), and change the init check to verify ripgrep with command -v rg and
either fall back to grep -q or skip/report skipped check if rg is absent so the
zsh -ic 'exit' health check cannot return a false "ok".
- Line 96: The profiler call is using command substitution `$(_name)` instead of
variable expansion, causing `_name` to be executed rather than expanded; update
the call in the `_tick` invocation so it passes the `_name` variable (use
`${_name}`) so filenames like `"post-zsh/${_name}"` are recorded correctly by
the profiler (look for the `_tick` invocation that currently contains `$(_name)`
and replace it with the variable expansion `${_name}`).
In `@zsh/.zshenv/post/javascript.sh`:
- Around line 15-22: The zsh-only loader uses zsh syntax (unfunction, [[ ... ]],
source) causing shellcheck POSIX errors; fix by making the file zsh-only or
converting to POSIX: either add a zsh shebang (#!/usr/bin/env zsh) and/or rename
so the file is sourced only by zsh, preserving the bun() function and _bun_comp
logic, or rewrite the body to POSIX: guard the zsh-only unfunction with if [ -n
"${ZSH_VERSION-}" ]; then unfunction bun 2>/dev/null; fi, replace [[ -s
"$_bun_comp" ]] && source "$_bun_comp" with [ -s "$_bun_comp" ] && .
"$_bun_comp" (use . instead of source) and keep BUN_INSTALL fallback logic
unchanged for _bun_comp, ensuring no zsh-only syntax remains.
---
Nitpick comments:
In `@zsh/.zshrc`:
- Around line 14-31: The cache logic is inconsistent: the writer stores
"$(python3 -m site --user-base)/bin" but the reader checks both "$_pybin" and
"$_pybin/bin", which can produce a "/bin/bin" lookup; fix by making the reader
only check "$_pybin" and remove the elif branch that tests "$_pybin/bin", and
keep the writer that writes "$(python3 -m site --user-base)/bin" (references:
variables _pybin_cache and _pybin_added and the cache write command using
python3 -m site --user-base).
- Around line 55-63: The gitstatus cache cleanup uses stat -f %m which is
macOS-only; update the mtime retrieval for _gs_bin[1] to be cross-platform by
attempting stat -f %m first and falling back to stat -c %Y if the former fails
(or detect stat flavor), store the resulting epoch in a variable (e.g.,
cached_mtime) and use that in the existing arithmetic check inside the if that
references _gs_cache and _gs_bin; keep the existing symbols (_gs_cache, _gs_bin,
gitstatusd-darwin-*) and ensure all command substitutions are quoted and the
fallback preserves the same numeric comparison against 90 * 86400.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e32fc295-35ff-40d4-a39c-9c48b376f930
⛔ Files ignored due to path filters (1)
dex/.DS_Storeis excluded by!**/.DS_Store
📒 Files selected for processing (14)
arch/.zshenv/init/sway.shmac-productivity/Library/Application Support/Übersicht/widgets/Gmux.jsxscripts/gmux-equivalence-test.shscripts/shellcheck.shscripts/zsh-startup-profile.shtmux/.local/bin/gmuxzsh/.zshenv/init/fnm.shzsh/.zshenv/init/path.shzsh/.zshenv/post/fnm.zshzsh/.zshenv/post/javascript.shzsh/.zshenv/post/zoxide.shzsh/.zshenv/post/zoxide.zshzsh/.zshenv/pre/ohmyzsh.shzsh/.zshrc
💤 Files with no reviewable changes (4)
- zsh/.zshenv/pre/ohmyzsh.sh
- zsh/.zshenv/post/zoxide.sh
- zsh/.zshenv/init/fnm.sh
- zsh/.zshenv/init/path.sh
Summary by CodeRabbit
New Features
Performance
Chores
Summary by CodeRabbit
New Features
Bug Fixes
Chores