MCPcopy Create free account
hub / github.com/Noumena-Network/code / registerWindowsNativeHosts

Function registerWindowsNativeHosts

src/utils/claudeInChrome/setup.ts:273–301  ·  view source on GitHub ↗

* Register the native host in Windows registry for all supported browsers

(manifestPath: string)

Source from the content-addressed store, hash-verified

271 * Register the native host in Windows registry for all supported browsers
272 */
273function registerWindowsNativeHosts(manifestPath: string): void {
274 const registryKeys = getAllWindowsRegistryKeys()
275
276 for (const { browser, key } of registryKeys) {
277 const fullKey = `${key}\\${NATIVE_HOST_IDENTIFIER}`
278 // Use reg.exe to add the registry entry
279 // https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging
280 void execFileNoThrowWithCwd('reg', [
281 'add',
282 fullKey,
283 '/ve', // Set the default (unnamed) value
284 '/t',
285 'REG_SZ',
286 '/d',
287 manifestPath,
288 '/f', // Force overwrite without prompt
289 ]).then(result => {
290 if (result.code === 0) {
291 logForDebugging(
292 `[Code in Chrome] Registered native host for ${browser} in Windows registry: ${fullKey}`,
293 )
294 } else {
295 logForDebugging(
296 `[Code in Chrome] Failed to register native host for ${browser} in Windows registry: ${result.stderr}`,
297 )
298 }
299 })
300 }
301}
302
303/**
304 * Create a wrapper script in config-home/chrome/ (typically ~/.ncode/chrome/)

Callers 1

Calls 3

execFileNoThrowWithCwdFunction · 0.85
logForDebuggingFunction · 0.50

Tested by

no test coverage detected