Skip to content

speedy gmux#22

Merged
Vilos92 merged 7 commits into
mainfrom
speedy-gmux
Jun 12, 2026
Merged

speedy gmux#22
Vilos92 merged 7 commits into
mainfrom
speedy-gmux

Conversation

@Vilos92

@Vilos92 Vilos92 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added lazy loading for Node.js version manager, Bun, and directory navigation to reduce startup overhead.
    • Added shell startup diagnostic tool for performance profiling.
    • Introduced caching for project scanning and Python environment discovery.
  • Performance

    • Optimized shell startup sequence with deduplication and single-pass caching.
    • Increased widget refresh interval for reduced polling.
  • Chores

    • Removed Oh My Zsh configuration.
    • Refactored project launcher with improved session discovery.
    • Reorganized shell initialization structure.

Summary by CodeRabbit

  • New Features

    • Added a shell startup profiling tool for diagnostics
    • Added lazy-init wrappers for Node version manager and zoxide
    • Added a regression test for the tmux launcher
  • Bug Fixes

    • Reduced widget polling frequency and added caching to lower system load
  • Chores

    • Reworked shell startup ordering and environment exports; removed prior Oh My Zsh preflight
    • Broadened shellcheck scope for scripts

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b112d21d-0be1-4f00-8ec7-ab037c547657

📥 Commits

Reviewing files that changed from the base of the PR and between ee3beb2 and 42798a6.

📒 Files selected for processing (3)
  • scripts/zsh-startup-profile.sh
  • zsh/.zshenv/post/javascript.sh
  • zsh/.zshrc

📝 Walkthrough

Walkthrough

Refactors 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.

Changes

Zsh Shell Startup Optimization & Restructuring

Layer / File(s) Summary
Main .zshrc restructuring and PATH/project exports
zsh/.zshrc
Instant prompt sourced early, PATH and project/alacritty exports added, cached python-user-bin bootstrap introduced, pre/post init hooks reorganized with filename deduplication, and gitstatusd cache staleness handling added.
Move fnm init to post and quiet eval
zsh/.zshenv/post/fnm.zsh
fnm initialization is moved to a conditional post script that evaluates fnm env --use-on-cd only when fnm exists, suppressing output/errors.
Lazy Bun completion wrapper
zsh/.zshenv/post/javascript.sh
Adds bun() wrapper that lazily sources Bun completions on first invocation and then delegates to the real bun.
Zoxide lazy-init bootstrapping
zsh/.zshenv/post/zoxide.zsh
Adds _zoxide_lazy_init() and exported z()/cd() entrypoints that initialize zoxide on first call, fall back to builtin cd when missing, and delegate to z() after init.

gmux Tmux Launcher Refactoring & Testing

Layer / File(s) Summary
gmux Core Refactoring—Lookup Tables & Canonicalization
tmux/.local/bin/gmux
Replace per-row scanning with precomputed lookup strings (path_lookup, display_lookup), use set_session_name for canonicalization, enumerate depth-1 project dirs with fd (fallback to find), and add resolve_display() / path_for_session() / is_tmux_session().
gmux Tmux Integration & Menu Generation
tmux/.local/bin/gmux
Consolidate tmux enumeration into a single tmux list-sessions call that includes attachment flags, populate tmux_lookup/current_session, generate emoji-marked tab-delimited fzf rows, and resolve selections via lookup tables.
gmux Regression Test Harness
scripts/gmux-equivalence-test.sh
New test harness builds fixture projects (hidden/dotted/spaced names), mocks tmux/fzf/attach-tmux-session, asserts picker output formatting and newline-per-option behavior, and validates $1 fast-path behavior for dotted/spaced/unknown names.
Gmux Übersicht Widget Optimization
mac-productivity/Library/Application Support/Übersicht/widgets/Gmux.jsx
Increase refreshFrequency from 2000ms to 5000ms; replace per-session stats with single tmux list-panes -a + awk aggregation; add TMPDIR-file cache for greg_projects scan (~60s TTL); update JSDoc parsing comments.

Developer Tools & Quality Assurance

Layer / File(s) Summary
Zsh Startup Profiling & Diagnostics
scripts/zsh-startup-profile.sh
New profiling tool with --detail and --zprof modes, per-sourced-file timing breakdown, subprocess fork probes (python/fnm/zoxide), and gitstatus/powerlevel10k health checks.
Sway Startup Documentation & Shellcheck Configuration
arch/.zshenv/init/sway.sh, scripts/shellcheck.sh
Add tty1 auto-start comment in sway init script; update shellcheck to include all *.sh files (remove previous exclusion).

🎯 4 (Complex) | ⏱️ ~65 minutes

"🐰 I hopped through dotfiles late at night,

Lazy-loads click, and tmux menus bright.
Tests march tidy, caching takes the stage,
Profiles hum softly, startup trims the page.
A small rabbit bows to clean dotfile light."

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title "speedy gmux" is vague and generic, using non-descriptive terms that don't convey meaningful information about the scope and nature of the changeset. Clarify the title to describe the main objective—e.g., 'Optimize shell startup and gmux performance with lazy loading and caching' or 'Refactor gmux and shell init for performance' to better reflect the comprehensive scope of changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch speedy-gmux

Comment @coderabbitai help to get the list of available commands and usage tips.

@Vilos92 Vilos92 marked this pull request as ready for review June 12, 2026 05:13
@Vilos92

Vilos92 commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@Vilos92

Vilos92 commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
zsh/.zshrc (2)

14-31: ⚡ Quick win

Clarify 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 $_pybin as a directory (line 18) and $_pybin/bin as 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:

  1. The cache format changed and line 21-23 provides backward compatibility, or
  2. There's an inconsistency in the logic

Consider simplifying to check only $_pybin as 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 for stat in gitstatus cache cleanup

In zsh/.zshrc, stat -f %m only executes when _gs_bin[1] exists (derived from gitstatusd-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, use stat -c %Y there.

🔧 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]} )) &amp;&amp; (( $(date +%s) - $(stat -f %m ${_gs_bin[1]}) &gt; 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 &gt; 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

📥 Commits

Reviewing files that changed from the base of the PR and between bc734ce and ee3beb2.

⛔ Files ignored due to path filters (1)
  • dex/.DS_Store is excluded by !**/.DS_Store
📒 Files selected for processing (14)
  • arch/.zshenv/init/sway.sh
  • mac-productivity/Library/Application Support/Übersicht/widgets/Gmux.jsx
  • scripts/gmux-equivalence-test.sh
  • scripts/shellcheck.sh
  • scripts/zsh-startup-profile.sh
  • tmux/.local/bin/gmux
  • zsh/.zshenv/init/fnm.sh
  • zsh/.zshenv/init/path.sh
  • zsh/.zshenv/post/fnm.zsh
  • zsh/.zshenv/post/javascript.sh
  • zsh/.zshenv/post/zoxide.sh
  • zsh/.zshenv/post/zoxide.zsh
  • zsh/.zshenv/pre/ohmyzsh.sh
  • zsh/.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

Comment thread scripts/zsh-startup-profile.sh Outdated
Comment thread scripts/zsh-startup-profile.sh Outdated
Comment thread zsh/.zshenv/post/javascript.sh Outdated
@Vilos92 Vilos92 merged commit da4d42b into main Jun 12, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant