diff --git a/.gitignore b/.gitignore index e4e5f6c..6c68c78 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*~ \ No newline at end of file +*~ +__pycache__/ \ No newline at end of file diff --git a/.p10k.zsh b/.p10k.zsh index e0814d5..f269978 100644 --- a/.p10k.zsh +++ b/.p10k.zsh @@ -1598,7 +1598,7 @@ # - verbose: Enable instant prompt and print a warning when detecting console output during # zsh initialization. Choose this if you've never tried instant prompt, haven't # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose + typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload diff --git a/.zshrc b/.zshrc index 042e613..bec793d 100644 --- a/.zshrc +++ b/.zshrc @@ -15,8 +15,7 @@ bindkey -e # export PATH=$HOME/bin:/usr/local/bin:$PATH export PATH=$PATH:$HOME/.local/bin -export PATH=$PATH:$HOME/.local/opt/node/bin -export PATH="$HOME/.poetry/bin:$PATH" +export PATH=$PATH:$HOME/.yarn/bin # Path to your oh-my-zsh installation. export ZSH="/home/feanil/.oh-my-zsh" @@ -80,25 +79,34 @@ HYPHEN_INSENSITIVE="true" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder +# Automatically find and source virtualenvironments when entering a directory. +PYTHON_AUTO_VRUN=true +PYTHON_VENV_NAMES=".venv venv" + # Which plugins would you like to load? # Standard plugins can be found in ~/.oh-my-zsh/plugins/* # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( - cargo + brew + fzf git + kitty + nvm + python tmux - virtualenvwrapper - fzf - pass + uv ) +zstyle ':omz:plugins:nvm' autoload yes + ZSH_TMUX_AUTOSTART=true -export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source $ZSH/oh-my-zsh.sh +export FZF_CTRL_T_COMMAND='rg --files --hidden --glob "!.git/*" 2>/dev/null' + # User configuration # export MANPATH="/usr/local/man:$MANPATH" @@ -115,9 +123,11 @@ export LANG=en_US.UTF-8 export EDITOR=nvim export LESS=-FRX - +alias cat=batcat alias vim=nvim alias open=xdg-open +alias copy=xclip -selection clipboard +alias rg="rg --type-add 'in:*.in'" # Compilation flags # export ARCHFLAGS="-arch x86_64" @@ -133,7 +143,21 @@ alias open=xdg-open # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh -alias cat='echo "Try \`bat\` Instead"' export MCFLY_INTERFACE_VIEW=BOTTOM -export MCFLY_FUZZY=3 +export MCFLY_FUZZY=2 eval "$(mcfly init zsh)" + +# https://github.com/nvm-sh/nvm#installing-and-updating +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +export PATH="/home/feanil/work/src/openedx/edx-platform:$PATH" + +[[ -f ~/src/dotfiles/config/shellrc/gittree.sh ]] && source ~/src/dotfiles/config/shellrc/gittree.sh + +[[ -f ~/src/feanil/dotfiles/config/shellrc/claude_sandbox/claude-sandbox.sh ]] && source ~/src/feanil/dotfiles/config/shellrc/claude_sandbox/claude-sandbox.sh + +export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig" + +TUTOR_ROOT=/home/feanil/src/tutor/.venv/bin/tutor-main +TUTOR_PLUGINS_ROOT=/home/feanil/src/tutor/.venv/bin/tutor-main-plugins diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md index 63b948f..9029ac2 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,118 @@ -Install NeoVim -Copy nvimrc to ~/.nvimrc -Copy nvim directory to ~/.nvim +Git +=== -Open Vim and run `:PlugInstall` +Install git +Install github cli - https://github.com/cli/cli/blob/trunk/docs/install_linux.md -For getting the Yubikey working, +``` +git clone git@github.com/feanil/dotfiles +ln -sf src/feanil/dotfiles/gitconfig.core ~/.gitconfig +``` + +Update as necessary for work and personal paths. + +Setup ZSH and oh-my-zsh +======================= + +Install zsh - https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH + +fzf + +Follow the instructions to install oh-my-zsh: https://ohmyz.sh/#install + +Install powerlevel10k theme https://github.com/romkatv/powerlevel10k#oh-my-zsh + +``` +ln -sf ~/src/feanil/dotfiles/.p10k.zsh ~/.p10k.zsh +ln -sf ~/src/feanil/dotfiles/.zshrc ~/.zshrc +``` + + +tmux +==== + +Install tmux + +``` +ln -sf ~/src/feanil/dotfiles/tmux.conf ~/.tmux.conf +``` + +Claude Code +=========== + +Global instructions for Claude Code live in `claude/CLAUDE.md` and global settings +(permission allowlist, model, plugins) live in `claude/settings.json`. Symlink them +into `~/.claude/` so Claude picks them up across all projects: + +``` +ln -sf ~/src/feanil/dotfiles/claude/CLAUDE.md ~/.claude/CLAUDE.md +ln -sf ~/src/feanil/dotfiles/claude/settings.json ~/.claude/settings.json +``` + +`claude/hooks/gh-readonly.py` is a PreToolUse hook that auto-approves read-only +`gh api` calls (registered in `claude/settings.json`). Tests live alongside it: + +``` +cd claude/hooks && uv run test_gh_readonly.py +``` + +`config/shellrc/claude_sandbox/` is a credential-isolated Docker sandbox for +running Claude Code; see its own `CLAUDE.md` for details. + +`CLAUDE.md` at the repo root is a symlink to this README, so project-level +guidance for Claude Code stays in sync with what humans read. + +Install HomeBrew +================ + +https://brew.sh/ + +``` +brew install mcfly delta uv +``` + +Setup Python and Virtualenvwrapper +================================== + +Install uv - https://github.com/astral-sh/uv + +Setup python versions + + +mcfly +===== + +- `ctrl-r` replacement - https://github.com/cantino/mcfly + +Instructions - https://github.com/cantino/mcfly#installing-using-our-install-script + +Release Page - https://github.com/cantino/mcfly/releases +- Get the musl version which will be fully statically linked. + +delta +----- + +- Diffing Tools for git and other diffing. + +Release Page - https://github.com/dandavison/delta/releases +- Get the musl version which will be fully statically linked. + +VIM +=== + +Install NeoVim (stable) and set up LazyVim: https://www.lazyvim.org/installation + + +For getting the Yubikey working +=============================== Copy the .gnupg directory from a computere where its working. Then install these relevant debian things: https://github.com/drduh/YubiKey-Guide#debian-and-ubuntu + + Other tools to install ====================== A big list of options: https://github.com/ibraheemdev/modern-Unix @@ -24,16 +126,6 @@ bat Releases Page - https://github.com/sharkdp/bat/releases - Get the musl version which will be fully statically linked. -mcfly ------ - -- `ctrl-r` replacement - https://github.com/cantino/mcfly - -Instructions - https://github.com/cantino/mcfly#installing-using-our-install-script - -Release Page - https://github.com/cantino/mcfly/releases -- Get the musl version which will be fully statically linked. - exa --- @@ -49,10 +141,3 @@ jq `sudo apt install jq` -delta ------ - -- Diffing Tools for git and other diffing. - -Release Page - https://github.com/dandavison/delta/releases -- Get the musl version which will be fully statically linked. diff --git a/claude/CLAUDE.md b/claude/CLAUDE.md new file mode 100644 index 0000000..b4a35fa --- /dev/null +++ b/claude/CLAUDE.md @@ -0,0 +1,153 @@ +For multi-session projects, context is tracked via `CLAUDE.md` files in the project +directory. + +PRIME DIRECTIVE: Run multiple commands rather than joining things with `&&` + +## General Development Notes + +- Prefer many smaller commits to one big commit for making changes. The goal is + to have smaller commits that are easier to review individually rather than one + large hard to review commit. +- When debugging issues (CI failures, deployment errors, etc.), reproduce the + problem locally before attempting a fix. This confirms the root cause and + verifies the fix actually works. Don't assume a fix is correct just because + it looks right. +- When a CI check should have caught an issue but didn't, investigate why. The + CI configuration itself may have a bug (wrong settings, missing test coverage, + etc.) that allowed the issue through. +- Where possible use tools such as Read and Search before bash. +- Avoid combining bash commands with && or || unless it's absolutely necessary. +- Always run `cd ` commands separately from other commands. + - The bash tools preserves the folder you're in between tool calls. + +## Git Workflow Preferences + +- Prefer fixup commits (`git commit --fixup=`) for related changes rather than + creating separate commits. +- Claude may run interactive rebases (autosquash, reword, etc.) using the + non-interactive editor technique below, but must first explain the plan + (which commits move, what messages change, what scripts will run) and wait + for explicit confirmation before invoking `git rebase`. After confirmation, + also force-push needs the usual force-push confirmation. + - `GIT_SEQUENCE_EDITOR` runs against the rebase todo file. E.g. + `GIT_SEQUENCE_EDITOR='sed -i "1s/^pick/reword/"'` flips the first commit + from `pick` to `reword`. + - `GIT_EDITOR` runs against each commit-msg buffer. Point it at a small + script that overwrites `$1` (the buffer path) with a prepared message + file, e.g. `#!/bin/bash\ncp /tmp/new_msg.txt "$1"`. + - Pass `-i` to `git rebase` — without it, `--autosquash` is silently ignored + and `GIT_SEQUENCE_EDITOR` is not invoked. + - Clean up the temp scripts after the rebase; an orphaned `GIT_EDITOR` + script could clobber a later commit's message buffer if reused. +- `git add -i` and `git add -p` both need an interactive TTY — skip both. + Stage files by explicit pathspec (`git add path/to/file`). For partial-file + staging, edit the file directly so `git add ` stages only what you + intend, or write a patch and apply it with `git apply --cached`. +- When running git commands in a repo, `cd` into the repo directory first rather than + using `git -C ` on every invocation. +- Include links to relevant source code, documentation, or version comparisons in + commit messages when explaining why changes were made. + +## Commit Message Format + +Follow [OEP-51 conventional commits](https://docs.openedx.org/projects/openedx-proposals/en/latest/best-practices/oep-0051-bp-conventional-commits.html) +for all repos, not just openedx. Format: `: \n\n\n\n