Commit 00e2fa2
committed
fix(env): stop claiming ~/.env; read from ~/.config/PAI/.env instead
PAI currently owns the user's ~/.env file via a symlink created during
install. This is a home-directory namespace grab: ~/.env is a conventional,
user-owned file that many shells and tools look for. If the user installs
any other tool that expects to read ~/.env, it either collides with PAI's
secrets or is silently overwritten on the next PAI install. This is the
wrong shape.
The cause is that VoiceServer hardcodes `join(homedir(), '.env')` as the
only place it looks for ELEVENLABS_API_KEY. The installer created the
~/.env symlink to make that hardcoded read resolve to the real secrets
file at ~/.config/PAI/.env (which is already the XDG-compliant, correct
canonical location).
This change:
- VoiceServer/server.ts: load ~/.config/PAI/.env first (XDG canonical
location), then optionally overlay from ~/.env if the user has chosen
to put PAI-relevant keys there. Values in ~/.env win on key collisions,
preserving the "explicit user override" mental model. The error message
when ELEVENLABS_API_KEY is missing now points at the canonical path.
- PAI-Install/engine/actions.ts: stop creating the ~/.env symlink.
~/.claude/.env stays symlinked (that path is PAI's own namespace, so
the symlink is safe and the hooks' existing reads continue working
unchanged). The new comment explains why we no longer touch ~/.env.
Backward compatibility:
- Existing installs that already have the ~/.env symlink continue to
work — both paths point at the same real file, so loading both is a
no-op.
- Existing installs that already have a real ~/.env with PAI values in
it continue to work — loadEnvFile() reads both paths and either one
(or both) can contain the keys.
- New installs after this change will have a real file at
~/.config/PAI/.env and will NOT touch ~/.env. Users own ~/.env.
Related to the VoiceServer cross-platform audio work in danielmiessler#1061 and the
Pushcut notification channel in danielmiessler#1062.1 parent dc05fe9 commit 00e2fa2
2 files changed
Lines changed: 37 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | | - | |
728 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
729 | 734 | | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
744 | 743 | | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | 744 | | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
749 | 750 | | |
750 | 751 | | |
751 | 752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
38 | 49 | | |
39 | | - | |
40 | | - | |
| 50 | + | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | 54 | | |
| |||
0 commit comments