Commit 92f4e4e
fix: clone external zsh plugins referenced by dotfiles .zshrc (#122)
* fix: clone external zsh plugins referenced by dotfiles .zshrc
When a remote config carries no shell block (rc.Shell == nil) but does set a
dotfiles_repo, the shell setup comes entirely from the stowed .zshrc. Its
plugins=() list — e.g. zsh-autosuggestions, fast-syntax-highlighting,
zsh-autocomplete — never flowed through RestoreFromSnapshot, so the external
plugins it names were never git-cloned into $ZSH_CUSTOM/plugins. oh-my-zsh
then logged "plugin '...' not found" on every shell startup.
Add shell.CloneExternalPluginsFromZshrc: after dotfiles are linked, read the
effective ~/.zshrc, extract plugins=(), and clone any catalog (external)
plugins not already present. Built-in/unknown names are left untouched and a
failed clone stays non-fatal, matching cloneExternalPlugins. No-op when
oh-my-zsh isn't installed or .zshrc is absent, and dry-run safe.
This is the path `openboot install <slug>` takes for configs like
fullstackjam, where #121's plan-level fix could not help because there was no
shell block to carry through.
* fix: guard plugin name against path traversal before clone
gosec G703 flagged cloneExternalPlugins now that plugin names can originate
from a user-authored .zshrc (via CloneExternalPluginsFromZshrc) and flow into
filepath.Join. Add an explicit path-segment guard rejecting names that aren't
a plain single segment, and annotate the os.Stat with a justified nolint. A
name only reaches here after matching the curated catalog, so this guard only
ever rejects malicious input — it's defense in depth, not a behavior change.
* fix: treat unreadable .zshrc as non-fatal in plugin clone
An unreadable .zshrc now warns and returns nil instead of aborting the
dotfiles step. By the time CloneExternalPluginsFromZshrc runs the dotfiles
are already cloned and linked, and plugin setup is best-effort everywhere
else (cloneExternalPlugins warns and continues on a failed clone), so a
marginal read error should not fail the whole step. Add a test covering the
non-NotExist read-error path.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9549bff commit 92f4e4e
3 files changed
Lines changed: 138 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 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 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
137 | 209 | | |
138 | 210 | | |
139 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
299 | 310 | | |
| 311 | + | |
300 | 312 | | |
301 | 313 | | |
302 | 314 | | |
| |||
317 | 329 | | |
318 | 330 | | |
319 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
320 | 376 | | |
321 | 377 | | |
322 | 378 | | |
| |||
0 commit comments