Nano Banana Pro
Agent skill for nano-banana-pro
This is a centralized dotfiles management system for macOS and Linux that provides:
Sign in to like and favorite skills
This is a centralized dotfiles management system for macOS and Linux that provides:
Bootstrap System (
script/bootstrap)
dot.* files and creates symlinks in home directory~/.dotfiles/tool/dot.config → ~/.configShell Initialization
*.sh and *.bash files via .bashrc*.sh and *.zsh files via .zshrc000- for ordering)bin/ directory automatically added to PATHTool Organization
dot.* - Configuration files to be symlinked*.sh/*.zsh - Shell scripts to be sourcedalias.sh - Tool-specific aliasespath.sh - PATH modificationsload.sh - Lazy loading/initialization.dotfiles/ ├── 000.start/ # Early initialization (runs first) ├── bin/ # Executable scripts (added to PATH) ├── [tool]/ # Tool-specific directory │ ├── dot.toolrc # Config file (symlinked to ~/.toolrc) │ ├── alias.sh # Tool aliases │ ├── path.sh # PATH setup │ └── load.sh # Initialization logic ├── system/ # System-wide settings │ └── 999.*.zsh # Late initialization (runs last) └── script/ └── bootstrap # Initial setup script
mkdir ~/.dotfiles/newtool
# Will be symlinked to ~/.newtoolrc touch ~/.dotfiles/newtool/dot.newtoolrc
⚠️ IMPORTANT: Only create
.sh/.zsh files that should run on every shell startup. For scripts that should be run manually, use bin/ directory.
cat > ~/.dotfiles/newtool/load.sh << 'EOF' #!/usr/bin/env bash # Tool initialization with installation check if command -v newtool &> /dev/null; then # Tool is installed - set up environment export NEWTOOL_HOME="$HOME/.newtool" export PATH="$NEWTOOL_HOME/bin:$PATH" # Enable completions if available if [[ -n "$ZSH_VERSION" ]]; then eval "$(newtool completions zsh)" elif [[ -n "$BASH_VERSION" ]]; then eval "$(newtool completions bash)" fi # Tool-specific aliases alias nt='newtool' else # Tool not installed - provide installation instructions echo "newtool not installed." if [[ "$(uname)" == "Darwin" ]]; then echo "Install with: brew install newtool" elif [[ -f /etc/debian_version ]]; then echo "Install with: apt-get install newtool" else echo "Visit: https://newtool.io/install" fi fi EOF
~/.dotfiles/script/bootstrap
Always check if a tool is installed before configuring:
if command -v toolname &> /dev/null; then # Configuration here else # Installation instructions fi
if [[ "$(uname)" == "Darwin" ]]; then # macOS specific elif [[ -f /etc/debian_version ]]; then # Debian/Ubuntu specific else # Generic Linux/other fi
if [[ -n "$ZSH_VERSION" ]]; then # Zsh-specific setup elif [[ -n "$BASH_VERSION" ]]; then # Bash-specific setup fi
CRITICAL: Files with
.sh or .zsh extensions are automatically sourced during shell startup. Only put files here that should run on every shell initialization.
Auto-sourced files (run at shell startup):
000-*.sh - Early initialization (Homebrew, core paths)999-*.sh - Late initialization (final PATH adjustments)alias.sh - Command aliasespath.sh - PATH modificationsload.sh - Main tool initializationenv.sh - Environment variablesManual-execution files:
.sh extension (e.g., ssh/origin-proxy)bin/ directorybin/ directoryExamples by location:
ssh/origin-proxy - SSH ProxyCommand script (no .sh extension, executable)git/setup-hooks - Git setup script (tool-specific, no .sh extension)bin/backup-dotfiles - General utility scriptExamples of what NOT to auto-source:
For heavy tools (nvm, rvm, etc.), use lazy loading:
# Instead of loading immediately, create a function nvm() { unset -f nvm source "$NVM_DIR/nvm.sh" nvm "$@" }
# Prepend (higher priority) export PATH="/new/path:$PATH" # Append (lower priority) export PATH="$PATH:/new/path"
# Check for completion file if [[ -f /path/to/completions ]]; then source /path/to/completions fi
# In tool/alias.sh alias ll='ls -la' alias gs='git status' # Conditional aliases command -v hub &> /dev/null && alias git='hub'
# See which files are being sourced and in what order find ~/.dotfiles -name "*.sh" -o -name "*.zsh" | \ grep -v "~/.dotfiles/bin/" | \ awk -F'/' '{print $NF"|"$0}' | \ sort -t"|" -k1n | \ cut -f2- -d'|'
# Dry run to see what would be linked find ~/.dotfiles -type f -name 'dot.*' | while read -r file; do echo "Would link: $file -> ~/$(basename ${file#dot.})" done
# Reload current shell configuration source ~/.zshrc # or ~/.bashrc
Rename the file to exclude
.sh/.zsh extension:
mv tool/load.sh tool/load.sh.disabled
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -delete
# Example update script brew update && brew upgrade # macOS apt update && apt upgrade # Debian/Ubuntu
command -v over which - More reliable and POSIX compliantWhen configuring remote hosts accessed via SSH, be aware of tmux behavior:
Problem: tmux "freezes" environment variables when sessions start. SSH-related variables become stale when reconnecting from different locations.
Affected Variables:
SSH_AUTH_SOCK - SSH agent forwarding socketSSH_CLIENT - Origin IP and port informationSSH_CONNECTION - Connection detailsThe
tmux-on-ssh.sh script creates a stable symlink:
# Creates: ~/.ssh/ssh_auth_sock -> /tmp/ssh-agent.12345 export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"
This ensures SSH agent forwarding works in existing tmux shells even after reconnecting from different machines.
The script updates tmux session environment on each connection:
tmux setenv -t "$SESSION_NAME" SSH_CLIENT "$SSH_CLIENT" tmux setenv -t "$SESSION_NAME" SSH_CONNECTION "$SSH_CONNECTION" tmux setenv -t "$SESSION_NAME" SSH_AUTH_SOCK "$SSH_AUTH_SOCK_LINK"
Note: This only affects NEW shells/windows in tmux, not existing ones.
Test in Fresh Shells: After changing remote configs, test in new tmux windows
Use Symlinks for Sockets: Follow the SSH agent socket pattern for other persistent resources
Refresh Functions: Create functions to manually update environment when needed:
refresh-ssh() { if [[ -n "$TMUX" ]]; then export SSH_AUTH_SOCK=$(tmux showenv SSH_AUTH_SOCK | cut -d= -f2-) echo "SSH environment refreshed" fi }
Consider Session Scope: Some configurations should be session-wide, others per-connection
When things don't work in tmux on remote hosts:
# Check if you're in tmux echo $TMUX # Check SSH agent forwarding ssh-add -l # Compare tmux env vs current shell tmux showenv | grep SSH env | grep SSH # Test reverse tunnel detection netstat -ln | grep 127.0.0.1 | grep LISTEN # Refresh environment manually source ~/.zshrc # May not fix tmux-frozen vars
.sh or .zsh extensionchmod +x file.shbash -n file.shcommand -v toolnamels -la ~/.[filename]rm ~/.[filename]~/.dotfiles/script/bootstrapecho $PATHecho $PATH | tr ':' '\n' | sort | uniq -decho $TMUXtmux showenv vs envssh-add -lSymptom: Terminal won't start, or errors on shell startup mentioning scripts
Cause: Scripts with
.sh/.zsh extensions are auto-sourced during shell startup
Emergency Access (when dotfiles break shell startup):
# Start bare-bones shell without sourcing dotfiles ssh server bash # Remote access without .bashrc ssh server sh # Even more minimal ssh server "bash --norc" # Explicit no-rc mode # Once in, fix the problem: mv ~/.dotfiles/problematic.sh ~/.dotfiles/problematic.sh.disabled
Solution:
find ~/.dotfiles -name "*.sh" -executable.sh extension: mv tool/script.sh tool/scriptmv tool/script.sh bin/tool-script.sh filesbash -x ~/.bashrc or zsh -x ~/.zshrc to see what's being sourcedFile naming rules:
.sh/.zsh = Auto-sourced at shell startupbin/Examples of problematic files:
When adding new tools or configurations:
# Add new tool mkdir ~/.dotfiles/newtool vim ~/.dotfiles/newtool/load.sh ~/.dotfiles/script/bootstrap # Reload configuration source ~/.zshrc # Check what's loaded echo $DOTFILESDIR echo $PATH | tr ':' '\n' # Debug loading bash -x ~/.bashrc 2>&1 | less