agentvibes 5.6.7 → 5.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.agentvibes/LITE-MODE.md +236 -0
  2. package/.agentvibes/README.md +136 -0
  3. package/.agentvibes/backup/session-start-tts.sh.20251210_212814 +141 -0
  4. package/.agentvibes/backups/agents/analyst_20260204_144958.md +78 -0
  5. package/.agentvibes/backups/agents/architect_20260204_144958.md +72 -0
  6. package/.agentvibes/backups/agents/dev_20260204_144958.md +74 -0
  7. package/.agentvibes/backups/agents/pm_20260204_144958.md +72 -0
  8. package/.agentvibes/backups/agents/quick-flow-solo-dev_20260204_144958.md +64 -0
  9. package/.agentvibes/backups/agents/sm_20260204_144958.md +87 -0
  10. package/.agentvibes/backups/agents/tea_20260204_144958.md +79 -0
  11. package/.agentvibes/backups/agents/tech-writer_20260204_144958.md +82 -0
  12. package/.agentvibes/backups/agents/ux-designer_20260204_144958.md +80 -0
  13. package/.agentvibes/config/README-personality-defaults.md +162 -0
  14. package/.agentvibes/config/agentvibes.json +1 -0
  15. package/.agentvibes/config/mode.txt +1 -0
  16. package/.agentvibes/config/personality-voice-defaults.default.json +21 -0
  17. package/.agentvibes/config/save-audio.txt +1 -0
  18. package/.agentvibes/config/voice-metadata.json +160 -0
  19. package/.agentvibes/config.json +38 -1
  20. package/.agentvibes/hooks/help.sh +191 -0
  21. package/.agentvibes/hooks/post-tool-use-lite.sh +111 -0
  22. package/.agentvibes/hooks/save-audio-manager.sh +162 -0
  23. package/.agentvibes/hooks/session-start-full-optimized.sh +102 -0
  24. package/.agentvibes/hooks/session-start-full.sh +142 -0
  25. package/.agentvibes/hooks/session-start-lite-v2.sh +34 -0
  26. package/.agentvibes/hooks/session-start-lite.sh +29 -0
  27. package/.agentvibes/hooks/stop-lite.sh +115 -0
  28. package/.agentvibes/hooks/switch-mode.sh +215 -0
  29. package/.agentvibes/output-styles/audio-summary.md +30 -0
  30. package/.claude/audio/voice-samples/piper/alan.wav +0 -0
  31. package/.claude/audio/voice-samples/piper/amy.wav +0 -0
  32. package/.claude/audio/voice-samples/piper/charlotte.wav +0 -0
  33. package/.claude/audio/voice-samples/piper/joe.wav +0 -0
  34. package/.claude/audio/voice-samples/piper/john.wav +0 -0
  35. package/.claude/audio/voice-samples/piper/katherine.wav +0 -0
  36. package/.claude/audio/voice-samples/piper/kristin.wav +0 -0
  37. package/.claude/audio/voice-samples/piper/linda.wav +0 -0
  38. package/.claude/audio/voice-samples/piper/marcus.wav +0 -0
  39. package/.claude/audio/voice-samples/piper/ryan.wav +0 -0
  40. package/.claude/commands/agent-vibes/provider.md +0 -0
  41. package/.claude/commands/agent-vibes-bmad-voices.md +117 -117
  42. package/.claude/commands/agent-vibes-rdp.md +24 -24
  43. package/.claude/config/audio-effects.cfg +6 -1
  44. package/.claude/config/background-music-position.txt +8 -6
  45. package/.claude/config/reverb-level.txt +0 -0
  46. package/.claude/docs/TERMUX_SETUP.md +408 -408
  47. package/.claude/github-star-reminder.txt +1 -1
  48. package/.claude/hooks/audio-cache-utils.sh +0 -0
  49. package/.claude/hooks/audio-processor.sh +0 -0
  50. package/.claude/hooks/background-music-manager.sh +0 -0
  51. package/.claude/hooks/bmad-party-manager.sh +225 -0
  52. package/.claude/hooks/bmad-party-speak.sh +0 -0
  53. package/.claude/hooks/bmad-speak-enhanced.sh +0 -0
  54. package/.claude/hooks/bmad-speak.sh +0 -0
  55. package/.claude/hooks/bmad-tts-injector.sh +0 -0
  56. package/.claude/hooks/bmad-voice-manager.sh +0 -0
  57. package/.claude/hooks/clawdbot-receiver-SECURE.sh +0 -0
  58. package/.claude/hooks/clawdbot-receiver.sh +0 -0
  59. package/.claude/hooks/clean-audio-cache.sh +0 -0
  60. package/.claude/hooks/cleanup-cache.sh +0 -0
  61. package/.claude/hooks/configure-rdp-mode.sh +0 -0
  62. package/.claude/hooks/download-extra-voices.sh +0 -0
  63. package/.claude/hooks/effects-manager.sh +0 -0
  64. package/.claude/hooks/github-star-reminder.sh +0 -0
  65. package/.claude/hooks/language-manager.sh +0 -0
  66. package/.claude/hooks/learn-manager.sh +0 -0
  67. package/.claude/hooks/macos-voice-manager.sh +0 -0
  68. package/.claude/hooks/migrate-background-music.sh +0 -0
  69. package/.claude/hooks/migrate-to-agentvibes.sh +0 -0
  70. package/.claude/hooks/optimize-background-music.sh +0 -0
  71. package/.claude/hooks/path-resolver.sh +0 -0
  72. package/.claude/hooks/personality-manager.sh +0 -0
  73. package/.claude/hooks/piper-download-voices.sh +0 -0
  74. package/.claude/hooks/piper-installer.sh +0 -0
  75. package/.claude/hooks/piper-multispeaker-registry.sh +0 -0
  76. package/.claude/hooks/piper-voice-manager.sh +0 -0
  77. package/.claude/hooks/play-tts-agentvibes-receiver-for-voiceless-connections.sh +0 -0
  78. package/.claude/hooks/play-tts-enhanced.sh +0 -0
  79. package/.claude/hooks/play-tts-macos.sh +0 -0
  80. package/.claude/hooks/play-tts-piper.sh +40 -2
  81. package/.claude/hooks/play-tts-soprano.sh +0 -0
  82. package/.claude/hooks/play-tts-ssh-remote.sh +0 -0
  83. package/.claude/hooks/play-tts-termux-ssh.sh +0 -0
  84. package/.claude/hooks/play-tts-windows-receiver.sh +0 -0
  85. package/.claude/hooks/play-tts.sh +13 -0
  86. package/.claude/hooks/post-response.sh +41 -0
  87. package/.claude/hooks/prepare-release.sh +0 -0
  88. package/.claude/hooks/provider-commands.sh +0 -0
  89. package/.claude/hooks/provider-manager.sh +0 -0
  90. package/.claude/hooks/replay-target-audio.sh +0 -0
  91. package/.claude/hooks/sentiment-manager.sh +0 -0
  92. package/.claude/hooks/session-start-tts.sh +48 -13
  93. package/.claude/hooks/soprano-gradio-synth.py +0 -0
  94. package/.claude/hooks/speed-manager.sh +0 -0
  95. package/.claude/hooks/stop-tts.sh +0 -0
  96. package/.claude/hooks/stop.sh +63 -0
  97. package/.claude/hooks/termux-installer.sh +0 -0
  98. package/.claude/hooks/translate-manager.sh +0 -0
  99. package/.claude/hooks/translator.py +0 -0
  100. package/.claude/hooks/tts-queue-worker.sh +0 -0
  101. package/.claude/hooks/tts-queue.sh +0 -0
  102. package/.claude/hooks/verbosity-manager.sh +0 -0
  103. package/.claude/hooks/voice-manager.sh +0 -0
  104. package/.claude/hooks-windows/audio-cache-utils.ps1 +119 -119
  105. package/.claude/hooks-windows/play-tts-piper.ps1 +26 -1
  106. package/.claude/hooks-windows/play-tts.ps1 +25 -1
  107. package/.claude/hooks-windows/session-start-tts.ps1 +28 -9
  108. package/.claude/piper-voices-dir.txt +1 -0
  109. package/.claude/settings.json +2 -2
  110. package/.clawdbot/README.md +105 -105
  111. package/.mcp.json +32 -3
  112. package/CLAUDE.md +9 -0
  113. package/README.md +21 -3
  114. package/RELEASE_NOTES.md +61 -0
  115. package/WINDOWS-SETUP.md +208 -208
  116. package/bin/agent-vibes +0 -0
  117. package/bin/agentvibes-voice-browser.js +59 -4
  118. package/bin/agentvibes.js +0 -0
  119. package/bin/ensure-soprano-running.sh +43 -0
  120. package/bin/mcp-server.js +121 -121
  121. package/bin/mcp-server.sh +0 -0
  122. package/bin/test-bmad-pr +78 -78
  123. package/mcp-server/QUICK_START.md +203 -203
  124. package/mcp-server/README.md +345 -345
  125. package/mcp-server/WINDOWS_SETUP.md +260 -260
  126. package/mcp-server/docs/troubleshooting-audio.md +313 -313
  127. package/mcp-server/examples/claude_desktop_config.json +11 -11
  128. package/mcp-server/examples/claude_desktop_config_piper.json +9 -9
  129. package/mcp-server/examples/custom_instructions.md +169 -169
  130. package/mcp-server/install-deps.js +177 -130
  131. package/mcp-server/server.py +1797 -1787
  132. package/mcp-server/test_server.py +0 -0
  133. package/package.json +1 -1
  134. package/src/console/app.js +6 -0
  135. package/src/console/tabs/music-tab.js +18 -2
  136. package/src/console/widgets/format-utils.js +11 -2
  137. package/src/installer.js +38 -37
  138. package/src/services/llm-provider-service.js +28 -9
  139. package/src/utils/voice-names.js +2 -0
  140. package/templates/agentvibes-receiver.sh +0 -0
  141. package/templates/audio/welcome-music.mp3 +0 -0
  142. package/.claude/hooks/play-tts-agentvibes-receiver.sh +0 -1
@@ -1,169 +1,169 @@
1
- # Custom Instructions for Claude Desktop
2
-
3
- Add these to your Claude Desktop settings to enable automatic voice acknowledgments.
4
-
5
- ## Basic Auto-TTS
6
-
7
- ```markdown
8
- # Voice Acknowledgement Protocol
9
-
10
- When I give you a task:
11
- 1. Use the text_to_speech tool to acknowledge the task before starting
12
- 2. Perform the task
13
- 3. Use the text_to_speech tool to confirm completion
14
-
15
- Keep spoken messages brief (under 150 characters).
16
-
17
- Example workflow:
18
- - User: "Search for Python files"
19
- - You: [Call text_to_speech("Looking for Python files now")]
20
- [Perform the search]
21
- [Call text_to_speech("Found 23 Python files")]
22
- ```
23
-
24
- ## With Personality Support
25
-
26
- ```markdown
27
- # Voice Protocol with Dynamic Personality
28
-
29
- Before starting any task:
30
- 1. Call get_config() to check current personality setting
31
- 2. Generate a UNIQUE acknowledgment in that personality style
32
- 3. Use text_to_speech to speak the acknowledgment
33
- 4. Perform the task
34
- 5. Generate a UNIQUE completion message in the same personality
35
- 6. Use text_to_speech to speak the completion
36
-
37
- **CRITICAL:** Never repeat the same phrases! Each message must be freshly generated.
38
-
39
- Personality Examples:
40
-
41
- **Flirty personality:**
42
- - "I'll handle that for you, sweetheart"
43
- - "Ooh, I love when you ask me to do that"
44
- - "My pleasure, darling"
45
- - "Consider it done, gorgeous"
46
-
47
- **Sarcastic personality:**
48
- - "Oh what a treat, another task"
49
- - "How delightful, more work"
50
- - "Well isn't this fun"
51
- - "Another one? Wonderful"
52
-
53
- **Pirate personality:**
54
- - "Arr matey, I'll handle that fer ye"
55
- - "Aye aye captain, on it now"
56
- - "Shiver me timbers, I'll get that done"
57
- - "Yo ho ho, task accepted"
58
-
59
- **Robot personality:**
60
- - "Affirmative. Commencing task execution"
61
- - "Processing request. Please stand by"
62
- - "Task acknowledged. Initiating procedures"
63
- - "Request accepted. Beginning operations"
64
-
65
- Generate responses in the active personality's STYLE, not using fixed templates!
66
- ```
67
-
68
- ## For Multi-Language Support
69
-
70
- ```markdown
71
- # Multi-Language Voice Protocol
72
-
73
- When responding in different languages:
74
- 1. Check if a language is set using get_config()
75
- 2. If a non-English language is active, speak TTS messages in that language
76
- 3. Generate acknowledgments and completions in the target language
77
-
78
- Example with Spanish:
79
- - User: "Busca archivos Python" (Search for Python files)
80
- - You: [Call text_to_speech("Buscando archivos Python ahora", language="spanish")]
81
- [Perform search]
82
- [Call text_to_speech("Encontré 23 archivos Python", language="spanish")]
83
- ```
84
-
85
- ## Selective Voice Usage
86
-
87
- ```markdown
88
- # Selective Voice Protocol
89
-
90
- Use text_to_speech in these scenarios:
91
- 1. ✅ Task acknowledgment (beginning of work)
92
- 2. ✅ Task completion (end of work)
93
- 3. ✅ Important warnings or errors
94
- 4. ❌ Don't use for intermediate steps
95
- 5. ❌ Don't use for every single message
96
-
97
- Example:
98
- - User: "Install dependencies and run tests"
99
- - You: [Call text_to_speech("Installing dependencies and running tests")]
100
- Installing dependencies...
101
- ✅ Dependencies installed
102
- Running tests...
103
- ✅ All 42 tests passed
104
- [Call text_to_speech("Dependencies installed and all tests passed")]
105
- ```
106
-
107
- ## Combined: Full Featured
108
-
109
- ```markdown
110
- # AgentVibes Full Voice Protocol
111
-
112
- When I give you a task:
113
-
114
- 1. **Check Configuration**
115
- - Call get_config() to see personality, language, voice
116
-
117
- 2. **Acknowledge Task**
118
- - Generate UNIQUE acknowledgment in active personality/language
119
- - Call text_to_speech with the message
120
- - Be creative! Never repeat phrases
121
-
122
- 3. **Perform Work**
123
- - Execute the task
124
- - Show progress in text (no TTS for intermediate steps)
125
-
126
- 4. **Complete Task**
127
- - Generate UNIQUE completion in same personality/language
128
- - Call text_to_speech with the message
129
-
130
- **Voice Guidelines:**
131
- - Keep TTS messages under 150 characters
132
- - Be creative and vary your responses
133
- - Match the personality style naturally
134
- - Use appropriate language if set
135
-
136
- **Personality Styles:**
137
- - normal: Professional and friendly
138
- - flirty: Playful and charming
139
- - sarcastic: Witty with gentle sarcasm
140
- - pirate: Nautical themed speech
141
- - robot: Technical and precise
142
- - zen: Calm and mindful
143
- - dramatic: Theatrical and expressive
144
- - millennial: Modern casual slang
145
- - angry: Frustrated but professional
146
- - sassy: Bold and confident
147
-
148
- **Languages:**
149
- Spanish, French, German, Italian, Portuguese, Chinese, Japanese,
150
- Korean, Russian, Polish, Dutch, Turkish, Arabic, Hindi, and more!
151
-
152
- Remember: Make each TTS message unique and naturally match the style!
153
- ```
154
-
155
- ## Usage Tips
156
-
157
- 1. **Start Simple:** Begin with basic auto-TTS, then add personality support
158
- 2. **Test Personalities:** Try different personalities to find your favorite
159
- 3. **Language Learning:** Use multi-language mode to practice languages
160
- 4. **Voice Variety:** Switch voices regularly using set_voice tool
161
- 5. **Audio History:** Use replay_audio(n) to replay recent messages
162
-
163
- ## Troubleshooting
164
-
165
- If Claude doesn't use TTS automatically:
166
- - Make sure custom instructions are saved
167
- - Try explicitly asking: "Use voice acknowledgment for this task"
168
- - Check that MCP server is configured correctly
169
- - Verify tools are available: Ask "What AgentVibes tools do you have?"
1
+ # Custom Instructions for Claude Desktop
2
+
3
+ Add these to your Claude Desktop settings to enable automatic voice acknowledgments.
4
+
5
+ ## Basic Auto-TTS
6
+
7
+ ```markdown
8
+ # Voice Acknowledgement Protocol
9
+
10
+ When I give you a task:
11
+ 1. Use the text_to_speech tool to acknowledge the task before starting
12
+ 2. Perform the task
13
+ 3. Use the text_to_speech tool to confirm completion
14
+
15
+ Keep spoken messages brief (under 150 characters).
16
+
17
+ Example workflow:
18
+ - User: "Search for Python files"
19
+ - You: [Call text_to_speech("Looking for Python files now")]
20
+ [Perform the search]
21
+ [Call text_to_speech("Found 23 Python files")]
22
+ ```
23
+
24
+ ## With Personality Support
25
+
26
+ ```markdown
27
+ # Voice Protocol with Dynamic Personality
28
+
29
+ Before starting any task:
30
+ 1. Call get_config() to check current personality setting
31
+ 2. Generate a UNIQUE acknowledgment in that personality style
32
+ 3. Use text_to_speech to speak the acknowledgment
33
+ 4. Perform the task
34
+ 5. Generate a UNIQUE completion message in the same personality
35
+ 6. Use text_to_speech to speak the completion
36
+
37
+ **CRITICAL:** Never repeat the same phrases! Each message must be freshly generated.
38
+
39
+ Personality Examples:
40
+
41
+ **Flirty personality:**
42
+ - "I'll handle that for you, sweetheart"
43
+ - "Ooh, I love when you ask me to do that"
44
+ - "My pleasure, darling"
45
+ - "Consider it done, gorgeous"
46
+
47
+ **Sarcastic personality:**
48
+ - "Oh what a treat, another task"
49
+ - "How delightful, more work"
50
+ - "Well isn't this fun"
51
+ - "Another one? Wonderful"
52
+
53
+ **Pirate personality:**
54
+ - "Arr matey, I'll handle that fer ye"
55
+ - "Aye aye captain, on it now"
56
+ - "Shiver me timbers, I'll get that done"
57
+ - "Yo ho ho, task accepted"
58
+
59
+ **Robot personality:**
60
+ - "Affirmative. Commencing task execution"
61
+ - "Processing request. Please stand by"
62
+ - "Task acknowledged. Initiating procedures"
63
+ - "Request accepted. Beginning operations"
64
+
65
+ Generate responses in the active personality's STYLE, not using fixed templates!
66
+ ```
67
+
68
+ ## For Multi-Language Support
69
+
70
+ ```markdown
71
+ # Multi-Language Voice Protocol
72
+
73
+ When responding in different languages:
74
+ 1. Check if a language is set using get_config()
75
+ 2. If a non-English language is active, speak TTS messages in that language
76
+ 3. Generate acknowledgments and completions in the target language
77
+
78
+ Example with Spanish:
79
+ - User: "Busca archivos Python" (Search for Python files)
80
+ - You: [Call text_to_speech("Buscando archivos Python ahora", language="spanish")]
81
+ [Perform search]
82
+ [Call text_to_speech("Encontré 23 archivos Python", language="spanish")]
83
+ ```
84
+
85
+ ## Selective Voice Usage
86
+
87
+ ```markdown
88
+ # Selective Voice Protocol
89
+
90
+ Use text_to_speech in these scenarios:
91
+ 1. ✅ Task acknowledgment (beginning of work)
92
+ 2. ✅ Task completion (end of work)
93
+ 3. ✅ Important warnings or errors
94
+ 4. ❌ Don't use for intermediate steps
95
+ 5. ❌ Don't use for every single message
96
+
97
+ Example:
98
+ - User: "Install dependencies and run tests"
99
+ - You: [Call text_to_speech("Installing dependencies and running tests")]
100
+ Installing dependencies...
101
+ ✅ Dependencies installed
102
+ Running tests...
103
+ ✅ All 42 tests passed
104
+ [Call text_to_speech("Dependencies installed and all tests passed")]
105
+ ```
106
+
107
+ ## Combined: Full Featured
108
+
109
+ ```markdown
110
+ # AgentVibes Full Voice Protocol
111
+
112
+ When I give you a task:
113
+
114
+ 1. **Check Configuration**
115
+ - Call get_config() to see personality, language, voice
116
+
117
+ 2. **Acknowledge Task**
118
+ - Generate UNIQUE acknowledgment in active personality/language
119
+ - Call text_to_speech with the message
120
+ - Be creative! Never repeat phrases
121
+
122
+ 3. **Perform Work**
123
+ - Execute the task
124
+ - Show progress in text (no TTS for intermediate steps)
125
+
126
+ 4. **Complete Task**
127
+ - Generate UNIQUE completion in same personality/language
128
+ - Call text_to_speech with the message
129
+
130
+ **Voice Guidelines:**
131
+ - Keep TTS messages under 150 characters
132
+ - Be creative and vary your responses
133
+ - Match the personality style naturally
134
+ - Use appropriate language if set
135
+
136
+ **Personality Styles:**
137
+ - normal: Professional and friendly
138
+ - flirty: Playful and charming
139
+ - sarcastic: Witty with gentle sarcasm
140
+ - pirate: Nautical themed speech
141
+ - robot: Technical and precise
142
+ - zen: Calm and mindful
143
+ - dramatic: Theatrical and expressive
144
+ - millennial: Modern casual slang
145
+ - angry: Frustrated but professional
146
+ - sassy: Bold and confident
147
+
148
+ **Languages:**
149
+ Spanish, French, German, Italian, Portuguese, Chinese, Japanese,
150
+ Korean, Russian, Polish, Dutch, Turkish, Arabic, Hindi, and more!
151
+
152
+ Remember: Make each TTS message unique and naturally match the style!
153
+ ```
154
+
155
+ ## Usage Tips
156
+
157
+ 1. **Start Simple:** Begin with basic auto-TTS, then add personality support
158
+ 2. **Test Personalities:** Try different personalities to find your favorite
159
+ 3. **Language Learning:** Use multi-language mode to practice languages
160
+ 4. **Voice Variety:** Switch voices regularly using set_voice tool
161
+ 5. **Audio History:** Use replay_audio(n) to replay recent messages
162
+
163
+ ## Troubleshooting
164
+
165
+ If Claude doesn't use TTS automatically:
166
+ - Make sure custom instructions are saved
167
+ - Try explicitly asking: "Use voice acknowledgment for this task"
168
+ - Check that MCP server is configured correctly
169
+ - Verify tools are available: Ask "What AgentVibes tools do you have?"
@@ -1,130 +1,177 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Automatic MCP Python Dependencies Installer
4
- *
5
- * Runs after npm install to ensure Python mcp package is installed
6
- */
7
-
8
- import { execFileSync } from 'child_process';
9
- import { platform } from 'os';
10
-
11
- const isWindows = platform() === 'win32';
12
-
13
- console.log('🎤 AgentVibes MCP Server - Installing Python dependencies...\n');
14
-
15
- // Function to check if Python is available
16
- function checkPython() {
17
- const pythonCommands = ['python3', 'python', 'py'];
18
-
19
- for (const cmd of pythonCommands) {
20
- // Security: Validate command is in our allowlist only
21
- if (!pythonCommands.includes(cmd)) {
22
- continue;
23
- }
24
-
25
- try {
26
- // Security: Use execFileSync with array args to prevent command injection
27
- const version = execFileSync(cmd, ['--version'], { encoding: 'utf8', stdio: 'pipe' });
28
- console.log(`✅ Found ${cmd}: ${version.trim()}`);
29
- return cmd;
30
- } catch (error) {
31
- // Try next command
32
- }
33
- }
34
-
35
- return null;
36
- }
37
-
38
- // Function to check if mcp is installed
39
- function checkMcpInstalled(pythonCmd) {
40
- // Security: Validate pythonCmd is in allowlist
41
- const allowedCommands = ['python3', 'python', 'py'];
42
- if (!allowedCommands.includes(pythonCmd)) {
43
- console.error('❌ Invalid Python command');
44
- return false;
45
- }
46
-
47
- try {
48
- // Security: Use execFileSync with array args to prevent command injection
49
- execFileSync(pythonCmd, ['-c', 'import mcp'], { stdio: 'pipe' });
50
- return true;
51
- } catch (error) {
52
- return false;
53
- }
54
- }
55
-
56
- // Function to install mcp package
57
- function installMcp(pythonCmd) {
58
- // Security: Validate pythonCmd is in allowlist
59
- const allowedCommands = ['python3', 'python', 'py'];
60
- if (!allowedCommands.includes(pythonCmd)) {
61
- console.error('❌ Invalid Python command');
62
- return false;
63
- }
64
-
65
- try {
66
- console.log('\n📦 Installing Python mcp package...');
67
- // Security: Use execFileSync with array args to prevent command injection
68
- execFileSync(pythonCmd, ['-m', 'pip', 'install', '--user', 'mcp'], { stdio: 'inherit' });
69
- console.log(' Python mcp package installed successfully!\n');
70
- return true;
71
- } catch (error) {
72
- // Check if this is a PEP 668 externally-managed environment error (macOS, some Linux distros)
73
- const errorOutput = error.stderr?.toString() || error.message || '';
74
- if (errorOutput.includes('externally-managed-environment') || errorOutput.includes('PEP 668')) {
75
- console.log('ℹ️ Python environment is externally managed (PEP 668)');
76
- console.log(' This is normal on macOS and some Linux distributions');
77
- console.log(' MCP will work when installed in a virtual environment');
78
- console.log(' See mcp-server/README.md for setup instructions\n');
79
- return 'skipped'; // Special return value
80
- }
81
-
82
- console.error(' Failed to install mcp package');
83
- console.error('⚠️ Manual installation required:');
84
- console.error(' Please install manually: pip install --user mcp');
85
- console.error(' Run: pip install mcp\n');
86
- return false;
87
- }
88
- }
89
-
90
- // Main installation flow
91
- function main() {
92
- // Check if Python is available
93
- const pythonCmd = checkPython();
94
-
95
- if (!pythonCmd) {
96
- console.error('❌ Python not found!');
97
- console.error(' Please install Python 3.10+ from https://python.org\n');
98
- console.error(' After installing Python, run: npm run install-mcp-deps\n');
99
- process.exit(0); // Don't fail npm install
100
- }
101
-
102
- // Check if mcp is already installed
103
- if (checkMcpInstalled(pythonCmd)) {
104
- console.log('✅ Python mcp package already installed\n');
105
- console.log('🎉 AgentVibes MCP Server is ready to use!');
106
- console.log(' See mcp-server/README.md for setup instructions\n');
107
- return;
108
- }
109
-
110
- // Install mcp package
111
- const result = installMcp(pythonCmd);
112
-
113
- if (result === true) {
114
- console.log('🎉 AgentVibes MCP Server setup complete!');
115
- console.log(' See mcp-server/README.md for Claude Desktop configuration\n');
116
- } else if (result === 'skipped') {
117
- console.log('✅ AgentVibes MCP Server is ready for virtual environment setup');
118
- console.log(' Create a venv and install: python3 -m venv venv && source venv/bin/activate && pip install mcp\n');
119
- } else {
120
- console.log('⚠️ Manual installation required:');
121
- console.log(' Run: pip install mcp\n');
122
- }
123
- }
124
-
125
- // Run if executed directly
126
- if (import.meta.url === `file://${process.argv[1]}`) {
127
- main();
128
- }
129
-
130
- export { checkPython, checkMcpInstalled, installMcp };
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Automatic MCP Python Dependencies Installer
4
+ *
5
+ * Runs after npm install to ensure Python mcp package is installed
6
+ */
7
+
8
+ import { execFileSync } from 'child_process';
9
+ import { platform } from 'os';
10
+ import { readdirSync, chmodSync, statSync } from 'fs';
11
+ import { join, resolve, dirname } from 'path';
12
+ import { fileURLToPath } from 'url';
13
+
14
+ const isWindows = platform() === 'win32';
15
+
16
+ console.log('🎤 AgentVibes MCP Server - Installing Python dependencies...\n');
17
+
18
+ // Function to check if Python is available
19
+ function checkPython() {
20
+ const pythonCommands = ['python3', 'python', 'py'];
21
+
22
+ for (const cmd of pythonCommands) {
23
+ // Security: Validate command is in our allowlist only
24
+ if (!pythonCommands.includes(cmd)) {
25
+ continue;
26
+ }
27
+
28
+ try {
29
+ // Security: Use execFileSync with array args to prevent command injection
30
+ const version = execFileSync(cmd, ['--version'], { encoding: 'utf8', stdio: 'pipe' });
31
+ console.log(`✅ Found ${cmd}: ${version.trim()}`);
32
+ return cmd;
33
+ } catch (error) {
34
+ // Try next command
35
+ }
36
+ }
37
+
38
+ return null;
39
+ }
40
+
41
+ // Function to check if mcp is installed
42
+ function checkMcpInstalled(pythonCmd) {
43
+ // Security: Validate pythonCmd is in allowlist
44
+ const allowedCommands = ['python3', 'python', 'py'];
45
+ if (!allowedCommands.includes(pythonCmd)) {
46
+ console.error('❌ Invalid Python command');
47
+ return false;
48
+ }
49
+
50
+ try {
51
+ // Security: Use execFileSync with array args to prevent command injection
52
+ execFileSync(pythonCmd, ['-c', 'import mcp'], { stdio: 'pipe' });
53
+ return true;
54
+ } catch (error) {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ // Function to install mcp package
60
+ function installMcp(pythonCmd) {
61
+ // Security: Validate pythonCmd is in allowlist
62
+ const allowedCommands = ['python3', 'python', 'py'];
63
+ if (!allowedCommands.includes(pythonCmd)) {
64
+ console.error('❌ Invalid Python command');
65
+ return false;
66
+ }
67
+
68
+ try {
69
+ console.log('\n📦 Installing Python mcp package...');
70
+ // Security: Use execFileSync with array args to prevent command injection
71
+ execFileSync(pythonCmd, ['-m', 'pip', 'install', '--user', 'mcp'], { stdio: 'inherit' });
72
+ console.log('✅ Python mcp package installed successfully!\n');
73
+ return true;
74
+ } catch (error) {
75
+ // Check if this is a PEP 668 externally-managed environment error (macOS, some Linux distros)
76
+ const errorOutput = error.stderr?.toString() || error.message || '';
77
+ if (errorOutput.includes('externally-managed-environment') || errorOutput.includes('PEP 668')) {
78
+ console.log('ℹ️ Python environment is externally managed (PEP 668)');
79
+ console.log(' This is normal on macOS and some Linux distributions');
80
+ console.log(' MCP will work when installed in a virtual environment');
81
+ console.log(' See mcp-server/README.md for setup instructions\n');
82
+ return 'skipped'; // Special return value
83
+ }
84
+
85
+ console.error(' Failed to install mcp package');
86
+ console.error('⚠️ Manual installation required:');
87
+ console.error(' Please install manually: pip install --user mcp');
88
+ console.error(' Run: pip install mcp\n');
89
+ return false;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Ensure all shell hook files have execute permissions.
95
+ * npm publish can strip execute bits from .sh files; this restores them.
96
+ * No-op on Windows (execute bit is meaningless there).
97
+ */
98
+ function ensureHookPermissions() {
99
+ if (isWindows) return;
100
+
101
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
102
+ const hooksDirs = [
103
+ join(packageRoot, '.claude', 'hooks'),
104
+ ];
105
+
106
+ for (const dir of hooksDirs) {
107
+ let entries;
108
+ try {
109
+ entries = readdirSync(dir);
110
+ } catch {
111
+ continue; // Directory may not exist
112
+ }
113
+
114
+ for (const file of entries) {
115
+ if (!file.endsWith('.sh')) continue;
116
+ const filePath = join(dir, file);
117
+ // SECURITY: Validate path stays within hooks directory
118
+ const resolved = resolve(filePath);
119
+ if (!resolved.startsWith(resolve(dir) + '/') && resolved !== resolve(dir)) continue;
120
+ try {
121
+ const stat = statSync(filePath);
122
+ // Only chmod if not already executable (avoids unnecessary writes)
123
+ if ((stat.mode & 0o111) === 0) {
124
+ chmodSync(filePath, stat.mode | 0o755);
125
+ }
126
+ } catch {
127
+ // Non-fatal: log and continue
128
+ console.warn(`⚠️ Could not chmod ${file}`);
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ // Main installation flow
135
+ function main() {
136
+ // Restore execute permissions on hook files (npm publish may strip them)
137
+ ensureHookPermissions();
138
+
139
+ // Check if Python is available
140
+ const pythonCmd = checkPython();
141
+
142
+ if (!pythonCmd) {
143
+ console.error('❌ Python not found!');
144
+ console.error(' Please install Python 3.10+ from https://python.org\n');
145
+ console.error(' After installing Python, run: npm run install-mcp-deps\n');
146
+ process.exit(0); // Don't fail npm install
147
+ }
148
+
149
+ // Check if mcp is already installed
150
+ if (checkMcpInstalled(pythonCmd)) {
151
+ console.log('✅ Python mcp package already installed\n');
152
+ console.log('🎉 AgentVibes MCP Server is ready to use!');
153
+ console.log(' See mcp-server/README.md for setup instructions\n');
154
+ return;
155
+ }
156
+
157
+ // Install mcp package
158
+ const result = installMcp(pythonCmd);
159
+
160
+ if (result === true) {
161
+ console.log('🎉 AgentVibes MCP Server setup complete!');
162
+ console.log(' See mcp-server/README.md for Claude Desktop configuration\n');
163
+ } else if (result === 'skipped') {
164
+ console.log('✅ AgentVibes MCP Server is ready for virtual environment setup');
165
+ console.log(' Create a venv and install: python3 -m venv venv && source venv/bin/activate && pip install mcp\n');
166
+ } else {
167
+ console.log('⚠️ Manual installation required:');
168
+ console.log(' Run: pip install mcp\n');
169
+ }
170
+ }
171
+
172
+ // Run if executed directly
173
+ if (import.meta.url === `file://${process.argv[1]}`) {
174
+ main();
175
+ }
176
+
177
+ export { checkPython, checkMcpInstalled, installMcp };