Commit 1718675
fix(zsh): remove NVM lazy loading for agent/CLI reliability
Replace lazy loading pattern with traditional NVM initialization to fix
failures in non-interactive shells and agent/automation contexts.
Problem:
- NVM lazy loading (v2.0) used wrapper functions that only work in
interactive shells
- AI agents, scripts, and tools using `bash -c "npm install"` failed
because wrapper functions weren't defined in non-interactive contexts
- Commands via absolute paths bypassed wrappers but couldn't find node bins
Solution:
- Remove lazy-load wrapper functions (_lazy_load_nvm, nvm(), node(), etc)
- Restore traditional NVM initialization (source nvm.sh on shell startup)
- Accept ~200-400ms startup penalty in exchange for reliability
Trade-off:
- Shell startup is slower (~200-400ms) but node/npm work everywhere
- Users needing fast startup can re-enable lazy loading in
~/.franklin.local.zsh
Fixes: Node.js tools now work reliably in:
- Non-interactive shells (bash -c, zsh -c)
- Agent-spawned subprocesses
- CI/CD pipelines
- Automation scripts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 96b1af0 commit 1718675
File tree
4 files changed
+28
-35
lines changed- franklin
- templates
4 files changed
+28
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
10 | 30 | | |
11 | 31 | | |
12 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 216 | + | |
| 217 | + | |
220 | 218 | | |
| 219 | + | |
| 220 | + | |
221 | 221 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 222 | + | |
| 223 | + | |
251 | 224 | | |
252 | 225 | | |
253 | 226 | | |
| |||
0 commit comments