Thank you for your interest in contributing to Molten! This document provides guidelines and instructions for contributing.
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Respect different viewpoints and experiences
- Check if the bug has already been reported in Issues
- If not, create a new issue with:
- Clear title and description
- Steps to reproduce
- Expected vs actual behavior
- System information (macOS version, hardware)
- Relevant logs or screenshots
- Check if the feature has already been suggested
- Open a new issue with:
- Clear description of the feature
- Use case and motivation
- Potential implementation approach (if you have ideas)
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Follow the code style guidelines
- Add tests if applicable
- Update documentation
- Commit your changes
Use clear, descriptive commit messages
git commit -m "Add: Description of your feature" - Push to your fork
git push origin feature/your-feature-name
- Open a Pull Request
- Provide a clear description
- Reference any related issues
- Wait for review and feedback
- macOS 14.0+ (Sonoma or later)
- Xcode 15.0+
- Apple Silicon Mac (for running)
- Git
-
Clone your fork
git clone https://github.com/yourusername/molten.git cd molten -
Add upstream remote
git remote add upstream https://github.com/originalusername/molten.git
-
Open in Xcode
open Molten.xcodeproj
-
Build the project
- Select the "Molten" scheme
- Press ⌘R to build and run
- Follow Swift API Design Guidelines
- Use Swift 6 language mode
- Prefer
async/awaitover completion handlers - Use
@Observablefor state management - Mark classes as
finalwhen not meant for subclassing
- Types: PascalCase (
ConversationStore,ChatMessage) - Functions: camelCase (
sendPrompt,loadModels) - Variables: camelCase (
conversationState,selectedModel) - Constants: camelCase for local, PascalCase for global
- Files: Match type names (
ConversationStore.swift)
- Add header comments to all files
- Document public APIs with doc comments
- Use
// MARK:to organize code sections - Explain complex logic with inline comments
/// Manages conversation state and message streaming.
///
/// This store coordinates between model providers and the UI,
/// handling streaming responses and analytics tracking.
@Observable
final class ConversationStore {
// MARK: - Properties
/// Current conversation state (loading, completed, error)
@MainActor var conversationState: ConversationState = .completed
// MARK: - Methods
/// Sends a prompt to the selected model provider
/// - Parameters:
/// - userPrompt: The user's message text
/// - model: The language model to use
/// - image: Optional image attachment
/// - systemPrompt: Optional system prompt for new conversations
@MainActor
func sendPrompt(
userPrompt: String,
model: LanguageModelSD,
image: Image? = nil,
systemPrompt: String = ""
) {
// Implementation
}
}- Add unit tests for business logic
- Test edge cases and error conditions
- Mock external dependencies (providers, network)
# In Xcode: ⌘U
# Or via command line:
xcodebuild test -scheme MoltenWhen adding new code:
- Services: Add to
Molten/Services/ - Stores: Add to
Molten/Stores/ - UI Components: Add to
Molten/UI/Shared/or platform-specific folders - Models: Add to
Molten/Models/orMolten/SwiftData/Models/ - Helpers: Add to
Molten/Helpers/ - Extensions: Add to
Molten/Extensions/
Use clear, descriptive commit messages:
Add: Feature description
Fix: Bug description
Refactor: What was refactored
Docs: Documentation update
Style: Code style changes
Test: Test additions/changes
Examples:
Add: Support for custom model providersFix: Memory leak in ConversationStoreRefactor: Extract analytics logic to separate serviceDocs: Update README with new features
- All PRs require at least one review
- Address review comments promptly
- Keep PRs focused (one feature/fix per PR)
- Keep PRs small when possible (easier to review)
- Open an issue for questions
- Check existing documentation
- Ask in discussions
Thank you for contributing to Molten! 🎉