Atharva AI is a powerful, open-source Xcode extension and macOS app that brings intelligent AI-powered code completion, refactoring, and code analysis directly to Xcode. Think of it as GitHub Copilot specifically designed for the Apple development ecosystem.
- Intelligent Code Completion: Context-aware suggestions with multi-line code generation
- Smart Refactoring: AI-powered code restructuring and optimization
- Code Analysis: Detect bugs, suggest improvements, and explain complex code
- Documentation Generation: Auto-generate comments and documentation
- Test Generation: Create unit tests based on your code
- Swift: Full support with iOS/macOS framework awareness
- Objective-C: Legacy code support and modernization suggestions
- C/C++: System-level programming assistance
- Python: Cross-platform scripting support
- JavaScript/TypeScript: Web development integration
- More languages: Extensible architecture for additional language support
- OpenAI GPT Models: GPT-3.5, GPT-4, and custom fine-tuned models
- Anthropic Claude: Claude-3 and Claude-2 support
- Custom Endpoints: Support for self-hosted or enterprise AI models
- Multiple Providers: Switch between providers based on task type
- Context-Aware Processing: Understands project structure and dependencies
- Caching System: Intelligent caching for improved performance
- Offline Mode: Basic functionality without internet connection
- Privacy-First: No data logging or telemetry
- Customizable Prompts: Tailor AI behavior to your coding style
- macOS: 12.0 (Monterey) or later
- Xcode: 14.0 or later
- Swift: 5.7+ for development
- Memory: 8GB RAM minimum, 16GB recommended
- Storage: 500MB for installation
- Network: Internet connection for AI API calls
- Apple Developer account (for code signing and distribution)
- Valid API key from supported AI provider
- Basic understanding of Xcode extension architecture
-
Download the Latest Release
# Download from GitHub releases curl -L https://github.com/your-org/atharva-ai/releases/latest/download/Atharva-AI.dmg -o Atharva-AI.dmg -
Install the Application
- Mount the DMG file
- Drag
Atharva AI.appto Applications folder - Launch the app and grant necessary permissions
-
Enable System Extension
- Go to System Preferences β Extensions β Xcode Source Editor
- Check the box next to "Atharva AI"
- Restart Xcode for changes to take effect
-
Clone the Repository
git clone https://github.com/your-org/atharva-ai.git cd atharva-ai -
Open in Xcode
open Atharva-XCode-AI-Agent.xcodeproj
-
Configure Signing
- Select your development team in project settings
- Update bundle identifiers if needed
- Ensure both app and extension targets are properly signed
-
Build and Run
- Build the project (β+B)
- Run the host application (β+R)
- Follow system extension enablement steps above
-
Launch Atharva AI
- Open the host application from Applications folder
- The configuration window will appear automatically
-
Configure AI Provider
Provider: OpenAI / Claude / Custom API Key: [Your API key] Model: gpt-4 / claude-3-sonnet / custom-model Base URL: [For custom providers] -
Adjust Settings
- Max Tokens: 256-2048 (controls response length)
- Temperature: 0.1-1.0 (creativity vs consistency)
- Context Window: Number of lines to include as context
- Auto-completion: Enable/disable real-time suggestions
{
"completion_prompt": "Complete the following code:\n{context}\n\nProvide only the completion:",
"refactor_prompt": "Refactor this code for better readability:\n{code}",
"explain_prompt": "Explain what this code does:\n{code}"
}- Cache Duration: How long to keep cached responses (default: 5 minutes)
- Request Timeout: Maximum wait time for API responses (default: 30 seconds)
- Retry Attempts: Number of retry attempts for failed requests (default: 3)
- Position Cursor: Place cursor where you want AI assistance
- Trigger Command: Use keyboard shortcut (β+Shift+A) or Editor menu
- Review Suggestion: AI-generated code appears inline
- Accept/Reject: Press Tab to accept or Esc to dismiss
- Select Code Block: Highlight the code you want to refactor
- Open Refactor Menu: Editor β Atharva AI β Refactor Code
- Choose Refactoring Type:
- Optimize performance
- Improve readability
- Add error handling
- Convert to modern syntax
class UserManager {
private var users: [User] = []
func addUser(_ user: User) {
// Cursor here - AI understands the class context
// Suggests: users.append(user)
}
}// Type: "create a function to validate email"
// AI generates complete function with validation logic
func validateEmail(_ email: String) -> Bool {
let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailPredicate = NSPredicate(format:"SELF MATCHES %@", emailRegex)
return emailPredicate.evaluate(with: email)
}# Check if extension is enabled
defaults read com.apple.dt.Xcode XCSourceEditorCommand
# Reset Xcode preferences if needed
rm -rf ~/Library/Developer/Xcode/UserData- Verify API key is correct and has sufficient credits
- Check internet connection and firewall settings
- Ensure the AI provider service is operational
- Reduce context window size in settings
- Clear application cache: Atharva AI β Clear Cache
- Restart Xcode and the host application
Enable debug logging for detailed troubleshooting:
# Enable debug mode
defaults write com.atharva.ai.extension DebugMode -bool true
# View logs
tail -f ~/Library/Logs/Atharva-AI/extension.logAtharva AI/
βββ Host App/ # Main macOS application
β βββ Atharva_AIApp.swift # App lifecycle management
β βββ ContentView.swift # Main UI components
β βββ SettingsView.swift # Configuration interface
β βββ KeychainManager.swift # Secure credential storage
βββ Extension/ # Xcode Source Editor Extension
β βββ SourceEditorExtension.swift # Extension entry point
β βββ Commands/ # Command implementations
β β βββ AICompletionCommand.swift # Code completion logic
β β βββ AIRefactorCommand.swift # Refactoring operations
β β βββ AIExplainCommand.swift # Code explanation
β βββ Core/ # Core functionality
β β βββ AIHelper.swift # AI API communication
β β βββ ContextExtractor.swift # Code context analysis
β β βββ CodeInserter.swift # Text manipulation
β β βββ CacheManager.swift # Response caching
β βββ Models/ # Data structures
β βββ CompletionRequest.swift # API request models
β βββ AIResponse.swift # API response models
β βββ Configuration.swift # Settings models
βββ Shared/ # Shared resources
βββ Constants.swift # App-wide constants
βββ Extensions.swift # Utility extensions
βββ Resources/ # Assets and localization
Central component managing AI provider communication:
class AIHelper {
private let config: AIProviderConfig
private let cache: CacheManager
private let session: URLSession
func fetchCompletion(for context: CompletionContext) async throws -> String
func fetchRefactoring(for code: String, type: RefactoringType) async throws -> String
}Intelligent code context analysis:
class ContextExtractor {
func extractContext(from buffer: XCSourceTextBuffer,
around selection: XCSourceTextRange) -> CompletionContext
func detectLanguage(from uti: String) -> ProgrammingLanguage
func findRelevantImports(in lines: [String]) -> [String]
}- Complete Tutorial: Step-by-step development guide
- Framework Integration: Using Atharva AI in your projects
- API Reference: Detailed API documentation
- Contributing Guide: How to contribute to the project
- No Data Collection: We don't collect or store your code
- Local Processing: Context analysis happens locally
- Secure Transmission: All API calls use HTTPS with certificate pinning
- API Key Security: Keys stored in macOS Keychain with encryption
- Opt-in Telemetry: Anonymous usage statistics (disabled by default)
- Code Filtering: Ability to exclude sensitive files/directories
- Offline Mode: Basic functionality without network access
- Audit Trail: Log all AI interactions for security review
We welcome contributions! Please see our Contributing Guide for details.
# Fork and clone the repository
git clone https://github.com/your-username/atharva-ai.git
# Create a development branch
git checkout -b feature/your-feature
# Make changes and test thoroughly
# Submit a pull request- Additional AI provider integrations
- New programming language support
- Performance optimizations
- UI/UX improvements
- Documentation and tutorials
MIT License - see LICENSE file for details.
- OpenAI for GPT models and API
- Anthropic for Claude AI
- Apple for Xcode extension framework
- The open-source community for inspiration and feedback
- GitHub Issues: Report bugs or request features
- Documentation: Comprehensive guides and tutorials
- Community: Join our Discord server
- Email: support@atharva-ai.com
Made with β€οΈ for the Apple development community