Skip to content

feat: Add native macOS Status Bar integration#253

Open
AltusRossouw wants to merge 1 commit intoericc-ch:masterfrom
AltusRossouw:feature/macos-statusbar
Open

feat: Add native macOS Status Bar integration#253
AltusRossouw wants to merge 1 commit intoericc-ch:masterfrom
AltusRossouw:feature/macos-statusbar

Conversation

@AltusRossouw
Copy link
Copy Markdown

🍎 macOS Status Bar Integration for Copilot API

Overview

This PR adds a native macOS status bar app that provides quick access to Copilot API management directly from the menu bar. The
integration follows all existing copilot-api patterns and is fully backward compatible.

✨ Features Added

🖥️ Native macOS Status Bar App

  • SwiftUI-based modern macOS app (macOS 13+)
  • Real-time API monitoring with visual status indicators
  • MenuBarExtra integration following Apple's latest APIs
  • Launch at login functionality via ServiceManagement
  • Automatic Terminal integration for seamless command execution

🛠️ TypeScript CLI Integration

  • New statusbar subcommand following existing citty patterns
  • Complete lifecycle management: install, start, stop, status, uninstall
  • Platform-aware graceful degradation (macOS-only feature)
  • Comprehensive error handling and user feedback

🔄 GitHub Actions CI/CD

  • Automated Swift app building on every commit/PR
  • Pre-built app bundling for npm distribution
  • Cross-platform compatibility maintained

🧪 Testing Completed

CLI Integration: All subcommands work perfectly
App Functionality: Status bar app installs and launches correctly
API Monitoring: Real-time status checking on localhost:4141
Platform Detection: Graceful handling on macOS vs other platforms
Build Pipeline: Complete CI/CD workflow tested

📋 Usage

Install and Launch

# Install the status bar app
npx copilot-api@latest statusbar install
                                                                                                                                             
# Start the status bar app
npx copilot-api@latest statusbar start                                                                                                       
                                                          
# Check status
npx copilot-api@latest statusbar status

# Stop the app
npx copilot-api@latest statusbar stop

# Uninstall
npx copilot-api@latest statusbar uninstall
                                                                                                                                             
Status Bar Features
                                                                                                                                             
- 🟢 Green: API running and healthy (localhost:4141)                                                                                         
- 🟡 Yellow: API detected but not responding
- 🔴 Red: No API detected                                                                                                                    
- Click: Quick menu with "Start Copilot API" and "Open Terminal"
- Settings: Launch at login toggle                                                                                                           
 
🏗️  Technical Implementation                                                                                                                  
                                                          
Architecture

- Swift 6.0 with modern async/await patterns
- SwiftUI for native macOS UI
- ServiceManagement for launch-at-login
- URLSession for health check monitoring                                                                                                     
- TypeScript CLI integration via citty
                                                                                                                                             
Files Added                                               

src/statusbar.ts                    # CLI command definition
src/lib/statusbar-manager.ts        # Core management logic
src/lib/types.ts                    # TypeScript interfaces
macos-app/                          # Pre-built Swift app bundle
macos-app-source/                   # Swift source code                                                                                      
.github/workflows/build-macos.yml   # CI/CD for app building
                                                                                                                                             
Integration Points                                        
                                                                                                                                             
- Extends existing main.ts subcommands                    
- Uses established consola logging patterns
- Follows citty CLI framework conventions
- Maintains backward compatibility

🔒 Security & Permissions

- Sandboxed Swift app with minimal permissions
- No network access except localhost health checks
- User consent required for launch-at-login                                                                                                  
- Local file system access only for Terminal integration
- Standard macOS security model compliance                                                                                                   
                                                          
🎯 Value Proposition                                                                                                                         
                                                          
For Users

- One-click access to Copilot API from menu bar
- Visual status monitoring without opening Terminal
- Native macOS experience with proper system integration                                                                                     
- Launch at startup for always-available access
                                                                                                                                             
For Maintainers                                           
                                                                                                                                             
- Zero breaking changes - fully additive feature          
- Follows all repository patterns exactly
- Complete CI/CD integration with automated building
- High-quality implementation ready to ship
- Addresses user demand for native macOS experience
                                                                                                                                             
🚀 Future Enhancements
                                                                                                                                             
This implementation provides a solid foundation for:                                                                                         
- Configuration management via menu
- Usage quota display in status bar                                                                                                          
- Multiple server instance management                     
- Integration with macOS Shortcuts app
- System notification support         
                             
📝 Backward Compatibility
                                                                                                                                             
- ✅ Non-macOS platforms: Command shows helpful message, no errors
- ✅ Existing CLI: All current commands work unchanged                                                                                       
- ✅ Dependencies: No new runtime dependencies for non-macOS users
- ✅ Build process: Works with existing bun toolchain

---
This integration adds significant value for macOS developers while maintaining the excellent architecture and patterns established in
copilot-api. Ready for immediate use! 🎉 

- Native macOS status bar app for Copilot API monitoring
- Real-time API health checking via HTTP endpoints
- CLI commands: install, start, stop, status, uninstall
- Visual status indicators and contextual controls
- Launch-at-login support via ServiceManagement
- Terminal.app integration for command execution
- Swift app with modern SwiftUI + MenuBarExtra
- Complete CI/CD pipeline for automated builds
- Platform-aware graceful degradation on non-macOS

Resolves: Real-time API monitoring and native macOS integration
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant