A macOS application for generating and executing Swift code using LLMs.
⚠️ SAFETY DISCLAIMER: This application executes code generated by Large Language Models (LLMs) directly on your machine without. There are inherent security risks in executing AI-generated code without checking. Use at your own risk and review all generated code carefully before execution. The author is not responsible for any damage, data loss, or security breaches that may result from using this application.
JarvisMacControll is a macOS application that allows you to generate Swift code using AI services (Claude or OpenAI) and execute it directly on your Mac. Simply type in a natural language prompt describing what you want to achieve, and the LLM will generate the corresponding Swift code, which can then be executed immediately.
- AI-Powered Code Generation: Generate Swift code from natural language prompts using:
- OpenAI GPT-4 API
- Anthropic Claude API
- Code Execution: Execute the generated Swift code directly within the application
- Flexible Architecture: Switch between different AI providers through a clean interface-based design
- Modern UI: Built with SwiftUI for a responsive and native macOS experience
- macOS Sonoma (14.5) or later
- Xcode 16.0 or later
- API keys for Claude and/or OpenAI
-
Clone the repository:
git clone https://github.com/yourusername/JarvisMacControll.git cd JarvisMacControll -
Open the project in Xcode:
open JarvisMacControll.xcodeproj
-
Configure your API keys:
- In Xcode, go to
Product>Scheme>Edit Scheme... - Select the
Runaction and go to theEnvironment Variablestab - Add the following environment variables:
CLAUDE_API_KEY: Your Anthropic Claude API keyOPENAI_API_KEY: Your OpenAI API key
- In Xcode, go to
-
Build and run the application
The project follows a clean architecture approach with the following components:
-
Domain: Contains business logic interfaces
AICodeGeneratorService: Interface for AI code generation servicesCodeExecutorService: Interface for executing generated code
-
Infrastructure: Contains implementations of domain interfaces
ClaudeAICodeGeneratorService: Implementation using Anthropic's Claude APIOpenAICodeGeneratorService: Implementation using OpenAI's APISwiftCodeExecutorService: Implementation for executing Swift codeAppConfig: Configuration management
-
Presentation: Contains UI components
CodeGeneratorViewModel: View model for the code generation UIContentView: Main SwiftUI view
-
Application: Contains app-level components
DependencyContainer: Manages dependencies and servicesJarvisMacControllApp: Main application entry point
The project uses the following Swift packages:
- SwiftAnthropic: Client for the Claude API
- OpenAI: Client for the OpenAI API
- Launch the application
- Enter a natural language prompt describing the Swift code you want to generate
- Click "Generate Code" or press ⌘+Return
- Review the generated code
- Click "Execute Code" or press ⌘+Shift+Return to run the code
Example prompts:
- "Create a simple to-do list app with the ability to add, delete and mark tasks as completed"
- "Write code to fetch and display the current weather for a given city"
- "Generate a basic calculator with addition, subtraction, multiplication, and division"
This application requires API keys for Claude and OpenAI. These keys are stored in environment variables and used at runtime. Be careful not to share your project with the API keys included.
