Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ Always execute tasks in this order:
## Git

- Do not ever commit to the default, `main`, or `master` Git branches. Always ask if a new branch should be created instead.
- Always prefix git branch names with "emmercm/".

## Superpowers

- Do not ever commit specs, plans, or any other documents produced by the "superpowers" plugin.

## Writing style

- Use American English spelling in comments and documentation
22 changes: 21 additions & 1 deletion .everythingrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Bash: .bash_profile (macOS default) -> .profile (Ubuntu default) -> .bashrc -> .everythingrc
# zsh: .zshrc (always executed) -> .everythingrc

SHELL=$(which "$(ps -o comm= $$ | sed 's/^-*//')")
: "${SHELL:=$(which "$(ps -o comm= $$ | sed 's/^-*//')" 2>/dev/null)}"
export SHELL


##### Bash #####
Expand All @@ -27,6 +28,25 @@ __bashrc_misc() {
return 1
}

# @param {string} $1 Name of the throttle key
# @param {number} $2 Cooldown duration in seconds
throttle() {
local state_dir="${XDG_STATE_HOME:-${HOME}/.local/state}/throttle"
local state_file="${state_dir}/$1"
local now
now=$(date +%s)
local last_run=0
if [[ -f "${state_file}" ]]; then
last_run=$(cat "${state_file}" 2>/dev/null || echo 0)
fi
if (( now - last_run > $2 )); then
mkdir -p "${state_dir}"
echo "${now}" > "${state_file}"
return 0
fi
return 1
}

# Don't be a savage
if command -v nano &> /dev/null; then
EDITOR=$(pinpoint nano)
Expand Down
5 changes: 3 additions & 2 deletions dotpack/.20_java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __java_setup() {
fi
if [[ "${JAVA_HOME:-}" == "" ]]; then
while read -r DIR; do
[[ -z "${DIR}" ]] && continue
export JAVA_HOME="${DIR}"
done <<< "$(find /Library/Java/JavaVirtualMachines/*/Contents -maxdepth 1 -type d -name Home 2> /dev/null | sort --version-sort)"
fi
Expand All @@ -22,8 +23,8 @@ __java_lazy_install() {
if ! command -v flyway &> /dev/null && command -v brew &> /dev/null; then
flyway() {
brew install flyway
unset -f "$0"
$0 "$@"
unset -f flyway
flyway "$@"
}
fi
}
Expand Down
4 changes: 2 additions & 2 deletions dotpack/.20_nodejs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ __nodejs_bun() {
# Lazy-load shell completions
if [[ -d "$HOME/.bun/_bun" ]]; then
bun() {
unset -f "$0"
unset -f bun
source "$HOME/.bun/_bun"
$0 "$@"
bun "$@"
}
fi
}
Expand Down
1 change: 1 addition & 0 deletions dotpack/.20_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

__python_setup() {
while read -r DIR; do
[[ -z "${DIR}" ]] && continue
export PATH="${DIR}:${PATH}"
done <<< "$(find ~/Library/Python/* -maxdepth 1 -type d -name bin 2> /dev/null)"
}
Expand Down
4 changes: 2 additions & 2 deletions dotpack/.20_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ __ruby_chruby() {
# Lazy load chruby
if [[ -d "${HOMEBREW_PREFIX}/opt/chruby/share/chruby" ]]; then
chruby() {
unset -f "$0"
unset -f chruby
source "${HOMEBREW_PREFIX}/opt/chruby/share/chruby/chruby.sh"
source "${HOMEBREW_PREFIX}/opt/chruby/share/chruby/auto.sh"
$0 "$@"
chruby "$@"
}
fi

Expand Down
12 changes: 6 additions & 6 deletions dotpack/.30_aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ __aws_completions() {

if command -v aws &> /dev/null && command -v aws_completer &> /dev/null; then
aws() {
unset -f "$0"
unset -f aws
# https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-completion.html#cli-command-completion-linux
complete -C '/usr/local/bin/aws_completer' aws
$0 "$@"
aws "$@"
}
fi
}
Expand All @@ -17,16 +17,16 @@ __aws_lazy_install() {
if ! command -v aws &> /dev/null && command -v brew &> /dev/null; then
aws() {
brew install awscli
unset -f "$0"
$0 "$@"
unset -f aws
aws "$@"
}
fi

if ! command -v awslocal &> /dev/null && command -v brew &> /dev/null; then
awslocal() {
pip3 install awscli-local
unset -f "$0"
$0 "$@"
unset -f awslocal
awslocal "$@"
}
fi
}
Expand Down
49 changes: 40 additions & 9 deletions dotpack/.30_claude.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
##### https://code.claude.com/docs/en/overview

export PATH="$HOME/.local/bin:$PATH"

export RTK_TELEMETRY_DISABLED=1

__claude_update() {
# Auto-update Claude once a day
if [[ "${1:-}" != "update" ]] && throttle "CLAUDE_AUTO_UPDATE_SECS" 86400; then
command claude update
fi

# Auto-update Claude marketplaces once a week
if throttle "CLAUDE_AUTO_UPDATE_PLUGINS_SECS" 604800; then
command claude plugin marketplace list --json | jq -r '.[].name' | xargs -I {} command claude plugin marketplace update {}
fi
}

__claude_auto_update() {
if command -v claude &> /dev/null; then
claude() {
if [[ "${1:-}" != "update" ]]; then
command claude update
# Commands to skip updating before
if [[ " $* " = *" -h "* || " $* " == *" --help "* || " $* " == *" -p "* || " $* " == *" --print "* ]]; then
command claude "$@"
return $?
fi

#if [[ " $@ " != *" --resume "* && " $@ " != *" --session-id "* ]]; then
# command claude "$@" --continue
#else
# command claude "$@"
#fi
__claude_update

command claude "$@"
return $?
}
fi
}
Expand All @@ -26,9 +39,27 @@ __claude_lazy_install() {
if ! command -v claude &> /dev/null; then
claude() {
curl -fsSL https://claude.ai/install.sh | bash
unset -f "$0"
$0 "$@"
unset -f claude
claude "$@"
}
fi
}
__claude_lazy_install


__agent_deck_auto_update() {
if command -v agent-deck &> /dev/null; then
agent-deck() {
__claude_update

# Auto-update Claude once a day
if [[ "${1:-}" != "update" ]] && throttle "AGENT_DECK_AUTO_UPDATE_SECS" 86400; then
yes | command agent-deck update
fi

command agent-deck "$@"
return $?
}
fi
}
__agent_deck_auto_update
8 changes: 4 additions & 4 deletions dotpack/.30_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ __docker_lazy_install() {
if ! command -v dive &> /dev/null && command -v brew &> /dev/null; then
dive() {
brew install dive
unset -f "$0"
$0 "$@"
unset -f dive
dive "$@"
}
fi

if ! command -v skopeo &> /dev/null && command -v brew &> /dev/null; then
skopeo() {
brew install skopeo
unset -f "$0"
$0 "$@"
unset -f skopeo
skopeo "$@"
}
fi
}
Expand Down
2 changes: 1 addition & 1 deletion dotpack/.30_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __git_funcs() {
local origin_old
origin_old="$(git remote get-url origin)"
local origin_new
origin_new="${origin_old/https:\/\/github.co\//git@github.com:}"
origin_new="${origin_old/https:\/\/github.com\//git@github.com:}"
if [[ "${origin_new}" != "${origin_old}" && "${origin_new}" != "" ]]; then
echo "Changing $(pwd) remote origin to: ${origin_new}"
git remote set-url origin "${origin_new}"
Expand Down
12 changes: 6 additions & 6 deletions dotpack/.30_kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ __kube_lazy_install() {
if ! command -v k9s &> /dev/null && command -v brew &> /dev/null; then
k9s() {
brew install k9s
unset -f "$0"
$0 "$@"
unset -f k9s
k9s "$@"
}
fi

if ! command -v kubectl &> /dev/null && command -v brew &> /dev/null; then
# Note: Docker Desktop provides kubectl, this shouldn't be necessary
kubectl() {
brew install kubectl
unset -f "$0"
$0 "$@"
unset -f kubectl
kubectl "$@"
}
fi

if ! command -v stern &> /dev/null && command -v brew &> /dev/null; then
stern() {
brew install stern
unset -f "$0"
$0 "$@"
unset -f stern
stern "$@"
}
fi
}
Expand Down
1 change: 1 addition & 0 deletions dotpack/.30_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ __mysql_setup() {
# Set path environment variables
if command -v brew &> /dev/null; then
while read -r DIR; do
[[ -z "${DIR}" ]] && continue
if [[ -d "${DIR}/bin" ]]; then
export PATH="${DIR}/bin:${PATH}"
fi
Expand Down
16 changes: 8 additions & 8 deletions dotpack/.30_temporal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ __temporal_completions() {

if command -v tctl &> /dev/null; then
tctl() {
unset -f "$0"
unset -f tctl
# shellcheck disable=SC1090
source <(tctl completion "$(basename "${SHELL}")")
$0 "$@"
tctl "$@"
}

temporal() {
unset -f "$0"
unset -f temporal
# shellcheck disable=SC1090
source <(temporal completion "$(basename "${SHELL}")")
$0 "$@"
temporal "$@"
}
fi
}
Expand All @@ -36,16 +36,16 @@ __temporal_lazy_install() {
if ! command -v tctl &> /dev/null && command -v brew &> /dev/null; then
tctl() {
brew install tctl
unset -f "$0"
$0 "$@"
unset -f tctl
tctl "$@"
}
fi

if ! command -v temporal &> /dev/null && command -v brew &> /dev/null; then
temporal() {
brew install temporal
unset -f "$0"
$0 "$@"
unset -f temporal
temporal "$@"
}
fi
}
Expand Down
8 changes: 4 additions & 4 deletions dotpack/.30_terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ __terraform_install() {
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
fi
unset -f "$0"
$0 "$@"
unset -f terraform
terraform "$@"
}
}
__terraform_install
Expand All @@ -29,8 +29,8 @@ __tflint_install() {
docker run --rm --volume "$(pwd):/data" --tty "ghcr.io/terraform-linters/tflint" "$@"
return $?
fi
unset -f "$0"
$0 "$@"
unset -f tflint
tflint "$@"
}
}
__tflint_install
12 changes: 6 additions & 6 deletions dotpack/.30_vitess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
__vitess_completions() {
if command -v pscale &> /dev/null; then
pscale() {
unset -f "$0"
unset -f pscale
# https://planetscale.com/docs/cli/completion
# shellcheck disable=SC1090
source <(pscale completion "$(basename "${SHELL}")")
$0 "$@"
pscale "$@"
}
fi
}
Expand All @@ -20,15 +20,15 @@ __vitess_lazy_install() {
if ! command -v pscale &> /dev/null && command -v brew &> /dev/null; then
pscale() {
brew install planetscale/tap/pscale
unset -f "$0"
$0 "$@"
unset -f pscale
pscale "$@"
}
fi
if ! command -v mysql &> /dev/null && command -v brew &> /dev/null; then
mysql() {
brew install mysql-client
unset -f "$0"
$0 "$@"
unset -f mysql
mysql "$@"
}
fi
}
Expand Down
Loading
Loading