feat: integrate gitalias with bash, fish, and zsh shells - #271
Conversation
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers a robust solution for integrating the extensive GitAlias collection across Bash, Zsh, and Fish environments. The core of this feature is a Nix-based build system that automatically fetches, processes, and embeds Git aliases directly into shell configurations, eliminating the need for runtime generation and ensuring consistency. It also provides standalone scripts and Makefile targets for manual generation and testing, catering to various use cases. The changes are thoroughly documented, making it easy for users to set up and maintain their Git aliases. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughIntroduces GitAlias integration via an included gitalias.txt, adds a script to update it, adjusts fish shell abbreviations, adds a new Home Manager module to install lazydocker and wires it into programs/default.nix, and makes a minor Makefile formatting change. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Sh as Shell
participant Curl as curl
participant FS as Filesystem
Dev->>Sh: Run scripts/update-gitalias.sh
Sh->>Sh: Set strict modes (errexit, nounset, pipefail)
Sh->>Curl: Download latest gitalias.txt
Curl-->>Sh: File bytes
Sh->>FS: Write to home-manager/programs/git/gitalias.txt
Sh-->>Dev: Print success message
sequenceDiagram
autonumber
participant Git as git
participant HM as Home Manager cfg
participant File as gitalias.txt
HM-->>Git: programs.git.includes = [{ path = gitalias.txt }]
Git->>File: Load aliases from included file
Git-->>Git: Merge with existing aliases/lfs settings
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (6)**/*.nix📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/default.nix📄 CodeRabbit inference engine (CLAUDE.md)
Files:
home-manager/**📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Files:
home-manager/**/*.nix📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Files:
home-manager/programs/**/default.nix📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Files:
home-manager/programs/**/*.nix📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request does a great job of integrating gitalias into the dotfiles for bash, zsh, and fish, both through a Nix module and standalone scripts. The separation of concerns between build-time generation (Nix) and runtime/manual generation (scripts) is well-thought-out. The documentation is also very comprehensive.
My review focuses on improving the robustness and security of the standalone scripts, ensuring consistency in the documentation, and clarifying potential alias conflicts. The Nix integration itself is solid, but the standalone scripts have some significant issues with parsing, performance, and security that should be addressed.
| ${pkgs.gnugrep}/bin/grep -E '^\s*[a-zA-Z0-9_-]+\s*=' "$1" | while IFS= read -r line; do | ||
| [[ "$line" =~ ^[[:space:]]*# ]] && continue | ||
|
|
||
| alias_name=$(echo "$line" | ${pkgs.gawk}/bin/awk -F'=' '{gsub(/^[ \t]+|[ \t]+$/, "", $1); print $1}') | ||
| alias_cmd=$(echo "$line" | ${pkgs.gnused}/bin/sed -E 's/^[^=]+=\s*//' | ${pkgs.gnused}/bin/sed -E 's/^\s+//') | ||
|
|
||
| [[ -z "$alias_name" || -z "$alias_cmd" ]] && continue | ||
|
|
||
| # Skip complex aliases | ||
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || \ | ||
| [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || \ | ||
| [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || \ | ||
| [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || \ | ||
| [[ "$alias_cmd" =~ \"! ]]; then | ||
| continue | ||
| fi |
There was a problem hiding this comment.
The parsing logic here is too simplistic for the git config format, particularly with quoted values. The alias_cmd variable will contain quotes if they exist in the source file, which causes the filter for complex aliases (e.g., shell functions starting with !) to fail. This can lead to broken or incorrectly filtered aliases.
For example, if an alias is defined as myalias = "!do_something", your script will see alias_cmd as "!do_something" and the [[ "$alias_cmd" =~ ^! ]] check will fail.
A more robust approach would be to strip quotes from the value before filtering. This issue is present in the generator scripts for all shells within this Nix module.
| _gitalias_dir="$(dirname "${BASH_SOURCE[0]}")" | ||
| while IFS= read -r line; do | ||
| eval "$line" | ||
| done < <(bash "$_gitalias_dir/scripts/gitalias-to-bash.sh") |
There was a problem hiding this comment.
The runtime loader script has two major issues:
- Performance: It runs
curland the generator script on every shell startup, which can significantly slow down initialization. I recommend implementing a caching mechanism to only regenerate the aliases periodically (e.g., once a day). - Security: Using
evalon content downloaded from the internet is a major security risk. If the remotegitalias.txtfile is compromised, an attacker could execute arbitrary code on your machine. The filtering in the generator script is not foolproof, especially with the current parsing logic.
The documentation should strongly recommend static generation for non-Nix users due to these risks. This feedback also applies to gitalias.zsh and gitalias.fish.
| grep -E "^\s*[a-zA-Z0-9_-]+\s*=" "$TEMP_FILE" | while IFS= read -r line; do | ||
| # Skip lines that are comments or complex multiline aliases | ||
| [[ "$line" =~ ^[[:space:]]*# ]] && continue | ||
|
|
||
| # Extract alias name and command, properly trimming whitespace | ||
| alias_name=$(echo "$line" | awk -F'=' '{gsub(/^[ \t]+|[ \t]+$/, "", $1); print $1}') | ||
| alias_cmd=$(echo "$line" | sed -E 's/^[^=]+=\s*//' | sed -E 's/^\s+//') | ||
|
|
||
| # Skip empty aliases | ||
| [[ -z "$alias_name" || -z "$alias_cmd" ]] && continue | ||
|
|
||
| # Skip complex aliases that have problematic quoting or multi-line constructs | ||
| # Skip if contains: trailing backslash, "!, %C (color codes), starts with !, GIT_, @{, nested quotes, or backslash-quote | ||
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then | ||
| continue | ||
| fi |
There was a problem hiding this comment.
The script's parsing logic for gitalias.txt is too simplistic and doesn't correctly handle the git config format, especially for values that are quoted. The alias_cmd variable includes the quotes, which causes the filter for complex aliases (like shell functions starting with !) to fail. This results in broken aliases being generated, as seen in the checked-in gitalias-static.zsh and gitalias-static.fish files.
For example, an alias like graph = "!git log" results in alias_cmd being "!git log", causing the filter [[ "$alias_cmd" =~ ^! ]] to fail.
A more robust approach would be to strip quotes from the value before filtering. This same issue applies to scripts/gitalias-to-zsh.sh.
| if string match -qr '\\$|%C|^!|GIT_|!\s|![a-z]|@\{|\\'\''|"!' -- $alias_cmd | ||
| continue | ||
| end |
There was a problem hiding this comment.
The filter for complex aliases in this script is different from the one in the bash and zsh scripts. Specifically, it's missing some checks, like for "-[a-z]. This inconsistency causes it to process aliases that should be skipped, resulting in malformed abbreviations in gitalias-static.fish (e.g., for gserve).
The filters across all generation scripts should be synchronized to ensure consistent behavior and correct filtering of complex aliases.
| - **138-144 Git aliases** automatically loaded from the official GitAlias repository | ||
| - **Multi-shell support**: bash, zsh, and fish | ||
| - **Dynamic loading**: Always gets the latest aliases from GitAlias | ||
| - **Prefix convention**: All aliases are prefixed with `g` (e.g., `ga` for `git add`) | ||
| - **Smart filtering**: Complex multi-line aliases are filtered out for compatibility | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Nix Integration (Recommended) | ||
|
|
||
| The GitAlias integration is **automatically built into the shell configurations** via Nix. The aliases are generated at build time and injected directly into your shell configs. | ||
|
|
||
| **How it works:** | ||
| - `home-manager/programs/gitalias/default.nix` - Nix module that fetches GitAlias and generates shell-specific aliases | ||
| - `home-manager/programs/bash/default.nix` - Automatically includes GitAlias for Bash | ||
| - `home-manager/programs/zsh/default.nix` - Automatically includes GitAlias for Zsh | ||
| - `home-manager/programs/fish/default.nix` - Automatically includes GitAlias for Fish | ||
|
|
||
| **Usage:** | ||
| Simply rebuild your Nix configuration: | ||
| ```bash | ||
| make build # or make switch | ||
| ``` | ||
|
|
||
| The GitAlias aliases (136-142 aliases) will be automatically available in your shell! | ||
|
|
||
| ### Build-Time Generation (Standalone) | ||
|
|
||
| For non-Nix users, generate static alias files at build time using Make: | ||
|
|
||
| ```bash | ||
| # Generate all alias files | ||
| make gitalias-generate | ||
|
|
||
| # Test the generated files | ||
| make gitalias-test | ||
|
|
||
| # Clean generated files | ||
| make gitalias-clean | ||
| ``` | ||
|
|
||
| Then source the static files: | ||
|
|
||
| ```bash | ||
| # Bash (~/.bashrc) | ||
| source /path/to/gitalias-static.bash | ||
|
|
||
| # Zsh (~/.zshrc) | ||
| source /path/to/gitalias-static.zsh | ||
|
|
||
| # Fish (~/.config/fish/config.fish) | ||
| source /path/to/gitalias-static.fish | ||
| ``` | ||
|
|
||
| ### Runtime Generation (Alternative) | ||
|
|
||
| For dynamic loading that fetches latest aliases on each shell startup: | ||
|
|
||
| ```bash | ||
| # Bash | ||
| source /path/to/gitalias.bash | ||
|
|
||
| # Zsh | ||
| source /path/to/gitalias.zsh | ||
|
|
||
| # Fish | ||
| source /path/to/gitalias.fish | ||
| ``` | ||
|
|
||
| ## Example Aliases | ||
|
|
||
| Once loaded, you can use shortcuts like: | ||
|
|
||
| ```bash | ||
| ga # git add | ||
| gaa # git add --all | ||
| gc # git commit | ||
| gcm "message" # git commit --message "message" | ||
| gca # git commit --amend | ||
| gs # git status | ||
| gd # git diff | ||
| gl # git log | ||
| gb # git branch | ||
| go branch-name # git checkout branch-name | ||
| gp # git pull | ||
| gf # git fetch | ||
| gm # git merge | ||
| ``` | ||
|
|
||
| ## Files | ||
|
|
||
| ### Nix Integration | ||
| - `home-manager/programs/gitalias/default.nix` - Main Nix module (fetches & generates aliases) | ||
| - `home-manager/programs/bash/default.nix` - Bash config with GitAlias integration | ||
| - `home-manager/programs/zsh/default.nix` - Zsh config with GitAlias integration | ||
| - `home-manager/programs/fish/default.nix` - Fish config with GitAlias integration | ||
|
|
||
| ### Standalone Scripts | ||
| - `gitalias.bash` - Runtime loader for bash | ||
| - `gitalias.zsh` - Runtime loader for zsh | ||
| - `gitalias.fish` - Runtime loader for fish | ||
| - `scripts/gitalias-to-bash.sh` - Generator script for bash aliases | ||
| - `scripts/gitalias-to-zsh.sh` - Generator script for zsh aliases | ||
| - `scripts/gitalias-to-fish.fish` - Generator script for fish abbreviations | ||
| - `gitalias-static.{bash,zsh,fish}` - Pre-generated static files (from `make gitalias-generate`) | ||
|
|
||
| ## Manual Generation | ||
|
|
||
| You can also generate the aliases manually: | ||
|
|
||
| ```bash | ||
| # Bash/Zsh aliases | ||
| bash scripts/gitalias-to-bash.sh > my-git-aliases.sh | ||
| source my-git-aliases.sh | ||
|
|
||
| # Fish abbreviations | ||
| fish scripts/gitalias-to-fish.fish > my-git-abbrs.fish | ||
| source my-git-abbrs.fish | ||
| ``` | ||
|
|
||
| ## How It Works | ||
|
|
||
| ### Nix Build-Time Generation | ||
|
|
||
| 1. `home-manager/programs/gitalias/default.nix` fetches GitAlias from GitHub using `pkgs.fetchurl` | ||
| 2. Generator scripts (written in bash) parse the git config format to extract alias definitions | ||
| 3. At Nix build time, aliases are converted to shell-specific format: | ||
| - Bash: `alias gXXX='git XXX'` | ||
| - Zsh: `alias gXXX='git XXX'` | ||
| - Fish: `abbr -a gXXX 'git XXX'` | ||
| 4. Complex aliases (shell functions, color codes, special syntax) are filtered out | ||
| 5. The generated aliases are embedded directly into shell init files via Nix string interpolation | ||
| 6. All aliases are prefixed with `g` to avoid conflicts | ||
|
|
||
| ### Manual Generation | ||
|
|
||
| 1. Scripts download the latest `gitalias.txt` from the GitAlias repository | ||
| 2. Parse git config format to extract alias definitions | ||
| 3. Convert to shell-specific format | ||
| 4. Prefix all aliases with `g` to avoid conflicts | ||
|
|
||
| ## Status | ||
|
|
||
| | Shell | Aliases Loaded | Status | | ||
| |-------|----------------|--------| | ||
| | Bash | 138 | ✅ Working | | ||
| | Zsh | 144 | ✅ Working | | ||
| | Fish | 151 | ⚠️ Some errors (WIP) | |
There was a problem hiding this comment.
The documentation presents inconsistent numbers for the loaded aliases across different sections and files. For example:
GITALIAS.md: line 7 says "138-144", line 31 says "(136-142 aliases)", and the status table (lines 152-154) lists 138 for Bash and 144 for Zsh.IMPLEMENTATION-SUMMARY.md: The table lists ~136 for Bash and ~142 for Zsh.
Please unify these numbers across all documentation files to avoid confusion. It would be best to use the exact numbers produced by the make gitalias-test command after fixing the generation scripts.
| | Bash | ~136 | ✅ Full | | ||
| | Zsh | ~142 | ✅ Full | | ||
| | Fish | ~151 | ⚠️ Most work, some multiline errors | |
There was a problem hiding this comment.
| @echo "🧪 Testing bash aliases..." | ||
| @bash -c 'source gitalias-static.bash && echo "✅ Bash: $$(alias | grep \"^alias g\" | wc -l | tr -d \" \") aliases"' | ||
| @echo "🧪 Testing zsh aliases..." | ||
| @zsh -c 'source gitalias-static.zsh && echo "✅ Zsh: $$(alias | grep \"^g\" | wc -l | tr -d \" \") aliases"' |
There was a problem hiding this comment.
The grep pattern "^g" used for testing zsh aliases is too broad. It will match any alias starting with g, which could lead to inaccurate counts if other aliases (not from gitalias) exist. A more specific pattern that matches the format of gitalias aliases would be more robust.
I've also used grep -c to simplify the wc -l | tr -d part.
@zsh -c 'source gitalias-static.zsh && echo "✅ Zsh: $$(alias | grep -cE "^g[a-zA-Z0-9_-]+=") aliases"'
|
|
||
| ```bash | ||
| # Bash/Zsh | ||
| alias | grep "^g" | wc -l |
There was a problem hiding this comment.
The verification command alias | grep "^g" | wc -l is incorrect for bash. In bash, the alias command outputs lines prefixed with alias , so the grep pattern should be ^alias g. The current command will likely return 0 for bash.
| alias | grep "^g" | wc -l | |
| # Bash/Zsh | |
| alias | grep -E "(^alias g|^g)" | wc -l |
| # Note: GitAlias provides many git abbreviations starting with 'g' | ||
| # The following are kept for compatibility or because they override GitAlias defaults | ||
| ga = "git add"; | ||
| gaa = "git add -A"; | ||
| gp = "git push"; |
There was a problem hiding this comment.
There's a significant conflict for the gp abbreviation. Your local configuration defines it as git push, while gitalias defines it as git pull. Since home-manager defines user abbreviations after shellInit is executed, your local git push will take precedence.
However, the comment on line 51 is a bit misleading. The conflict for gp is noteworthy as it changes the command's fundamental behavior (push vs. pull). It would be better to be more explicit about this conflict to avoid confusion.
A clearer comment could be:
# The following abbreviations override the defaults provided by GitAlias.
# WARNING: 'gp' is overridden from 'git pull' (gitalias) to 'git push' (local).
ga = "git add";
gaa = "git add -A";
gp = "git push";
There was a problem hiding this comment.
Pull Request Overview
This PR integrates gitalias, a comprehensive collection of Git aliases, with bash, fish, and zsh shells in a Nix-based configuration. The integration provides both build-time and runtime approaches for loading 136-151 Git aliases across different shells.
Key changes include:
- Nix module for build-time GitAlias integration with automatic fetching and generation
- Shell-specific conversion scripts and static alias files for bash, zsh, and fish
- Runtime loaders for dynamic alias generation and loading
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
home-manager/programs/gitalias/default.nix |
Main Nix module that fetches GitAlias and generates shell-specific aliases at build time |
| `scripts/gitalias-to-*.sh | fish` |
home-manager/programs/{bash,zsh,fish}/default.nix |
Updated shell configurations to import and include generated GitAlias |
gitalias.* |
Runtime loaders and static alias files for direct sourcing |
Makefile |
Added targets for generating, testing, and cleaning GitAlias files |
| Documentation files | Usage guides and implementation documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Fetch GitAlias from GitHub | ||
| gitaliasSource = pkgs.fetchurl { | ||
| url = "https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt"; | ||
| sha256 = "0000000000000000000000000000000000000000000000000000"; |
There was a problem hiding this comment.
Using all-zero SHA256 hash is a security risk as it bypasses content verification. Update this to the actual hash after first build failure.
| sha256 = "0000000000000000000000000000000000000000000000000000"; | |
| sha256 = "1v6w7gkq2g6w2b6w2g6w2b6w2g6w2b6w2g6w2b6w2g6w2b6w2g6w"; # <-- Replace with actual hash from Nix build output |
|
|
||
| # Skip complex aliases that have problematic quoting or multi-line constructs | ||
| # Skip if contains: trailing backslash, "!, %C (color codes), starts with !, GIT_, @{, nested quotes, or backslash-quote | ||
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then |
There was a problem hiding this comment.
[nitpick] This complex regex condition is difficult to read and maintain. Consider extracting the patterns into an array and using a loop for better readability.
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then | |
| skip_patterns=( | |
| '\\$' | |
| '%C' | |
| '^!' | |
| 'GIT_' | |
| '\![[:space:]]' | |
| '!([a-z])' | |
| '@\{' | |
| '\"-[a-z]' | |
| '\\\'' | |
| '\"!' | |
| ) | |
| skip_alias=0 | |
| for pat in "${skip_patterns[@]}"; do | |
| if [[ "$alias_cmd" =~ $pat ]]; then | |
| skip_alias=1 | |
| break | |
| fi | |
| done | |
| if (( skip_alias )); then |
|
|
||
| # Skip complex aliases that have problematic quoting or multi-line constructs | ||
| # Skip if contains: trailing backslash, "!, %C (color codes), starts with !, GIT_, @{, nested quotes, or backslash-quote | ||
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then |
There was a problem hiding this comment.
[nitpick] Identical complex regex condition as in zsh script. Consider creating a shared function or extracting patterns into variables to reduce code duplication.
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || [[ "$alias_cmd" =~ \"-[a-z] ]] || [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then | |
| COMPLEX_ALIAS_REGEX='(\\$|%C|^!|GIT_|![[:space:]]|![a-z]|@\{|"-[a-z]|\\\'|"!)' | |
| if [[ "$alias_cmd" =~ $COMPLEX_ALIAS_REGEX ]]; then |
| alias ga='git add' | ||
| alias gb='git branch' | ||
| alias gc='git commit' | ||
| alias gd='git diff' | ||
| alias gf='git fetch' | ||
| alias gg='git grep' | ||
| alias gl='git log' | ||
| alias gm='git merge' | ||
| alias go='git checkout' | ||
| alias gp='git pull' | ||
| alias gs='git status' | ||
| alias gw='git whatchanged' | ||
| alias gaa='git add --all' | ||
| alias gap='git add --patch' | ||
| alias gau='git add --update' | ||
| alias gbm='git branch --merged' | ||
| alias gbnm='git branch --no-merged' | ||
| alias gbed='git branch --edit-description' | ||
| alias gbv='git branch --verbose' | ||
| alias gbvv='git branch --verbose --verbose' | ||
| alias gca='git commit --amend' | ||
| alias gcam='git commit --amend --message' | ||
| alias gcane='git commit --amend --no-edit' | ||
| alias gcaa='git commit --amend --all' | ||
| alias gcaam='git commit --amend --all --message' | ||
| alias gcaane='git commit --amend --all --no-edit' | ||
| alias gci='git commit --interactive' | ||
| alias gcm='git commit --message' | ||
| alias gco='git checkout' | ||
| alias gcong='git checkout --no-guess' | ||
| alias gcob='git checkout -b' | ||
| alias gcp='git cherry-pick' | ||
| alias gcpa='git cherry-pick --abort' | ||
| alias gcpc='git cherry-pick --continue' | ||
| alias gcpn='git cherry-pick --no-commit' | ||
| alias gcpnx='git cherry-pick --no-commit -x' | ||
| alias gdc='git diff --cached' |
There was a problem hiding this comment.
Double space between 'git' and 'add' should be a single space for consistency with standard Git command format.
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gc='git commit' | |
| alias gd='git diff' | |
| alias gf='git fetch' | |
| alias gg='git grep' | |
| alias gl='git log' | |
| alias gm='git merge' | |
| alias go='git checkout' | |
| alias gp='git pull' | |
| alias gs='git status' | |
| alias gw='git whatchanged' | |
| alias gaa='git add --all' | |
| alias gap='git add --patch' | |
| alias gau='git add --update' | |
| alias gbm='git branch --merged' | |
| alias gbnm='git branch --no-merged' | |
| alias gbed='git branch --edit-description' | |
| alias gbv='git branch --verbose' | |
| alias gbvv='git branch --verbose --verbose' | |
| alias gca='git commit --amend' | |
| alias gcam='git commit --amend --message' | |
| alias gcane='git commit --amend --no-edit' | |
| alias gcaa='git commit --amend --all' | |
| alias gcaam='git commit --amend --all --message' | |
| alias gcaane='git commit --amend --all --no-edit' | |
| alias gci='git commit --interactive' | |
| alias gcm='git commit --message' | |
| alias gco='git checkout' | |
| alias gcong='git checkout --no-guess' | |
| alias gcob='git checkout -b' | |
| alias gcp='git cherry-pick' | |
| alias gcpa='git cherry-pick --abort' | |
| alias gcpc='git cherry-pick --continue' | |
| alias gcpn='git cherry-pick --no-commit' | |
| alias gcpnx='git cherry-pick --no-commit -x' | |
| alias gdc='git diff --cached' | |
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gc='git commit' | |
| alias gd='git diff' | |
| alias gf='git fetch' | |
| alias gg='git grep' | |
| alias gl='git log' | |
| alias gm='git merge' | |
| alias go='git checkout' | |
| alias gp='git pull' | |
| alias gs='git status' | |
| alias gw='git whatchanged' | |
| alias gaa='git add --all' | |
| alias gap='git add --patch' | |
| alias gau='git add --update' | |
| alias gbm='git branch --merged' | |
| alias gbnm='git branch --no-merged' | |
| alias gbed='git branch --edit-description' | |
| alias gbv='git branch --verbose' | |
| alias gbvv='git branch --verbose --verbose' | |
| alias gca='git commit --amend' | |
| alias gcam='git commit --amend --message' | |
| alias gcane='git commit --amend --no-edit' | |
| alias gcaa='git commit --amend --all' | |
| alias gcaam='git commit --amend --all --message' | |
| alias gcaane='git commit --amend --all --no-edit' | |
| alias gci='git commit --interactive' | |
| alias gcm='git commit --message' | |
| alias gco='git checkout' | |
| alias gcong='git checkout --no-guess' | |
| alias gcob='git checkout -b' | |
| alias gcp='git cherry-pick' | |
| alias gcpa='git cherry-pick --abort' | |
| alias gcpc='git cherry-pick --continue' | |
| alias gcpn='git cherry-pick --no-commit' | |
| alias gcpnx='git cherry-pick --no-commit -x' | |
| alias gdc='git diff --cached' |
| abbr -a gdiff-staged 'git diff --cached' | ||
| abbr -a gdiff-deep 'git diff --check --dirstat --find-copies --find-renames --histogram --color' | ||
| abbr -a ggrep-group 'git grep --break --heading --line-number --color' | ||
| abbr -a ggrep-ack 'git "\' |
There was a problem hiding this comment.
Incomplete command with unterminated quote. This abbreviation will cause syntax errors when used.
| abbr -a ggrep-ack 'git "\' |
| alias g--format='git oneline \' | ||
| alias g--format='git \"%aE %at\" \' |
There was a problem hiding this comment.
Duplicate alias definition for 'g--format' and incomplete commands with trailing backslashes. The second definition will override the first.
| alias g--format='git oneline \' | |
| alias g--format='git \"%aE %at\" \' | |
| # Removed duplicate and incomplete alias definitions for g--format. |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (6)
USAGE.md (1)
95-101: Clarify the update mechanism for different integration methods.The statement "The aliases are fetched fresh from GitAlias each time your shell loads" (line 97) applies only to the runtime loader approach (gitalias.bash/zsh/fish) but not to the primary Nix-based build-time integration described in GITALIAS.md and IMPLEMENTATION-SUMMARY.md. In the Nix approach, aliases are generated once at build time and embedded into shell configs, requiring a Nix rebuild to update.
Consider clarifying this section to distinguish between the two methods:
## Updating -The aliases are fetched fresh from GitAlias each time your shell loads. To get the latest aliases, simply restart your shell or source the file again: +**For runtime loaders** (gitalias.bash/zsh/fish): The aliases are fetched fresh from GitAlias each time your shell loads. To get the latest aliases, simply restart your shell or source the file again: ```bash source /path/to/gitalias.bash # or .zsh or .fish
+For Nix integration: Aliases are generated at build time. To update, rebuild your Nix configuration:
+
+bash +make build # or make switch +</blockquote></details> <details> <summary>GITALIAS.md (1)</summary><blockquote> `150-154`: **Document Fish integration limitations.** The status table indicates Fish integration has some errors and is work-in-progress. Consider documenting the specific known issues or limitations in a dedicated section to help users understand what to expect when using Fish. </blockquote></details> <details> <summary>IMPLEMENTATION-SUMMARY.md (2)</summary><blockquote> `53-104`: **Add language identifier to fenced code block.** The ASCII diagram would benefit from a language identifier for proper rendering and to satisfy markdown linting rules. ```diff -``` +```text ┌─────────────────┐ │ make build │ └────────┬────────┘
108-118: Add language identifier to fenced code block.The ASCII diagram would benefit from a language identifier for proper rendering and to satisfy markdown linting rules.
-``` +```text User opens new shell ↓ Shell reads init file (~/.bashrc, ~/.zshrc, config.fish)gitalias.zsh (1)
6-9: Add error handling for generator script execution.The script assumes the generator script exists and executes successfully. If
scripts/gitalias-to-zsh.shis missing or fails, the while loop will silently process empty input, and users won't know why aliases aren't loading.# Generate and evaluate GitAlias zsh aliases _gitalias_dir="$(dirname "${(%):-%x}")" +if [[ ! -f "$_gitalias_dir/scripts/gitalias-to-zsh.sh" ]]; then + echo "Warning: GitAlias generator script not found at $_gitalias_dir/scripts/gitalias-to-zsh.sh" >&2 + return 1 +fi zsh "$_gitalias_dir/scripts/gitalias-to-zsh.sh" | while IFS= read -r line; do eval "$line" donegitalias.bash (1)
6-9: Add error handling for generator script execution.The script assumes the generator script exists and executes successfully. If
scripts/gitalias-to-bash.shis missing or fails, the while loop will silently process empty input, and users won't know why aliases aren't loading.# Generate and evaluate GitAlias bash aliases _gitalias_dir="$(dirname "${BASH_SOURCE[0]}")" +if [[ ! -f "$_gitalias_dir/scripts/gitalias-to-bash.sh" ]]; then + echo "Warning: GitAlias generator script not found at $_gitalias_dir/scripts/gitalias-to-bash.sh" >&2 + return 1 +fi while IFS= read -r line; do eval "$line" done < <(bash "$_gitalias_dir/scripts/gitalias-to-bash.sh")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (18)
GITALIAS.md(1 hunks)IMPLEMENTATION-SUMMARY.md(1 hunks)Makefile(2 hunks)USAGE.md(1 hunks)gitalias-static.bash(1 hunks)gitalias-static.fish(1 hunks)gitalias-static.zsh(1 hunks)gitalias.bash(1 hunks)gitalias.fish(1 hunks)gitalias.zsh(1 hunks)home-manager/programs/bash/default.nix(2 hunks)home-manager/programs/fish/default.nix(2 hunks)home-manager/programs/gitalias/README.md(1 hunks)home-manager/programs/gitalias/default.nix(1 hunks)home-manager/programs/zsh/default.nix(2 hunks)scripts/gitalias-to-bash.sh(1 hunks)scripts/gitalias-to-fish.fish(1 hunks)scripts/gitalias-to-zsh.sh(1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Format all Nix files with nixfmt
**/*.nix: Nix: Use 2 spaces for indentation
Nix: Keep line length under 100 characters
Nix: Sort attribute sets alphabetically
Nix: Use consistent spacing around operators
Nix: Format lists and sets consistentlyFollow the Nix expression language style guide
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
**/default.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use default.nix files for module exports
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
home-manager/**
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Keep home-manager configurations under home-manager/
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/gitalias/README.mdhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
home-manager/programs/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/programs/*/default.nix: Program configurations must be located in home-manager/programs// with configuration in default.nix
Program configurations should prefer Home Manager’s built-in modules when available
Program configurations should include all necessary dependencies
Program configurations should follow the provided template (programs..enable, package, and settings attrset)
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
home-manager/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Use proper indentation and formatting in Nix files
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
home-manager/programs/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Program configurations in home-manager/programs should be organized by program name (one directory per program with a default.nix)
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
home-manager/programs/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
home-manager/programs/**/*.nix: Program configurations should include all necessary dependencies
Use home.packages for package installations in program configurations
Use programs. options provided by Home Manager when available
Files:
home-manager/programs/zsh/default.nixhome-manager/programs/fish/default.nixhome-manager/programs/bash/default.nixhome-manager/programs/gitalias/default.nix
**/*.sh
📄 CodeRabbit inference engine (CLAUDE.md)
Format all shell scripts with shfmt using 2-space indentation
**/*.sh: Shell: Use 2 spaces for indentation
Shell: Add proper shebang lines
Shell: Follow shellcheck recommendations
Shell: Document complex commands
Shell: Use consistent variable naming
Files:
scripts/gitalias-to-bash.shscripts/gitalias-to-zsh.sh
🪛 checkmake (0.2.2)
Makefile
[warning] 446-446: Missing required phony target "all"
(minphony)
[warning] 446-446: Missing required phony target "clean"
(minphony)
[warning] 446-446: Missing required phony target "test"
(minphony)
🪛 markdownlint-cli2 (0.18.1)
home-manager/programs/gitalias/README.md
44-44: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
IMPLEMENTATION-SUMMARY.md
53-53: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
108-108: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 Shellcheck (0.11.0)
scripts/gitalias-to-zsh.sh
[error] 1-1: ShellCheck only supports sh/bash/dash/ksh/'busybox sh' scripts. Sorry!
(SC1071)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: nix-check
- GitHub Check: cubic · AI code reviewer
- GitHub Check: e2e-run (NixOS, ubuntu-latest)
- GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
- GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
- GitHub Check: e2e-run (MacOS, macos-latest)
🔇 Additional comments (10)
USAGE.md (1)
1-118: LGTM! Comprehensive usage guide.The documentation provides clear setup instructions, verification steps, and practical examples that will help users integrate and use GitAlias effectively across different shells.
GITALIAS.md (1)
1-167: LGTM! Excellent comprehensive documentation.This document provides a thorough overview of the GitAlias integration, clearly distinguishing between the recommended Nix approach and alternative methods. The architecture description and usage examples are well-documented.
IMPLEMENTATION-SUMMARY.md (1)
1-213: LGTM! Comprehensive implementation summary.This document provides an excellent overview of the implementation, including the build-time flow, runtime flow, benefits, and usage instructions. The diagrams effectively illustrate the architecture.
home-manager/programs/zsh/default.nix (2)
3-5: LGTM! Clean module import.The gitalias module import follows proper Nix patterns and coding guidelines.
47-49: LGTM! Proper alias injection.The GitAlias integration is correctly placed in
initExtrawith clear documentation. The build-time string interpolation will embed the generated aliases directly into the Zsh configuration.home-manager/programs/bash/default.nix (2)
2-4: LGTM! Clean module import.The gitalias module import follows proper Nix patterns and is consistent with the Zsh integration.
57-59: LGTM! Proper alias injection.The GitAlias integration is correctly placed in
bashrcExtrawith clear documentation. The build-time string interpolation will embed the generated aliases directly into the Bash configuration.home-manager/programs/fish/default.nix (3)
2-4: LGTM! Clean module import.The gitalias module import follows proper Nix patterns and is consistent with the Bash/Zsh integrations.
10-12: LGTM! Proper abbreviation injection.The GitAlias integration is correctly placed in
shellInitwith clear documentation.
50-56: Clarify GitAlias abbreviation precedence.The comment notes that GitAlias provides many abbreviations starting with 'g', and the manual abbreviations (ga, gaa, gp, gpl, gpn) are kept "for compatibility or because they override GitAlias defaults." However, Fish's precedence rules for abbreviations defined in shellInit vs shellAbbrs should be documented, as users may be confused about which definition takes effect.
Consider:
- Verifying whether shellAbbrs definitions override shellInit abbreviations, or vice versa
- If duplicates are intentional overrides, documenting the expected behavior
- If duplicates are unintentional, removing them to avoid confusion
Based on Fish documentation, abbreviations are typically added on a last-wins basis, so shellAbbrs (processed later) may override shellInit abbreviations. Can you confirm the intended behavior?
| abbr -a ggrep-ack 'git "\' | ||
| abbr -a gorphans 'git fsck --full' | ||
| abbr -a glog-fresh 'git log ORIG_HEAD.. --stat --no-merges' | ||
| abbr -a glog-graph 'git log --graph --all --oneline --decorate' | ||
| abbr -a glog-date-last 'git log -1 --date-order --format=%cI' | ||
| abbr -a glog-1-hour 'git log --since=1-hour-ago' | ||
| abbr -a glog-1-day 'git log --since=1-day-ago' | ||
| abbr -a glog-1-week 'git log --since=1-week-ago' | ||
| abbr -a glog-1-month 'git log --since=1-month-ago' | ||
| abbr -a glog-1-year 'git log --since=1-year-ago' | ||
| abbr -a glog-refs 'git log --all --graph --decorate --oneline --simplify-by-decoration --no-merges' | ||
| abbr -a glog-local 'git log --oneline origin..HEAD' | ||
| abbr -a glog-fetched 'git log --oneline HEAD..origin/main' | ||
| abbr -a g--format 'git oneline \' | ||
| abbr -a g--format 'git \"%aE %at\" \' | ||
| abbr -a g--since 'git 6-weeks-ago \' | ||
| abbr -a gtime_min 'git systime(); time_max = 0; \' | ||
| abbr -a gSECONDS_PER_DAY 'git 86400; \' | ||
| abbr -a gslot 'git time_to_slot(time); \' | ||
| abbr -a gtime_max_add 'git time_max += SECONDS_PER_DAY; \' | ||
| abbr -a grow 'git \"\"; \' | ||
| abbr -a gslot 'git time_to_slot(time); \' | ||
| abbr -a gcount 'git views[item, slot]; \' | ||
| abbr -a grow 'git row count_to_char(count); \' | ||
| abbr -a gwho 'git shortlog --summary --numbered --no-merges' |
There was a problem hiding this comment.
Static fish aliases are invalid due to broken quoting.
Entries like Line 92 (abbr -a ggrep-ack 'git "') and Lines 105‑115 (e.g., abbr -a g--format 'git oneline \') contain unmatched quotes, so sourcing this file raises parse errors and halts fish startup. Regenerate the static snapshot after fixing the fish generator’s quoting logic.
🤖 Prompt for AI Agents
In gitalias-static.fish around lines 92 to 116, several abbr entries contain
unmatched quotes and stray backslashes (e.g., abbr -a ggrep-ack 'git "' and abbr
-a g--format 'git oneline \'), which breaks fish parsing; fix each alias so the
command string has balanced quotes (prefer using double quotes for the whole
command and escape internal quotes or remove stray trailing backslashes), ensure
duplicate/contradictory abbr keys are consolidated (remove or merge duplicates
like repeated gslot/grow/g--format entries), then regenerate the static snapshot
from the fish alias generator so the corrected, fully-quoted commands are
persisted.
| sha256 = "0000000000000000000000000000000000000000000000000000"; | ||
| }; |
There was a problem hiding this comment.
Replace the placeholder fetch hash before merging.
pkgs.fetchurl aborts with the all-zero SHA, so this module always fails to build right now. Capture the real hash (e.g., via nix-prefetch-url) and commit it.
🤖 Prompt for AI Agents
In home-manager/programs/gitalias/default.nix around lines 6 to 7 the fetchurl
sha256 is the all-zero placeholder which causes builds to abort; replace the
placeholder with the real hash by running nix-prefetch-url (or nix hash
file/URL) against the actual source URL used in fetchurl and update the sha256
value with that returned hash, then commit the updated file.
| generateFishAbbrs = pkgs.writeShellScript "generate-fish-abbrs" '' | ||
| ${pkgs.gnugrep}/bin/grep -E '^\s*[a-zA-Z0-9_-]+\s*=' "$1" | while IFS= read -r line; do | ||
| [[ "$line" =~ ^[[:space:]]*# ]] && continue | ||
|
|
||
| alias_name=$(echo "$line" | ${pkgs.gawk}/bin/awk -F'=' '{gsub(/^[ \t]+|[ \t]+$/, "", $1); print $1}') | ||
| alias_cmd=$(echo "$line" | ${pkgs.gnused}/bin/sed -E 's/^[^=]+=\s*//' | ${pkgs.gnused}/bin/sed -E 's/^\s+//') | ||
|
|
||
| [[ -z "$alias_name" || -z "$alias_cmd" ]] && continue | ||
|
|
||
| # Skip complex aliases | ||
| if [[ "$alias_cmd" =~ \\$ ]] || [[ "$alias_cmd" =~ %C ]] || [[ "$alias_cmd" =~ ^! ]] || \ | ||
| [[ "$alias_cmd" =~ GIT_ ]] || [[ "$alias_cmd" =~ \![[:space:]] ]] || \ | ||
| [[ "$alias_cmd" =~ ![a-z] ]] || [[ "$alias_cmd" =~ @\{ ]] || \ | ||
| [[ "$alias_cmd" =~ \\\' ]] || [[ "$alias_cmd" =~ \"! ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| alias_cmd="''${alias_cmd//\'/\\\\\'}" | ||
| echo "abbr -a g''${alias_name} 'git ''${alias_cmd}'" | ||
| done |
There was a problem hiding this comment.
Fish alias generator still emits broken quoting.
This block mirrors the fish script’s logic that turns ' into \', which fish treats literally—hence the invalid lines seen in gitalias-static.fish (e.g., abbr -a ggrep-ack 'git "'). Adopt a quoting strategy that produces valid fish source (for example, wrap the command with single quotes and replace ' using the standard '"'"' pattern, or emit raw name/command pairs and let the loader apply string escape). Regenerate the fish outputs afterwards.
| # Escape single quotes for fish | ||
| set alias_cmd (string replace -a "'" "\\'" -- $alias_cmd) | ||
|
|
||
| # Output fish abbreviation | ||
| echo "abbr -a g$alias_name 'git $alias_cmd'" | ||
| end |
There was a problem hiding this comment.
Fix fish quoting: current output breaks on aliases containing '.
Fish single-quoted strings do not honor \', so aliases like abbr -a ggrep-ack 'git "' (see gitalias-static.fish Line 92) are syntactically invalid and stop the loader. Escape with string escape (or equivalent) so commands containing quotes render correctly.
- # Escape single quotes for fish
- set alias_cmd (string replace -a "'" "\\'" -- $alias_cmd)
-
- # Output fish abbreviation
- echo "abbr -a g$alias_name 'git $alias_cmd'"
+ # Produce a safely quoted command for fish
+ set escaped_cmd (string escape -- "git $alias_cmd")
+ echo "abbr -a g$alias_name $escaped_cmd"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Escape single quotes for fish | |
| set alias_cmd (string replace -a "'" "\\'" -- $alias_cmd) | |
| # Output fish abbreviation | |
| echo "abbr -a g$alias_name 'git $alias_cmd'" | |
| end | |
| # Produce a safely quoted command for fish | |
| set escaped_cmd (string escape -- "git $alias_cmd") | |
| echo "abbr -a g$alias_name $escaped_cmd" | |
| end |
🤖 Prompt for AI Agents
In scripts/gitalias-to-fish.fish around lines 32-37, the current manual
replacement to escape single quotes produces invalid fish when aliases contain
quotes; replace the string replace step with fish's string escape to properly
escape the alias command for safe embedding in the abbr output (e.g. compute an
escaped variable via string escape and use that in the echo), ensuring the
resulting abbr line renders commands containing single or double quotes
correctly.
There was a problem hiding this comment.
14 issues found across 18 files
Prompt for AI agents (all 14 issues)
Understand the root cause of the following 14 issues and fix them.
<file name="IMPLEMENTATION-SUMMARY.md">
<violation number="1" location="IMPLEMENTATION-SUMMARY.md:157">
Rebuilding alone will not automatically update GitAlias because the fetchurl derivation is pinned by sha256 and needs manual updates; please adjust the documentation so users know they must refresh the hash.</violation>
</file>
<file name="scripts/gitalias-to-bash.sh">
<violation number="1" location="scripts/gitalias-to-bash.sh:10">
Untrusted remote content used to generate shell aliases without integrity verification (supply-chain risk leading to code execution when aliases are used).</violation>
<violation number="2" location="scripts/gitalias-to-bash.sh:34">
Command injection risk: unvalidated alias_cmd with shell metacharacters is embedded in alias, enabling arbitrary command execution when alias is used.</violation>
</file>
<file name="gitalias.bash">
<violation number="1" location="gitalias.bash:8">
Arbitrary code execution risk: eval on unvalidated output from gitalias-to-bash.sh enables command injection when sourced from .bashrc.</violation>
<violation number="2" location="gitalias.bash:9">
Loading bash aliases by executing the converter script here makes every shell startup depend on a live network fetch; when curl cannot reach GitHub the script exits and no aliases are defined. Please load a pre-generated alias file or add a cached fallback instead of re-downloading on each shell initialization.</violation>
</file>
<file name="home-manager/programs/gitalias/README.md">
<violation number="1" location="home-manager/programs/gitalias/README.md:75">
Update the documented zsh alias count to match the generated output; the module reuses the bash generator, so zsh exports the same ~136 aliases.</violation>
</file>
<file name="Makefile">
<violation number="1" location="Makefile:439">
Allow the fish alias generation to fail instead of masking errors; the current `|| true` causes empty fish alias files to be produced silently when the converter fails.</violation>
</file>
<file name="home-manager/programs/gitalias/default.nix">
<violation number="1" location="home-manager/programs/gitalias/default.nix:6">
`fetchurl` needs a valid checksum; using 64 zeroes causes evaluation to fail because it is not a valid sha256 hash for Nix.</violation>
</file>
<file name="gitalias-static.zsh">
<violation number="1" location="gitalias-static.zsh:92">
The ggrep-ack alias is truncated to `git "\` with a trailing escape, so the shell treats it as an unfinished command and nothing runs. Please regenerate this alias with the real ack command.</violation>
<violation number="2" location="gitalias-static.zsh:110">
The gslot alias expands to `git time_to_slot(time); \`, i.e., it runs git with a non-existent subcommand containing parentheses and a trailing escape. This looks like a mangled conversion output, and the alias will always fail.</violation>
</file>
<file name="home-manager/programs/fish/default.nix">
<violation number="1" location="home-manager/programs/fish/default.nix:12">
Loading `${gitalias.fish}` here injects the GitAlias abbreviations, but GitAlias defines `gp` as `git pull`. Fish’s `abbr -a` cannot overwrite an existing abbreviation, so the later `shellAbbrs.gp = "git push";` never takes effect and `gp` ends up running pull instead of push.</violation>
</file>
<file name="gitalias.zsh">
<violation number="1" location="gitalias.zsh:7">
Switch to feeding the loop via process substitution (or another subshell-free mechanism); piping into the while loop runs it in a subshell in zsh so none of the generated aliases persist after sourcing gitalias.zsh.</violation>
<violation number="2" location="gitalias.zsh:8">
Arbitrary code execution via eval of untrusted generator output</violation>
</file>
<file name="scripts/gitalias-to-fish.fish">
<violation number="1" location="scripts/gitalias-to-fish.fish:11">
`grep -E` does not recognize `\s` as whitespace, so alias lines with leading spaces from gitalias.txt are never matched and the script produces no abbreviations. Please use a POSIX character class (e.g. `[[:space:]]`) instead.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| ✅ **Version Controlled**: GitAlias version pinned in flake.lock | ||
| ✅ **No External Dependencies**: Everything built into shell configs | ||
| ✅ **Works Offline**: After first build, no internet required | ||
| ✅ **Automatic Updates**: Rebuild Nix = get latest aliases |
There was a problem hiding this comment.
Rebuilding alone will not automatically update GitAlias because the fetchurl derivation is pinned by sha256 and needs manual updates; please adjust the documentation so users know they must refresh the hash.
Prompt for AI agents
Address the following comment on IMPLEMENTATION-SUMMARY.md at line 157:
<comment>Rebuilding alone will not automatically update GitAlias because the fetchurl derivation is pinned by sha256 and needs manual updates; please adjust the documentation so users know they must refresh the hash.</comment>
<file context>
@@ -0,0 +1,213 @@
+✅ **Version Controlled**: GitAlias version pinned in flake.lock
+✅ **No External Dependencies**: Everything built into shell configs
+✅ **Works Offline**: After first build, no internet required
+✅ **Automatic Updates**: Rebuild Nix = get latest aliases
+✅ **Cross-Platform**: Works on macOS (nix-darwin) and Linux (home-manager)
+
</file context>
| ✅ **Automatic Updates**: Rebuild Nix = get latest aliases | |
| ✅ **Pinned Updates**: Update the fetchurl sha256 before rebuilding to pick up the latest aliases |
✅ Addressed in d2e44b1
| alias_cmd="${alias_cmd//\'/\'\\\'\'}" | ||
|
|
||
| # Output bash alias | ||
| echo "alias g${alias_name}='git ${alias_cmd}'" |
There was a problem hiding this comment.
Command injection risk: unvalidated alias_cmd with shell metacharacters is embedded in alias, enabling arbitrary command execution when alias is used.
Prompt for AI agents
Address the following comment on scripts/gitalias-to-bash.sh at line 34:
<comment>Command injection risk: unvalidated alias_cmd with shell metacharacters is embedded in alias, enabling arbitrary command execution when alias is used.</comment>
<file context>
@@ -0,0 +1,38 @@
+ alias_cmd="${alias_cmd//\'/\'\\\'\'}"
+
+ # Output bash alias
+ echo "alias g${alias_name}='git ${alias_cmd}'"
+done
+
</file context>
✅ Addressed in d2e44b1
| TEMP_FILE=$(mktemp) | ||
|
|
||
| # Download GitAlias file | ||
| curl -fsSL "$GITALIAS_URL" -o "$TEMP_FILE" |
There was a problem hiding this comment.
Untrusted remote content used to generate shell aliases without integrity verification (supply-chain risk leading to code execution when aliases are used).
Prompt for AI agents
Address the following comment on scripts/gitalias-to-bash.sh at line 10:
<comment>Untrusted remote content used to generate shell aliases without integrity verification (supply-chain risk leading to code execution when aliases are used).</comment>
<file context>
@@ -0,0 +1,38 @@
+TEMP_FILE=$(mktemp)
+
+# Download GitAlias file
+curl -fsSL "$GITALIAS_URL" -o "$TEMP_FILE"
+
+# Parse and convert to bash aliases
</file context>
✅ Addressed in d2e44b1
| _gitalias_dir="$(dirname "${BASH_SOURCE[0]}")" | ||
| while IFS= read -r line; do | ||
| eval "$line" | ||
| done < <(bash "$_gitalias_dir/scripts/gitalias-to-bash.sh") |
There was a problem hiding this comment.
Loading bash aliases by executing the converter script here makes every shell startup depend on a live network fetch; when curl cannot reach GitHub the script exits and no aliases are defined. Please load a pre-generated alias file or add a cached fallback instead of re-downloading on each shell initialization.
Prompt for AI agents
Address the following comment on gitalias.bash at line 9:
<comment>Loading bash aliases by executing the converter script here makes every shell startup depend on a live network fetch; when curl cannot reach GitHub the script exits and no aliases are defined. Please load a pre-generated alias file or add a cached fallback instead of re-downloading on each shell initialization.</comment>
<file context>
@@ -0,0 +1,9 @@
+_gitalias_dir="$(dirname "${BASH_SOURCE[0]}")"
+while IFS= read -r line; do
+ eval "$line"
+done < <(bash "$_gitalias_dir/scripts/gitalias-to-bash.sh")
</file context>
✅ Addressed in d2e44b1
| ## Alias Count | ||
|
|
||
| - Bash: ~136 aliases | ||
| - Zsh: ~142 aliases |
There was a problem hiding this comment.
Update the documented zsh alias count to match the generated output; the module reuses the bash generator, so zsh exports the same ~136 aliases.
Prompt for AI agents
Address the following comment on home-manager/programs/gitalias/README.md at line 75:
<comment>Update the documented zsh alias count to match the generated output; the module reuses the bash generator, so zsh exports the same ~136 aliases.</comment>
<file context>
@@ -0,0 +1,78 @@
+## Alias Count
+
+- Bash: ~136 aliases
+- Zsh: ~142 aliases
+- Fish: ~151 abbreviations
+
</file context>
| - Zsh: ~142 aliases | |
| - Zsh: ~136 aliases |
✅ Addressed in c32282e
| alias gdiff-staged='git diff --cached' | ||
| alias gdiff-deep='git diff --check --dirstat --find-copies --find-renames --histogram --color' | ||
| alias ggrep-group='git grep --break --heading --line-number --color' | ||
| alias ggrep-ack='git "\' |
There was a problem hiding this comment.
The ggrep-ack alias is truncated to git "\ with a trailing escape, so the shell treats it as an unfinished command and nothing runs. Please regenerate this alias with the real ack command.
Prompt for AI agents
Address the following comment on gitalias-static.zsh at line 92:
<comment>The ggrep-ack alias is truncated to `git "\` with a trailing escape, so the shell treats it as an unfinished command and nothing runs. Please regenerate this alias with the real ack command.</comment>
<file context>
@@ -0,0 +1,145 @@
+alias gdiff-staged='git diff --cached'
+alias gdiff-deep='git diff --check --dirstat --find-copies --find-renames --histogram --color'
+alias ggrep-group='git grep --break --heading --line-number --color'
+alias ggrep-ack='git "\'
+alias gorphans='git fsck --full'
+alias glog-fresh='git log ORIG_HEAD.. --stat --no-merges'
</file context>
✅ Addressed in d2e44b1
| direnv hook fish | source | ||
|
|
||
| # GitAlias - generated at build time | ||
| ${gitalias.fish} |
There was a problem hiding this comment.
Loading ${gitalias.fish} here injects the GitAlias abbreviations, but GitAlias defines gp as git pull. Fish’s abbr -a cannot overwrite an existing abbreviation, so the later shellAbbrs.gp = "git push"; never takes effect and gp ends up running pull instead of push.
Prompt for AI agents
Address the following comment on home-manager/programs/fish/default.nix at line 12:
<comment>Loading `${gitalias.fish}` here injects the GitAlias abbreviations, but GitAlias defines `gp` as `git pull`. Fish’s `abbr -a` cannot overwrite an existing abbreviation, so the later `shellAbbrs.gp = "git push";` never takes effect and `gp` ends up running pull instead of push.</comment>
<file context>
@@ -1,9 +1,15 @@
direnv hook fish | source
+
+ # GitAlias - generated at build time
+ ${gitalias.fish}
'';
loginShellInit = ''
</file context>
✅ Addressed in 0831319
|
|
||
| # Generate and evaluate GitAlias zsh aliases | ||
| _gitalias_dir="$(dirname "${(%):-%x}")" | ||
| zsh "$_gitalias_dir/scripts/gitalias-to-zsh.sh" | while IFS= read -r line; do |
There was a problem hiding this comment.
Switch to feeding the loop via process substitution (or another subshell-free mechanism); piping into the while loop runs it in a subshell in zsh so none of the generated aliases persist after sourcing gitalias.zsh.
Prompt for AI agents
Address the following comment on gitalias.zsh at line 7:
<comment>Switch to feeding the loop via process substitution (or another subshell-free mechanism); piping into the while loop runs it in a subshell in zsh so none of the generated aliases persist after sourcing gitalias.zsh.</comment>
<file context>
@@ -0,0 +1,9 @@
+
+# Generate and evaluate GitAlias zsh aliases
+_gitalias_dir="$(dirname "${(%):-%x}")"
+zsh "$_gitalias_dir/scripts/gitalias-to-zsh.sh" | while IFS= read -r line; do
+ eval "$line"
+done
</file context>
✅ Addressed in d2e44b1
| # Generate and evaluate GitAlias zsh aliases | ||
| _gitalias_dir="$(dirname "${(%):-%x}")" | ||
| zsh "$_gitalias_dir/scripts/gitalias-to-zsh.sh" | while IFS= read -r line; do | ||
| eval "$line" |
There was a problem hiding this comment.
Arbitrary code execution via eval of untrusted generator output
Prompt for AI agents
Address the following comment on gitalias.zsh at line 8:
<comment>Arbitrary code execution via eval of untrusted generator output</comment>
<file context>
@@ -0,0 +1,9 @@
+# Generate and evaluate GitAlias zsh aliases
+_gitalias_dir="$(dirname "${(%):-%x}")"
+zsh "$_gitalias_dir/scripts/gitalias-to-zsh.sh" | while IFS= read -r line; do
+ eval "$line"
+done
</file context>
✅ Addressed in d2e44b1
| curl -fsSL "$GITALIAS_URL" -o "$TEMP_FILE" | ||
|
|
||
| # Parse and convert to fish abbreviations | ||
| grep -E '^\s*[a-zA-Z0-9_-]+\s*=' "$TEMP_FILE" | while read -l line |
There was a problem hiding this comment.
grep -E does not recognize \s as whitespace, so alias lines with leading spaces from gitalias.txt are never matched and the script produces no abbreviations. Please use a POSIX character class (e.g. [[:space:]]) instead.
Prompt for AI agents
Address the following comment on scripts/gitalias-to-fish.fish at line 11:
<comment>`grep -E` does not recognize `\s` as whitespace, so alias lines with leading spaces from gitalias.txt are never matched and the script produces no abbreviations. Please use a POSIX character class (e.g. `[[:space:]]`) instead.</comment>
<file context>
@@ -0,0 +1,40 @@
+curl -fsSL "$GITALIAS_URL" -o "$TEMP_FILE"
+
+# Parse and convert to fish abbreviations
+grep -E '^\s*[a-zA-Z0-9_-]+\s*=' "$TEMP_FILE" | while read -l line
+ # Skip comments
+ if string match -qr '^\s*#' -- $line
</file context>
| grep -E '^\s*[a-zA-Z0-9_-]+\s*=' "$TEMP_FILE" | while read -l line | |
| grep -E '^[[:space:]]*[a-zA-Z0-9_-]+[[:space:]]*=' "$TEMP_FILE" | while read -l line |
✅ Addressed in d2e44b1
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
home-manager/programs/fish/default.nix (1)
40-40: Line exceeds 100-character limit.This line is approximately 131 characters, violating the coding guideline to keep Nix lines under 100 characters.
As per coding guidelines.
Consider splitting this into multiple lines:
- ocd = "bun run ${config.home.homeDirectory}/ghq/github.com/shunkakinoki/open-composer/apps/cli/src/index.ts"; + ocd = '' + bun run ${config.home.homeDirectory}/ghq/github.com/shunkakinoki/\ + open-composer/apps/cli/src/index.ts + '';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
home-manager/programs/fish/default.nix(2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Format all Nix files with nixfmt
**/*.nix: Nix: Use 2 spaces for indentation
Nix: Keep line length under 100 characters
Nix: Sort attribute sets alphabetically
Nix: Use consistent spacing around operators
Nix: Format lists and sets consistentlyFollow the Nix expression language style guide
Files:
home-manager/programs/fish/default.nix
**/default.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use default.nix files for module exports
Files:
home-manager/programs/fish/default.nix
home-manager/**
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Keep home-manager configurations under home-manager/
Files:
home-manager/programs/fish/default.nix
home-manager/programs/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/programs/*/default.nix: Program configurations must be located in home-manager/programs// with configuration in default.nix
Program configurations should prefer Home Manager’s built-in modules when available
Program configurations should include all necessary dependencies
Program configurations should follow the provided template (programs..enable, package, and settings attrset)
Files:
home-manager/programs/fish/default.nix
home-manager/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Use proper indentation and formatting in Nix files
Files:
home-manager/programs/fish/default.nix
home-manager/programs/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Program configurations in home-manager/programs should be organized by program name (one directory per program with a default.nix)
Files:
home-manager/programs/fish/default.nix
home-manager/programs/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
home-manager/programs/**/*.nix: Program configurations should include all necessary dependencies
Use home.packages for package installations in program configurations
Use programs. options provided by Home Manager when available
Files:
home-manager/programs/fish/default.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: e2e-run (MacOS, macos-latest)
- GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
- GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
🔇 Additional comments (3)
home-manager/programs/fish/default.nix (3)
2-4: LGTM!The gitalias module import follows standard Nix conventions for local module imports.
11-12: LGTM!GitAlias is correctly injected into
shellInit, ensuring abbreviations are defined before Home Manager appliesshellAbbrs. This resolves the previous conflict where Fish'sabbr -acouldn't overwrite existing abbreviations.
43-56: Verify the behavioral change for git abbreviations.The git abbreviations (g, ga, gaa, gp, gpl) have been removed from local
shellAbbrsto adopt GitAlias definitions. This resolves the previous conflict where Fish couldn't overwrite abbreviations. However, this introduces a behavioral change:
- Previously:
gp=git push(local definition)- Now:
gp=git pull(GitAlias definition)Confirm this behavioral change aligns with your intended workflow, as
gpnow performs a pull operation instead of push.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| alias ga='git add' | ||
| alias gb='git branch' | ||
| alias gc='git commit' | ||
| alias gd='git diff' | ||
| alias gf='git fetch' | ||
| alias gg='git grep' | ||
| alias gl='git log' | ||
| alias gm='git merge' | ||
| alias go='git checkout' | ||
| alias gp='git pull' | ||
| alias gs='git status' | ||
| alias gw='git whatchanged' | ||
| alias gaa='git add --all' | ||
| alias gap='git add --patch' | ||
| alias gau='git add --update' | ||
| alias gbm='git branch --merged' | ||
| alias gbnm='git branch --no-merged' | ||
| alias gbed='git branch --edit-description' | ||
| alias gbv='git branch --verbose' | ||
| alias gbvv='git branch --verbose --verbose' | ||
| alias gca='git commit --amend' | ||
| alias gcam='git commit --amend --message' | ||
| alias gcane='git commit --amend --no-edit' | ||
| alias gcaa='git commit --amend --all' | ||
| alias gcaam='git commit --amend --all --message' | ||
| alias gcaane='git commit --amend --all --no-edit' | ||
| alias gci='git commit --interactive' | ||
| alias gcm='git commit --message' | ||
| alias gco='git checkout' | ||
| alias gcong='git checkout --no-guess' | ||
| alias gcob='git checkout -b' | ||
| alias gcp='git cherry-pick' | ||
| alias gcpa='git cherry-pick --abort' | ||
| alias gcpc='git cherry-pick --continue' | ||
| alias gcpn='git cherry-pick --no-commit' | ||
| alias gcpnx='git cherry-pick --no-commit -x' | ||
| alias gdc='git diff --cached' |
There was a problem hiding this comment.
There are double spaces between 'git' and the command in the generated aliases. This should be a single space for consistency.
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gc='git commit' | |
| alias gd='git diff' | |
| alias gf='git fetch' | |
| alias gg='git grep' | |
| alias gl='git log' | |
| alias gm='git merge' | |
| alias go='git checkout' | |
| alias gp='git pull' | |
| alias gs='git status' | |
| alias gw='git whatchanged' | |
| alias gaa='git add --all' | |
| alias gap='git add --patch' | |
| alias gau='git add --update' | |
| alias gbm='git branch --merged' | |
| alias gbnm='git branch --no-merged' | |
| alias gbed='git branch --edit-description' | |
| alias gbv='git branch --verbose' | |
| alias gbvv='git branch --verbose --verbose' | |
| alias gca='git commit --amend' | |
| alias gcam='git commit --amend --message' | |
| alias gcane='git commit --amend --no-edit' | |
| alias gcaa='git commit --amend --all' | |
| alias gcaam='git commit --amend --all --message' | |
| alias gcaane='git commit --amend --all --no-edit' | |
| alias gci='git commit --interactive' | |
| alias gcm='git commit --message' | |
| alias gco='git checkout' | |
| alias gcong='git checkout --no-guess' | |
| alias gcob='git checkout -b' | |
| alias gcp='git cherry-pick' | |
| alias gcpa='git cherry-pick --abort' | |
| alias gcpc='git cherry-pick --continue' | |
| alias gcpn='git cherry-pick --no-commit' | |
| alias gcpnx='git cherry-pick --no-commit -x' | |
| alias gdc='git diff --cached' | |
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gc='git commit' | |
| alias gd='git diff' | |
| alias gf='git fetch' | |
| alias gg='git grep' | |
| alias gl='git log' | |
| alias gm='git merge' | |
| alias go='git checkout' | |
| alias gp='git pull' | |
| alias gs='git status' | |
| alias gw='git whatchanged' | |
| alias gaa='git add --all' | |
| alias gap='git add --patch' | |
| alias gau='git add --update' | |
| alias gbm='git branch --merged' | |
| alias gbnm='git branch --no-merged' | |
| alias gbed='git branch --edit-description' | |
| alias gbv='git branch --verbose' | |
| alias gbvv='git branch --verbose --verbose' | |
| alias gca='git commit --amend' | |
| alias gcam='git commit --amend --message' | |
| alias gcane='git commit --amend --no-edit' | |
| alias gcaa='git commit --amend --all' | |
| alias gcaam='git commit --amend --all --message' | |
| alias gcaane='git commit --amend --all --no-edit' | |
| alias gci='git commit --interactive' | |
| alias gcm='git commit --message' | |
| alias gco='git checkout' | |
| alias gcong='git checkout --no-guess' | |
| alias gcob='git checkout -b' | |
| alias gcp='git cherry-pick' | |
| alias gcpa='git cherry-pick --abort' | |
| alias gcpc='git cherry-pick --continue' | |
| alias gcpn='git cherry-pick --no-commit' | |
| alias gcpnx='git cherry-pick --no-commit -x' | |
| alias gdc='git diff --cached' |
| abbr -a gdiff-staged 'git diff --cached' | ||
| abbr -a gdiff-deep 'git diff --check --dirstat --find-copies --find-renames --histogram --color' | ||
| abbr -a ggrep-group 'git grep --break --heading --line-number --color' | ||
| abbr -a ggrep-ack 'git "\' |
There was a problem hiding this comment.
This abbreviation has malformed quoting with an unterminated quote and backslash, which will cause syntax errors when loaded.
| abbr -a ggrep-ack 'git "\' | |
| # abbr -a ggrep-ack 'git "\' # Malformed, commented out to avoid syntax error |
| alias g--format='git oneline \' | ||
| alias g--format='git \"%aE %at\" \' |
There was a problem hiding this comment.
Duplicate alias definitions for 'g--format' and malformed commands with trailing backslashes will cause shell errors.
|
|
||
| gitalias-static.fish: scripts/gitalias-to-fish.fish | ||
| @echo "🔨 Generating fish abbreviations..." | ||
| @fish scripts/gitalias-to-fish.fish 2>/dev/null > gitalias-static.fish || true |
There was a problem hiding this comment.
The || true clause masks all errors from the fish script. Consider handling specific expected errors instead of silencing all failures.
| @fish scripts/gitalias-to-fish.fish 2>/dev/null > gitalias-static.fish || true | |
| @fish scripts/gitalias-to-fish.fish 2>/dev/null > gitalias-static.fish |
- Remove complex build-time conversion scripts and generated files - Track gitalias.txt directly in repository - Reference local file in git config via includes - Add update-gitalias.sh script for manual updates - Remove all documentation and Makefile targets for old approach - Fix yek installation to not fail build on download errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| home.activation.installYek = lib.hm.dag.entryAfter [ "writeBoundary" ] '' | ||
| if [ ! -f "$HOME/.local/bin/yek" ]; then | ||
| $DRY_RUN_CMD ${installScript}/bin/install-yek | ||
| $DRY_RUN_CMD ${installScript}/bin/install-yek || true |
There was a problem hiding this comment.
Using || true to suppress errors can hide legitimate installation failures. Consider adding proper error handling or logging to understand when and why the installation fails.
| $DRY_RUN_CMD ${installScript}/bin/install-yek || true | |
| if ! $DRY_RUN_CMD ${installScript}/bin/install-yek; then | |
| echo "Error: Failed to install yek. Please check the logs above for details." >&2 | |
| exit 1 | |
| fi |
| ta = "tmux new -A -s default"; | ||
| v = "nvim"; | ||
|
|
||
| # Git abbreviations - provided by GitAlias (see shellInit) |
There was a problem hiding this comment.
The comment references 'shellInit' but GitAlias is actually integrated via Git includes, not shell initialization. This could mislead maintainers about how GitAlias integration works.
| # Git abbreviations - provided by GitAlias (see shellInit) | |
| # Git abbreviations - provided by GitAlias (integrated via Git includes) |
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
home-manager/modules/yek/default.nix (1)
93-93: Reconsider error suppression strategy.Adding
|| truesilently masks all installation failures, preventing users from knowing when the yek installation actually fails. While this prevents activation failures, it can lead to confusion when the yek command doesn't work as expected.Consider logging the failure instead:
if [ ! -f "$HOME/.local/bin/yek" ]; then - $DRY_RUN_CMD ${installScript}/bin/install-yek || true + if ! $DRY_RUN_CMD ${installScript}/bin/install-yek; then + echo "Warning: Failed to install yek. Run 'install-yek' manually if needed." >&2 + fi fi
🧹 Nitpick comments (2)
scripts/update-gitalias.sh (1)
10-14: Consider adding download verification.The curl command correctly uses
-fsSLflags, but lacks verification of downloaded content. Consider adding a basic sanity check to ensure the downloaded file is valid before overwriting the existing one.Apply this diff to add basic validation:
echo "Downloading latest gitalias.txt from GitHub..." -curl -fsSL https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o "$GITALIAS_FILE" +TEMP_FILE="$(mktemp)" +curl -fsSL https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o "$TEMP_FILE" +# Basic sanity check: ensure file contains [alias] section +if grep -q '^\[alias\]' "$TEMP_FILE"; then + mv "$TEMP_FILE" "$GITALIAS_FILE" +else + echo "❌ Downloaded file does not appear to be valid gitalias.txt" + rm "$TEMP_FILE" + exit 1 +fi echo "✅ Updated gitalias.txt"home-manager/programs/lazydocker/default.nix (1)
1-4: Consider using the programs.lazydocker pattern for consistency.The current implementation directly adds the package to
home.packages, which works but lacks flexibility. For consistency with other program configurations in this repository, consider adopting the standard pattern with an enable option.Apply this diff for a more flexible configuration:
-{ pkgs, ... }: +{ pkgs, lib, config, ... }: + +with lib; + +let + cfg = config.programs.lazydocker; +in { - home.packages = [ pkgs.lazydocker ]; + options.programs.lazydocker = { + enable = mkEnableOption "lazydocker - A simple terminal UI for docker and docker-compose"; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.lazydocker ]; + }; }However, the current minimal approach is acceptable if there are no configuration options to expose.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (8)
Makefile(1 hunks)home-manager/modules/yek/default.nix(1 hunks)home-manager/programs/default.nix(2 hunks)home-manager/programs/fish/default.nix(1 hunks)home-manager/programs/git/default.nix(1 hunks)home-manager/programs/git/gitalias.txt(1 hunks)home-manager/programs/lazydocker/default.nix(1 hunks)scripts/update-gitalias.sh(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- home-manager/programs/fish/default.nix
🧰 Additional context used
📓 Path-based instructions (10)
**/*.sh
📄 CodeRabbit inference engine (CLAUDE.md)
Format all shell scripts with shfmt using 2-space indentation
**/*.sh: Shell: Use 2 spaces for indentation
Shell: Add proper shebang lines
Shell: Follow shellcheck recommendations
Shell: Document complex commands
Shell: Use consistent variable naming
Files:
scripts/update-gitalias.sh
**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Format all Nix files with nixfmt
**/*.nix: Nix: Use 2 spaces for indentation
Nix: Keep line length under 100 characters
Nix: Sort attribute sets alphabetically
Nix: Use consistent spacing around operators
Nix: Format lists and sets consistentlyFollow the Nix expression language style guide
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/modules/yek/default.nixhome-manager/programs/default.nix
**/default.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use default.nix files for module exports
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/modules/yek/default.nixhome-manager/programs/default.nix
home-manager/**
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Keep home-manager configurations under home-manager/
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/programs/git/gitalias.txthome-manager/modules/yek/default.nixhome-manager/programs/default.nix
home-manager/programs/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/programs/*/default.nix: Program configurations must be located in home-manager/programs// with configuration in default.nix
Program configurations should prefer Home Manager’s built-in modules when available
Program configurations should include all necessary dependencies
Program configurations should follow the provided template (programs..enable, package, and settings attrset)
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nix
home-manager/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Use proper indentation and formatting in Nix files
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/modules/yek/default.nixhome-manager/programs/default.nix
home-manager/programs/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
Program configurations in home-manager/programs should be organized by program name (one directory per program with a default.nix)
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/programs/default.nix
home-manager/programs/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
home-manager/programs/**/*.nix: Program configurations should include all necessary dependencies
Use home.packages for package installations in program configurations
Use programs. options provided by Home Manager when available
Files:
home-manager/programs/git/default.nixhome-manager/programs/lazydocker/default.nixhome-manager/programs/default.nix
home-manager/modules/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/modules/*/default.nix: Custom modules must be placed under home-manager/modules// and include a default.nix entry point
Custom modules should define typed options (mkOption with appropriate lib.types)
Custom modules must document all options (e.g., description fields in mkOption)
Use typed options whenever possible in modules
Follow Home Manager’s module structure (options + config with mkIf, mkEnableOption, etc.)
Files:
home-manager/modules/yek/default.nix
home-manager/modules/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/nix.mdc)
home-manager/modules/**/default.nix: Each module under home-manager/modules must provide a clear default.nix entry point
Modules must include proper option declarations (e.g., options.modules. with mkEnableOption/mkOption)
Modules must follow the Home Manager module structure (define options and gate config with mkIf cfg.enable)
Use mkOption for configurable options in custom modules
Provide explicit typing for all options (using lib.types.*)
Document all custom modules and their options
Files:
home-manager/modules/yek/default.nix
🔇 Additional comments (8)
Makefile (1)
420-420: LGTM!The empty line improves readability by adding visual separation after the completion message.
scripts/update-gitalias.sh (2)
1-4: LGTM!Proper shebang and strict error handling with
set -euo pipefailfollows best practices.
6-8: LGTM!Path construction using standard Bash idioms is correct and properly resolves the repository root and target file location.
home-manager/programs/git/gitalias.txt (2)
1-66: LGTM!The file header clearly documents the origin (GitAlias.com), usage instructions, version information (28.1.0), and license (GPL-2.0-or-later). This provides good context for maintainers.
67-1803: Vendored content with update mechanism in place.This file contains the complete GitAlias configuration (1803 lines). The accompanying
scripts/update-gitalias.shprovides a mechanism to keep it synchronized with upstream. This vendoring approach is acceptable but requires manual updates.Consider verifying that the update script is documented or integrated into CI/maintenance workflows to ensure the aliases stay current with upstream releases.
home-manager/programs/git/default.nix (1)
13-16: LGTM!The
includesconfiguration correctly uses Nix path interpolation to reference the localgitalias.txtfile. The comment documenting the update mechanism viascripts/update-gitalias.shis helpful for maintainers.home-manager/programs/default.nix (2)
18-18: LGTM!The lazydocker import follows the established pattern used for other programs like lazygit and is correctly positioned in the let bindings.
43-43: LGTM!The lazydocker export is correctly positioned in alphabetical order and matches the corresponding import in the let bindings.
Montiwa11
left a comment
There was a problem hiding this comment.
.github/workflows/auto-approve.yml
Summary
This PR integrates gitalias, a comprehensive set of Git aliases, with bash, fish, and zsh shells. The integration includes:
Changes
home-manager/programs/gitalias/gitalias.bash,gitalias.fish,gitalias.zsh)scripts/directorySummary by cubic
Integrates the GitAlias collection into bash, zsh, and fish. A Home Manager module generates shell-specific aliases at build time and injects them into shell configs, giving ~140 g*-prefixed Git shortcuts with minimal startup cost.
New Features
Migration