Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit b703e1c

Browse files
committed
minor updates
1 parent 400597a commit b703e1c

4 files changed

Lines changed: 143 additions & 12 deletions

File tree

.gitignoreglobal

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ DEVELOPMENT_PLAN.md
5555
**/.repomix
5656

5757
**/.bevel
58+
59+
.claude/settings.local.json
60+
.gemini/settings.local.json
61+
62+
# Ignore CLAUDE.md files in root of git directories (excluding sammcj and mantel)
63+
/Users/samm/git/*/CLAUDE.md
64+
!/Users/samm/git/sammcj/*/CLAUDE.md
65+
!/Users/samm/git/mantel/*/CLAUDE.md

4-aliases.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ alias updatedb='sudo /usr/libexec/locate.updatedb'
9090
alias netwatch='lsof -i'
9191
alias flushdns='sudo discoveryutil udnsflushcaches'
9292
alias httpserver='sudo python3 -m http.server 80'
93-
alias cc='colorize.py'
93+
alias cc='claude --dangerously-skip-permissions'
9494
alias rmid="ssh-keygen -R"
9595
# alias aria="aria2c -s 5 -j 5 -x 5 -c --enable-http-pipelining=true --http-accept-gzip=true --max-connection-per-server=10 --content-disposition-default-utf8=true"
9696
# alias a=aria
@@ -205,6 +205,7 @@ alias sync_ollama_models="${HOME}/git/sammcj/scripts/ollama/export_ollama_model.
205205
alias copilot="gh copilot suggest -t shell"
206206
alias copilot-explain="gh copilot explain"
207207
alias '??'='copilot'
208+
alias '???'='copilot-comments'
208209
alias wtf='copilot'
209210
alias l="OLLAMA_HOST=http://localhost:11434 gollama -l"
210211
alias i="ingest"

5-exports.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export ENABLE_ANALYTICS=0
6969
export CLAUDE_CODE_ENABLE_TELEMETRY=0
7070
export DISABLE_TELEMETRY=1
7171
export DISABLE_ANALYTICS=1
72+
export POSTHOG_API_ENDPOINT=""
7273

7374
# OpenCode
7475
export LOCAL_ENDPOINT=https://ollama.icu.lol/v1

9-functions.rc

Lines changed: 132 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,23 +1106,35 @@ function ba() {
11061106
local log_file="${HOME}/.ba.log"
11071107
local error_log="${HOME}/.ba.errors.log"
11081108

1109+
if [[ -f "${log_file}" ]]; then
1110+
mv -f "${log_file}" "${log_file}.1"
1111+
fi
1112+
touch "$log_file"
1113+
11091114
# link all ollama models to lm-studio
11101115
llamalink >>"${log_file}" 2>&1 &
11111116

11121117
# update vscode packages
11131118
code --update-extensions >>"${log_file}" 2>&1 &
1119+
gh extension upgrade --all >>"${log_file}" 2>&1 &
11141120

11151121
# Update Claude Code
11161122
claude update >>"${log_file}" 2>&1 &
11171123

1118-
npm install -g --upgrade @qwen-code/qwen-code@latest @google/gemini-cli
1119-
uv tool install claude-monitor -U
1124+
# Update global npm packages (which is just claude code, gemini-cli, claude-code-router, and qwen-code)
1125+
npm-check-updates -g -u
1126+
npm install -g --upgrade @qwen-code/qwen-code@latest @google/gemini-cli \
1127+
@musistudio/claude-code-router @anthropic-ai/claude-code@latest ccusage \
1128+
ccstatusline@latest ccexp@latest vibe-kanban@latest >>"${log_file}" 2>&1 &
1129+
1130+
# claudekit@latest
1131+
1132+
uv tool install claude-monitor -U >>"${log_file}" 2>&1 &
1133+
uv tool install claude-code-tools >>"${log_file}" 2>&1 &
11201134

11211135
# update homebrew and all apps
11221136
brew update >>"${error_log}" 2>&1
11231137

1124-
mv "${log_file}" "${log_file}.1"
1125-
11261138
echo "Upgrading shell and packages in the background, tail -f ${log_file} for details."
11271139

11281140
touch "${log_file}" "${error_log}"
@@ -1200,7 +1212,6 @@ function __upgrade_packages() {
12001212

12011213
pip3 install -U pip
12021214
npm i -g npm-check-updates
1203-
npm i -g @google/gemini-cli
12041215
\ncu --global
12051216
echo | vim +PluginInstall +qall &>/dev/null
12061217

@@ -1683,27 +1694,32 @@ function aws-sso() {
16831694
return 1
16841695
fi
16851696
aws sso login --profile "$1"
1686-
eval "$(aws configure export-credentials --format env --profile "$1")"
1697+
1698+
# Set the profile and region in current shell
16871699
export AWS_PROFILE="$1"
16881700
export AWS_REGION=ap-southeast-2
16891701

1702+
# Get the credentials using AWS CLI and set them in the current shell
1703+
eval "$(aws configure export-credentials --format env --profile "$1")"
1704+
16901705
# Create a temporary file only user can access for short-lived, rotating credentials
16911706
mkdir -p "${HOME}/.tmp"
16921707
local aws_creds_file
16931708
aws_creds_file="${HOME}/.tmp/awltmp"
16941709
rm -f "$aws_creds_file"
1695-
touch "$aws_creds_file"
1696-
chmod 600 "$aws_creds_file"
16971710

1698-
# Export AWS credentials to the temporary file
1711+
# Write the current environment variables to the file
16991712
cat > "$aws_creds_file" << EOF
17001713
export AWS_SESSION_TOKEN='$AWS_SESSION_TOKEN'
17011714
export AWS_ACCESS_KEY_ID='$AWS_ACCESS_KEY_ID'
17021715
export AWS_SECRET_ACCESS_KEY='$AWS_SECRET_ACCESS_KEY'
1703-
export AWS_PROFILE='$AWS_PROFILE'
1704-
export AWS_REGION='$AWS_REGION'
1716+
export AWS_PROFILE='$1'
1717+
export AWS_REGION='ap-southeast-2'
17051718
EOF
17061719

1720+
chmod 600 "$aws_creds_file"
1721+
1722+
echo "AWS credentials exported to $aws_creds_file"
17071723
echo "Run the following in other terminals to source the credentials:"
17081724
echo "source $aws_creds_file"
17091725
}
@@ -1801,3 +1817,108 @@ cd() {
18011817
builtin cd "$@"
18021818
fi
18031819
}
1820+
1821+
# Function to list and display comments made by GitHub Copilot on the current PR
1822+
copilot-comments() {
1823+
local -r current_branch="$(git branch --show-current 2>/dev/null)" || {
1824+
printf "Error: Not in a git repository or no current branch\n" >&2
1825+
return 1
1826+
}
1827+
1828+
local base_branch pr_num general_reviews inline_comments all_prs
1829+
1830+
# Use printf instead of echo for better portability and consistency
1831+
base_branch="$(gh repo view --json defaultBranch --jq '.defaultBranch.name' 2>/dev/null)" || base_branch="main"
1832+
pr_num="$(gh pr list --head "${current_branch}" --base "${base_branch}" --json number --jq '.[0].number' 2>/dev/null)" || pr_num=""
1833+
1834+
if [[ -z "${pr_num}" || "${pr_num}" == "null" ]]; then
1835+
printf "No open PR found for current branch %s\n" "${current_branch}"
1836+
1837+
if all_prs="$(gh pr list --base "${base_branch}" --json number,title,headRefName --jq '.[] | "PR #\(.number): \(.title) (branch: \(.headRefName))"' 2>/dev/null)" && [[ -n "${all_prs}" ]]; then
1838+
printf "All open PRs to %s:\n%s\n" "${base_branch}" "${all_prs}"
1839+
fi
1840+
return 1
1841+
fi
1842+
1843+
# Helper function to reduce code duplication
1844+
_fetch_copilot_data() {
1845+
local -r endpoint="$1"
1846+
local -r jq_filter="$2"
1847+
gh api "repos/:owner/:repo/pulls/${pr_num}/${endpoint}" 2>/dev/null | jq -r "${jq_filter}" 2>/dev/null || true
1848+
}
1849+
1850+
general_reviews="$(_fetch_copilot_data "reviews" '.[] | select(.user.login == "Copilot") | .body')"
1851+
inline_comments="$(_fetch_copilot_data "comments" '.[] | select(.user.login == "Copilot") | "\(.path) (line \(.line))\n\(.body)\n" + ("=" * 50) + "\n"')"
1852+
1853+
if [[ -n "${general_reviews}" || -n "${inline_comments}" ]]; then
1854+
printf "I submitted the changes to Github Copilot to review, keep in mind that Github Copilot doesn't use a very strong AI model so it may not be accurate.\n"
1855+
1856+
printf "🤖 GitHub Copilot comments on PR #%s:\n" "${pr_num}"
1857+
1858+
if [[ -n "${general_reviews}" ]]; then
1859+
printf "## Copilot review comments\n"
1860+
printf "%s\n" "${general_reviews}\n------\n"
1861+
fi
1862+
1863+
if [[ -n "${inline_comments}" ]]; then
1864+
printf "\n## Copilot inline comments\n"
1865+
printf "%s\n" "${inline_comments}"
1866+
fi
1867+
1868+
printf "⚠️ Be mindful that GitHub Copilot's comments may be inaccurate. Ignore any invalid or out of context comments. Please review them carefully before applying any changes. Discuss recommendations with me if the path forward is unclear.\n"
1869+
fi
1870+
}
1871+
1872+
# Quick navigation to git repositories, optionally taking a subdirectory as an argument
1873+
_git_nav() {
1874+
local cmd="$1"
1875+
shift # Remove the command from arguments
1876+
local base_dir
1877+
1878+
case "$cmd" in
1879+
"gs")
1880+
base_dir="$HOME/git/sammcj"
1881+
;;
1882+
"gm")
1883+
base_dir="$HOME/git/mantel"
1884+
;;
1885+
"g")
1886+
base_dir="$HOME/git"
1887+
;;
1888+
*)
1889+
echo "Unknown git navigation command: $cmd"
1890+
return 1
1891+
;;
1892+
esac
1893+
1894+
if [[ $# -eq 0 ]]; then
1895+
cd "$base_dir"
1896+
else
1897+
local target_dir="$base_dir/$1"
1898+
if [[ -d "$target_dir" ]]; then
1899+
cd "$target_dir"
1900+
else
1901+
cd "$base_dir"
1902+
echo "Directory '$1' not found in $base_dir"
1903+
fi
1904+
fi
1905+
}
1906+
# Use the git quick navigation function
1907+
gs() { _git_nav "gs" "$@"; }
1908+
gm() { _git_nav "gm" "$@"; }
1909+
g() { _git_nav "g" "$@"; }
1910+
1911+
1912+
fcs() {
1913+
# https://github.com/pchalasani/claude-code-tools#-find-claude-session
1914+
# fcs "keyword1,keyword2,keyword3" # Search in current project
1915+
# fcs "keywords" -g Search across all Claude projects
1916+
1917+
# Check if user is asking for help
1918+
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
1919+
find-claude-session --help
1920+
return
1921+
fi
1922+
# Run find-claude-session in shell mode and evaluate the output
1923+
eval "$(find-claude-session --shell "$@" | sed '/^$/d')"
1924+
}

0 commit comments

Comments
 (0)