mcp-voice-hooks 1.0.21 → 1.0.22

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 (3) hide show
  1. package/README.md +5 -6
  2. package/bin/cli.js +62 -25
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ Voice Mode for Claude Code allows you to have a continuous two-way conversation
4
4
 
5
5
  It uses the new [Claude Code hooks](https://docs.anthropic.com/en/docs/claude-code/hooks) to deliver voice input to Claude while it works.
6
6
 
7
- This lets you speak continuously to Claude - interrupt, redirect, or provide feedback without stopping.
7
+ This lets you speak continuously to Claude - interrupt, redirect, or provide feedback without stopping what Claude is doing.
8
8
 
9
9
  Optionally enable text-to-speech to have Claude speak back to you.
10
10
 
@@ -21,8 +21,7 @@ Installation is easy.
21
21
  ### 1. Install Claude Code
22
22
 
23
23
  ```bash
24
- # IMPORTANT: there is a bug in the @latest version of Claude Code (1.0.44), so you must specify the version explicitly
25
- npm install -g @anthropic-ai/claude-code@">=1.0.45"
24
+ npm install -g @anthropic-ai/claude-code
26
25
  ```
27
26
 
28
27
  ### 2. Install Voice Mode
@@ -91,7 +90,7 @@ The hooks are automatically installed/updated when the MCP server starts. Howeve
91
90
  npx mcp-voice-hooks install-hooks
92
91
  ```
93
92
 
94
- This will configure your project's `.claude/settings.json` with the necessary hook commands.
93
+ This will configure your project's `.claude/settings.local.json` with the necessary hook commands.
95
94
 
96
95
  ## Uninstallation
97
96
 
@@ -109,7 +108,7 @@ npx mcp-voice-hooks uninstall
109
108
 
110
109
  This will:
111
110
 
112
- - Clean up voice hooks from your project's `.claude/settings.json`
111
+ - Clean up voice hooks from your project's `.claude/settings.local.json`
113
112
  - Preserve any custom hooks you've added
114
113
 
115
114
  ## Development Mode
@@ -145,7 +144,7 @@ claude
145
144
 
146
145
  #### Port Configuration
147
146
 
148
- The default port is 5111. To use a different port, add to your project's `.claude/settings.json`:
147
+ The default port is 5111. To use a different port, add to your project's `.claude/settings.local.json`:
149
148
 
150
149
  ```json
151
150
  {
package/bin/cli.js CHANGED
@@ -46,7 +46,9 @@ async function main() {
46
46
  // Automatically configure Claude Code settings
47
47
  async function configureClaudeCodeSettings() {
48
48
  const claudeDir = path.join(process.cwd(), '.claude');
49
- const settingsPath = path.join(claudeDir, 'settings.json');
49
+ const settingsPath = path.join(claudeDir, 'settings.local.json');
50
+ // This was used in versions <= v1.0.21.
51
+ const oldSettingsPath = path.join(claudeDir, 'settings.json');
50
52
 
51
53
  console.log('⚙️ Configuring project Claude Code settings...');
52
54
 
@@ -56,6 +58,32 @@ async function configureClaudeCodeSettings() {
56
58
  console.log('✅ Created project .claude directory');
57
59
  }
58
60
 
61
+ // Clean up old settings.json if it exists (for users upgrading from older versions)
62
+ if (fs.existsSync(oldSettingsPath)) {
63
+ try {
64
+ console.log('🔄 Found old settings.json, cleaning up voice hooks...');
65
+ const oldSettingsContent = fs.readFileSync(oldSettingsPath, 'utf8');
66
+ const oldSettings = JSON.parse(oldSettingsContent);
67
+
68
+ if (oldSettings.hooks) {
69
+ // Remove voice hooks from old settings
70
+ const cleanedHooks = removeVoiceHooks(oldSettings.hooks);
71
+
72
+ if (Object.keys(cleanedHooks).length === 0) {
73
+ delete oldSettings.hooks;
74
+ } else {
75
+ oldSettings.hooks = cleanedHooks;
76
+ }
77
+
78
+ // Write back cleaned settings
79
+ fs.writeFileSync(oldSettingsPath, JSON.stringify(oldSettings, null, 2));
80
+ console.log('✅ Cleaned up voice hooks from old settings.json');
81
+ }
82
+ } catch (error) {
83
+ console.log('⚠️ Could not clean up old settings.json:', error.message);
84
+ }
85
+ }
86
+
59
87
  // Read existing settings or create new
60
88
  let settings = {};
61
89
  if (fs.existsSync(settingsPath)) {
@@ -189,40 +217,49 @@ async function runMCPServer() {
189
217
 
190
218
  // Uninstall MCP Voice Hooks
191
219
  async function uninstall() {
192
- const claudeSettingsPath = path.join(process.cwd(), '.claude', 'settings.json');
220
+ const claudeDir = path.join(process.cwd(), '.claude');
221
+ const settingsLocalPath = path.join(claudeDir, 'settings.local.json');
222
+ const settingsPath = path.join(claudeDir, 'settings.json');
193
223
 
194
- // Remove voice hooks from Claude settings
195
- if (fs.existsSync(claudeSettingsPath)) {
196
- try {
197
- console.log('⚙️ Removing voice hooks from Claude settings...');
224
+ // Helper function to remove hooks from a settings file
225
+ async function removeHooksFromFile(filePath, fileName) {
226
+ if (fs.existsSync(filePath)) {
227
+ try {
228
+ console.log(`⚙️ Removing voice hooks from ${fileName}...`);
198
229
 
199
- const settingsContent = fs.readFileSync(claudeSettingsPath, 'utf8');
200
- const settings = JSON.parse(settingsContent);
230
+ const settingsContent = fs.readFileSync(filePath, 'utf8');
231
+ const settings = JSON.parse(settingsContent);
201
232
 
202
- if (settings.hooks) {
203
- // Remove voice hooks
204
- const cleanedHooks = removeVoiceHooks(settings.hooks);
233
+ if (settings.hooks) {
234
+ // Remove voice hooks
235
+ const cleanedHooks = removeVoiceHooks(settings.hooks);
205
236
 
206
- if (Object.keys(cleanedHooks).length === 0) {
207
- // If no hooks remain, remove the hooks property entirely
208
- delete settings.hooks;
237
+ if (Object.keys(cleanedHooks).length === 0) {
238
+ // If no hooks remain, remove the hooks property entirely
239
+ delete settings.hooks;
240
+ } else {
241
+ settings.hooks = cleanedHooks;
242
+ }
243
+
244
+ // Write updated settings
245
+ fs.writeFileSync(filePath, JSON.stringify(settings, null, 2));
246
+ console.log(`✅ Removed voice hooks from ${fileName}`);
209
247
  } else {
210
- settings.hooks = cleanedHooks;
248
+ console.log(`ℹ️ No hooks found in ${fileName}`);
211
249
  }
212
-
213
- // Write updated settings
214
- fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2));
215
- console.log('✅ Removed voice hooks from Claude settings');
216
- } else {
217
- console.log('ℹ️ No hooks found in Claude settings');
250
+ } catch (error) {
251
+ console.log(`⚠️ Could not update ${fileName}:`, error.message);
218
252
  }
219
- } catch (error) {
220
- console.log('⚠️ Could not update Claude settings:', error.message);
221
253
  }
222
- } else {
223
- console.log('ℹ️ No Claude settings file found in current project');
224
254
  }
225
255
 
256
+ // Remove hooks from both settings.local.json and settings.json (for backwards compatibility)
257
+ await removeHooksFromFile(settingsLocalPath, 'settings.local.json');
258
+ await removeHooksFromFile(settingsPath, 'settings.json');
259
+
260
+ if (!fs.existsSync(settingsLocalPath) && !fs.existsSync(settingsPath)) {
261
+ console.log('ℹ️ No Claude settings files found in current project');
262
+ }
226
263
 
227
264
  console.log('\n✅ Uninstallation complete!');
228
265
  console.log('👋 MCP Voice Hooks has been removed.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-voice-hooks",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "bin": {