Speed up recipe loading from deeplinks and various fixes (#3662)

This commit is contained in:
Zane
2025-07-28 14:17:43 -07:00
committed by GitHub
parent c7425694f8
commit 85c77474df
9 changed files with 321 additions and 61 deletions
+16 -1
View File
@@ -6,4 +6,19 @@ Put `goosey` in your $PATH if you want to launch via:
goosey .
```
This will open goose GUI from any path you specify
This will open goose GUI from any path you specify
# Unregister Deeplink Protocols (macos only)
`unregister-deeplink-protocols.js` is a script to unregister the deeplink protocol used by goose like `goose://`.
This is handy when you want to test deeplinks with the development version of Goose.
# Usage
To unregister the deeplink protocols, run the following command in your terminal:
Then launch Goose again and your deeplinks should work from the latest launched goose application as it is registered on startup.
```bash
node scripts/unregister-deeplink-protocols.js
```
+95
View File
@@ -0,0 +1,95 @@
#!/usr/bin/env node
/**
* Script to unregister ALL goose:// protocol handlers
* Usage: node scripts/unregister-deeplink-protocols.js
*/
const { execSync } = require('child_process');
const PROTOCOL = 'goose';
function unregisterAllProtocolHandlers() {
console.log('Unregistering ALL goose:// protocol handlers...');
try {
// Get all registered Goose apps
console.log('Finding all registered Goose applications...');
const lsregisterOutput = execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -B 10 -A 10 "claimed schemes:.*${PROTOCOL}:"`, { encoding: 'utf8' });
// Extract app paths from the output
const pathMatches = lsregisterOutput.match(/path:\s+(.+\.app)/g);
const uniquePaths = new Set();
if (pathMatches) {
pathMatches.forEach(match => {
const path = match.replace(/path:\s+/, '').trim();
if (path.includes('Goose') || path.includes('goose')) {
uniquePaths.add(path);
}
});
}
console.log(`Found ${uniquePaths.size} Goose app(s) to unregister:`);
uniquePaths.forEach(path => console.log(` - ${path}`));
// Unregister each app
let unregisteredCount = 0;
uniquePaths.forEach(appPath => {
try {
console.log(`Unregistering: ${appPath}`);
execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u "${appPath}"`, { stdio: 'ignore' });
unregisteredCount++;
} catch (error) {
console.log(` Warning: Could not unregister ${appPath} (may already be unregistered)`);
}
});
// Also try to unregister by bundle identifier
console.log('\nUnregistering by bundle identifier...');
const bundleIds = [
'com.electron.goose',
'com.block.goose',
'com.block.goose.dev'
];
bundleIds.forEach(bundleId => {
try {
console.log(`Unregistering bundle: ${bundleId}`);
execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u "${bundleId}"`, { stdio: 'ignore' });
} catch (error) {
// Ignore errors for bundle IDs that don't exist
}
});
// Clean up temporary files
console.log('\nCleaning up temporary files...');
try {
execSync('rm -rf /tmp/GooseDevApp.app', { stdio: 'ignore' });
} catch (error) {
// Ignore cleanup errors
}
// Force Launch Services to rebuild its database
console.log('Rebuilding Launch Services database...');
try {
execSync('/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user', { stdio: 'ignore' });
} catch (error) {
console.log('Warning: Could not rebuild Launch Services database');
}
console.log(`\n✅ Successfully processed ${unregisteredCount} Goose applications`);
console.log('All goose:// protocol handlers have been unregistered.');
console.log('\nNote: You may need to restart your system for changes to take full effect.');
} catch (error) {
console.error('Error during unregistration:', error.message);
console.log('\nManual cleanup options:');
console.log('1. Use Activity Monitor to quit all Goose processes');
console.log('2. Delete Goose apps from Applications folder');
console.log('3. Run: sudo /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user');
}
}
// Run the unregistration immediately
unregisterAllProtocolHandlers();