Core Principles
Extension Compatibility
The app must be compatible with existing Raycast extensions without requiring modifications to extension code.
Runtime Control
All changes and enhancements are implemented in SuperCmd itself, not in extensions, since we cannot control extension code at runtime.
API Parity
Keep APIs in sync with
@raycast/api and track implementation status against the official Raycast API.Progressive Enhancement
Gradually implement all Raycast APIs to achieve full parity.
Tech Stack
- Electron - Main process for system integration
- React - UI framework for the renderer
- Vite - Build tool and dev server
- TypeScript - Type-safe development
- Swift - Native macOS integrations
Project Structure
Extension Execution Model
SuperCmd’s extension system is designed to run Raycast extensions without modification:Extension Loading
Extensions are loaded from the Raycast extension registry and stored locally in the
extensions/ directory.Code Bundling
Extension code is bundled using esbuild to CommonJS format for Node.js-style
require() compatibility.Runtime Shim
A custom
require() function provides:- React - Shared instance with the host app
- @raycast/api - SuperCmd’s compatibility layer
- @raycast/utils - Utility hooks and functions
src/main/extension-runner.ts:25API Compatibility Layer
Thesrc/renderer/src/raycast-api/ directory contains runtime modules that provide a comprehensive compatibility shim:
- Intercepts imports - All
@raycast/apiand@raycast/utilsimports from extensions - React-compatible components - Provides React implementations of Raycast components
- IPC bridge - Bridges to Electron main process for system-level operations
- API compatibility - Maintains compatibility while allowing internal enhancements
Key Runtime Modules
| Module | Purpose |
|---|---|
index.tsx | Integration/export surface for @raycast/api + @raycast/utils |
action-runtime*.tsx | Action/ActionPanel registry + overlay runtime |
list-runtime*.tsx | List runtime (item registry, renderers, detail) |
form-runtime*.tsx | Form runtime (container + fields + context) |
grid-runtime*.tsx | Grid runtime (item registry + renderer + container) |
icon-runtime*.tsx | Icon resolution and rendering (Phosphor icons, asset handling) |
oauth/* | OAuth flow implementation for extensions |
hooks/* | Extracted hooks like useFetch, usePromise, useAI, etc. |
See CLAUDE.md for a complete file map and API implementation status.
Code Organization Guidelines
When working on SuperCmd, follow these organization principles:Electron Architecture
Main Process
Handles system operations and extension management:- Window management - Overlay window with transparency (
main.ts:45) - IPC handlers - Communication bridge with renderer (
main.ts:120-450) - Extension execution - Bundles and runs extensions (
extension-runner.ts) - Settings persistence - JSON settings storage (
settings-store.ts) - AI provider - Streaming responses from OpenAI/Anthropic/Ollama (
ai-provider.ts)
Renderer Process
UI rendering and extension execution:- React UI - Component-based interface
- Raycast API shim - Extension compatibility layer
- Extension views - Live extension rendering (
ExtensionView.tsx) - Settings UI - Configuration interface (
settings/)
Preload Script
Secure IPC bridge between main and renderer:- Context bridge - Exposes
window.electronAPI to renderer (preload.ts:15) - Type safety - TypeScript types in
renderer/types/electron.d.ts
System Integration
macOS Features
Native Swift modules provide macOS-specific functionality:- Global hotkeys - System-wide keyboard shortcuts (
hotkey-hold-monitor.swift) - Window management - Overlay window control (
window-adjust.swift) - Color picker - Native macOS color picker (
color-picker.swift) - Speech recognition - Speech-to-text (
speech-recognizer.swift) - Snippet expansion - Text snippet insertion (
snippet-expander.swift)
Extension Registry
SuperCmd integrates with the Raycast extension registry:- Browse extensions - Access the full catalog
- Install extensions - Download and install from registry
- Manage extensions - Enable/disable installed extensions
- Update extensions - Keep extensions up to date
src/main/extension-registry.ts:100-250
AI Integration
SuperCmd supports multiple AI providers:- Ollama - Local AI models (
ai-provider.ts:50) - OpenAI - Cloud-based AI via OpenAI API (
ai-provider.ts:100) - Anthropic (Claude) - Via Anthropic API (
ai-provider.ts:150)
environment.canAccess(AI) and cached for performance.
Settings Storage
All app settings are persisted in:- AI provider configuration and API keys
- Extension preferences
- UI preferences
- Hotkey bindings
src/main/settings-store.ts:20
Next Steps
- Set up your development environment
- Learn about building and packaging
- Review API implementation status