Twingate Raycast Extension
A powerful Raycast extension that allows you to quickly browse, search, and access your Twingate resources directly from Raycast.
π Features
Resource Management
- π Advanced Search: Search resources by name, address, network, or alias with multi-term support
- β Favorites System: Mark frequently used resources as favorites with priority sorting
- π Recent Resources: Track and quickly access recently used resources
- π One-Click Access: Open resources directly in your browser
- π Copy Actions: Copy URLs, addresses, aliases, and resource names
Enhanced User Experience
- π Resource Details: View network names, aliases, and connection status
- π― Smart Sorting: Favorites-first sorting in search, chronological in recent
- β‘ Fast Performance: Cached API calls with intelligent refresh
- π Debug Mode: Comprehensive logging and debugging tools
- β¨οΈ Customizable Shortcuts: Personalize all keyboard shortcuts
Developer Features
- π API Monitoring: Request/response logging with performance metrics
- π§ Cache Management: Intelligent caching with hit/miss tracking
- π€ Debug Export: Export logs for troubleshooting
- βοΈ Preferences Integration: Native Raycast settings integration
π¦ Installation
From Raycast Store
- Open Raycast (
Cmd+Space
)
- Type "Store" and press Enter
- Search for "Twingate"
- Click "Install"
Manual Installation
- Clone this repository
- Run
npm install
- Run
npm run dev
to start development mode
- The extension will appear in Raycast
βοΈ Configuration
Required Settings
- Open Raycast Preferences (
Cmd+,
)
- Navigate to Extensions β Twingate
- Configure required fields:
- API Key: Your Twingate API key from the admin console
- Network URL: Your Twingate network URL (e.g.,
https://company.twingate.com
)
Optional Customization
Customize keyboard shortcuts for all actions:
- Global Actions: Refresh Resources, Clear Data, Debug Mode, Export Logs
- Resource Actions: Toggle Favorite, Copy URL, Copy Address, Copy Alias, Copy Name, Open Main Search
Default Shortcuts:
Cmd+R
- Refresh Resources
Cmd+F
- Toggle Favorite
Cmd+C
- Copy URL
Cmd+Shift+C
- Copy Address
Cmd+Opt+C
- Copy Alias
Cmd+Shift+Opt+C
- Copy Resource Name
Cmd+O
- Open Main Search
Cmd+Shift+X
- Clear All Data
Cmd+Shift+D
- Toggle Debug Mode
Cmd+Shift+L
- Export Debug Logs
π― Usage
Search Resources Command
- Launch: Type "Search Resources" in Raycast
- Search: Type to filter by name, address, network, or alias
- Multi-term: Use multiple words for refined searches
- Access: Press Enter to open resource in browser
- Favorites:
Cmd+F
to mark/unmark favorites
- Copy: Various copy shortcuts for different resource properties
Recent Resources Command
- Launch: Type "Recent Resources" in Raycast
- View History: See chronologically sorted recent access
- Quick Access: Resources show last accessed time
- Open Main Search:
Cmd+O
to search for specific resource
- Favorites: Mark recent resources as favorites (maintains chronological order)
Debug Features
- Toggle Debug:
Cmd+Shift+D
on any resource
- Export Logs:
Cmd+Shift+L
to copy logs to clipboard
- Performance Monitoring: Track API calls, cache hits, and response times
- Session-based: Debug mode resets between Raycast sessions
π§ Development
Prerequisites
- Node.js 18+
- npm or yarn
- Raycast installed
Setup
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Lint code
npm run lint
# Fix linting issues
npm run fix-lint
Project Structure
src/
βββ api/ # Twingate API integration
β βββ twingate.ts # GraphQL client and queries
βββ components/ # Shared React components
β βββ ResourceListItem.tsx
βββ hooks/ # Custom React hooks
β βββ useFavorites.ts
βββ utils/ # Utility functions
β βββ storage.ts # Local storage management
β βββ debug.ts # Debug logging system
β βββ shortcuts.ts # Shortcut parsing utilities
βββ types.ts # TypeScript type definitions
βββ search-resources.tsx # Main search command
βββ recent-resources.tsx # Recent resources command
Architecture
Data Flow:
- API Layer (
api/twingate.ts
) - GraphQL queries to Twingate API
- Storage Layer (
utils/storage.ts
) - LocalStorage for favorites/recent
- Components - Shared UI components with props
- Commands - Individual Raycast commands
- Hooks - Shared state management (favorites, caching)
Key Patterns:
- Cached Promises: Using
@raycast/utils
for API caching
- Shared Components: DRY principle with ResourceListItem
- Preference Integration: Native Raycast settings
- Debug System: Comprehensive logging with export capabilities
π§ͺ Testing
Manual Testing
- Search Functionality: Test multi-term search across all fields
- Favorites: Add/remove favorites, verify sorting behavior
- Recent Resources: Access resources, verify timestamp updates
- Shortcuts: Test all keyboard shortcuts work correctly
- Debug Mode: Enable debug, perform actions, export logs
- Preferences: Modify shortcuts, verify they take effect
API Testing
# Test API connectivity
npm run dev
# Use debug mode to monitor API calls
π Commands
Command | Description | Default Shortcut |
---|
Search Resources | Browse and search all Twingate resources | - |
Recent Resources | View recently accessed resources | - |
π€ Contributing
Guidelines
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
Code Standards
- TypeScript: Strict typing required
- ESLint: Follow the configured rules
- Prettier: Use for code formatting
- Components: Use functional components with hooks
- Error Handling: Comprehensive error handling with user feedback
Debug Information
When reporting issues, please include:
- Raycast version
- Extension version
- Debug logs (export via
Cmd+Shift+L
)
- Steps to reproduce
- Expected vs actual behavior
π Security
- API Keys: Stored securely in Raycast preferences
- Local Storage: Only non-sensitive data (favorites, recent resources)
- Network: All communication over HTTPS
- No Telemetry: No usage tracking or data collection
π License
MIT License - see LICENSE file for details.
π Support
Common Issues
"Failed to Load Resources"
- Verify API key is correct
- Check network URL format (
https://company.twingate.com
)
- Ensure API key has proper permissions
"No Resources Found"
- Try broader search terms
- Check if resources exist in Twingate admin console
- Verify you have access to resources
Shortcuts Not Working
- Check shortcut format in preferences (
cmd+shift+c
)
- Avoid conflicts with system shortcuts
- Use supported modifiers:
cmd
, ctrl
, opt
, shift
Getting Help
- Enable Debug Mode (
Cmd+Shift+D
)
- Reproduce the issue
- Export Debug Logs (
Cmd+Shift+L
)
- Create an issue with logs and steps to reproduce
Built with β€οΈ for the Raycast community