Repository navigation
Expand file tree
/
Copy pathinstall
More file actions
executable file
·188 lines (155 loc) · 5.07 KB
/
Copy pathinstall
File metadata and controls
executable file
·188 lines (155 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/sh
append_to_file() {
local text="$1"
local file="$2"
if ! grep -Fsq "$text" "$file"; then
printf "\n%s\n" "$text" >> "$file"
fi
}
i_use_arch_btw() {
uname -a | grep -q archlinux
}
install_dependencies() {
if i_use_arch_btw; then
sudo pacman -Sy neovim ghostty tmux gum rofi jq
else
install_dependencies_via_brew
fi
}
install_dependencies_via_brew() {
if ! which brew >/dev/null; then
echo "Brew not found- please install dependencies manually. See the README.md"
exit 1
fi
if ! which gum >/dev/null; then
echo "Gum not found, installing"
brew install gum &>/dev/null
fi
gum spin --title "Installing favourite apps" -- brew bundle --no-lock -v
echo 'What other apps templates would you like to install?'
echo '(Use space to select, press return when done)'
ADDS=$(gum choose --no-limit "personal" "work" )
for add in $ADDS; do
gum spin --title "Installing $add apps" -- brew bundle --no-lock --file=Brewfile.${add}
done
}
setup_git(){
echo "Setting up git"
git_config="[include]
path = ~/.adshell/gitconfig"
append_to_file "$git_config" $HOME/.gitconfig
ln -s ~/.adshell/gitignore_global ~/.gitignore_global &>/dev/null
}
source_custom(){
echo "Setting up custom shell"
source_cmd="source $HOME/.adshell/custom"
append_to_file "$source_cmd" $HOME/.bashrc
append_to_file "$source_cmd" $HOME/.zshrc
}
setup_asdf(){
echo "Installing ASDF"
ln -s ~/.adshell/asdf/asdfrc ~/.asdfrc &>/dev/null
ln -s ~/.adshell/asdf/default-gems ~/.default-gems &>/dev/null
ln -s ~/.adshell/asdf/default-npm-packages ~/.default-npm-packages &>/dev/null
asdf plugin add golang &> /dev/null
asdf plugin add nodejs &> /dev/null
asdf plugin add ruby &> /dev/null
asdf plugin update --all &> /dev/null
echo "Installing Languages"
V_RUBY="4.0.6"
V_GOLANG="1.26.5"
V_NODEJS="26.5.1"
gum spin --title "Installing golang" -- asdf install golang "$V_GOLANG"
asdf set -u golang "$V_GOLANG"
asdf set golang "$V_GOLANG"
gum spin --title "Installing nodejs" -- asdf install nodejs "$V_NODEJS"
asdf set -u nodejs "$V_NODEJS"
asdf set nodejs "$V_NODEJS"
gum spin --title "Installing nodejs packages" -- npm install -g $(cat ~/.default-npm-packages)
gum spin --title "Installing ruby" -- asdf install ruby "$V_RUBY"
asdf set -u ruby "$V_RUBY"
asdf set ruby "$V_RUBY"
gum spin --title "Installing gems" -- gem install $(cat ~/.default-gems)
asdf reshim &> /dev/null
}
symlink_configs(){
echo "Symlinking configs"
for config in $(ls -1 ~/.adshell/config/) ; do
echo " - $config"
ln -sf ~/.adshell/config/$config ~/.config/ &>/dev/null
done
}
setup_claude(){
echo "Linking Claude Code config"
mkdir -p ~/.claude/skills
for f in CLAUDE.md statusline-command.sh; do
ln -sf ~/.adshell/config/claude/$f ~/.claude/$f
done
# Work and home settings differ, so only overwrite the status line and add
# the adshell hooks (replacing an earlier copy of each, keeping other hooks)
settings=~/.claude/settings.json
[ -L "$settings" ] && rm "$settings"
[ -f "$settings" ] || echo '{}' > "$settings"
jq \
--arg snapshot '[ -n "$TMUX" ] && "$HOME/.adshell/bin/tmux-snapshot" autosave; true' \
--arg seen '[ -n "$TMUX" ] && "$HOME/.adshell/bin/notify" seen; true' \
'def hook(event; cmd):
.hooks[event] = [.hooks[event][]? | select(any(.hooks[]?; .command == cmd) | not)]
+ [{"hooks": [{"type": "command", "command": cmd}]}];
.statusLine = {"type": "command", "command": "~/.claude/statusline-command.sh"}
| hook("SessionStart"; $snapshot)
| hook("UserPromptSubmit"; $seen)' \
"$settings" > "$settings.tmp" \
&& mv "$settings.tmp" "$settings"
for skill in ~/.adshell/config/claude/skills/*; do
ln -sfn "$skill" ~/.claude/skills/
done
claude plugin marketplace add honeycombio/agent-skill
claude plugin install honeycomb
# Mods in config/claude/plugins are read from this folder, so edits need only /reload-plugins
claude plugin marketplace add ~/.adshell/config/claude
claude plugin install workstreams-pane@adshell
}
update_terminfo(){
if type wezterm >/dev/null; then
gum spin --title "Setting up terminfo" -- ~/.adshell/config/wezterm/install
fi
}
setup_tmux(){
if [[ -d ~/.tmux-config ]] ; then
echo "Updating tmux config"
git clone https://github.com/AdamWhittingham/tmux-config.git ~/.tmux-config &>/dev/null
ln -sf ~/.tmux-config/tmux.conf ~/.tmux.conf &>/dev/null
else
echo "Installing tmux config"
pushd ~/.tmux-config >/dev/null
git pull &>/dev/null
popd >/dev/null
fi
}
setup_vim(){
if [[ -d ~/.config/nvim ]] ; then
echo "Installing vim config"
pushd ~/.config/nvim >/dev/null
git pull &>/dev/null
popd >/dev/null
else
echo "Updating vim config"
git clone -b nvim https://github.com/AdamWhittingham/vim-config.git ~/.config/nvim &>/dev/null
cd ~/.config/nvim; ./install
fi
}
pushd $(dirname $0) > /dev/null
cleanup() {
popd > /dev/null
}
trap cleanup EXIT
install_dependencies
setup_git
symlink_configs
setup_claude
source_custom
setup_asdf
update_terminfo
setup_tmux
setup_vim