This guide covers setting up your development environment and contributing to pkm-app.
- macOS 13.0+ (Ventura or later)
- Swift 5.9+ (comes with Xcode 15+)
- Xcode 15.0+ (recommended for development)
- Swift Package Manager (included with Swift)
git clone https://github.com/mbarnett2011/pkm-app.git
cd pkm-appswift buildThis will:
- Resolve dependencies (Yams, swift-markdown)
- Compile all Swift sources
- Generate the executable in
.build/debug/
swift runThis launches the menu bar application. You should see the PKM icon appear in your macOS menu bar.
swift testThis runs the test suite in Tests/PKMAppTests/.
pkm-app/
├── Sources/
│ └── PKMApp/
│ ├── PKMApp.swift # Main entry point (@main)
│ ├── AppDelegate.swift # AppKit app delegate
│ ├── MenuBarController.swift # Menu bar UI controller
│ ├── Views/ # SwiftUI views
│ ├── Models/ # Data models (Phase 2)
│ └── Services/ # Business logic (Phase 2)
├── Tests/
│ └── PKMAppTests/ # Unit tests
├── Package.swift # SPM manifest
└── README.md # Project overview
- MVVM (Model-View-ViewModel): SwiftUI views use view models for state management
- Actor Isolation: File I/O operations use Swift actors to prevent data races
- Append-Only Semantics: Never overwrite existing PKM content, only append
- YAML Frontmatter Preservation: Parse, modify, and serialize without corruption
- Swift Actors for File I/O: All file system operations run in isolated actors to ensure thread safety
- Append-Only Daily Notes: Briefings and content are appended, never overwriting user data
- YAML-Safe Parsing: Uses Yams library to preserve frontmatter structure
- Menu Bar First: Native macOS menu bar UI for quick access (not a window-based app)
Managed via Swift Package Manager in Package.swift:
- Yams - YAML parsing for frontmatter
- swift-markdown - Markdown parsing (planned for Phase 2)
To update dependencies:
swift package updatePhase 1 focused on scaffolding and menu bar UI:
- Menu bar app appears in macOS status bar
- Basic SwiftUI views and AppKit integration
- Project structure and SPM configuration
Phase 2 will add data models and file operations:
DailyNote.swift- Daily note representationGoal.swift- Goal hierarchy (3-year → quarterly → monthly)FileService.swift(actor) - Read/write markdown filesFrontmatterParser.swift- YAML frontmatter parsing
See ROADMAP.md for full phase breakdown.
swift build -c releaseThe optimized executable will be at .build/release/PKMApp.
To create a macOS app bundle (future work):
- Use Xcode to build the app
- Archive and export as .app bundle
- Sign and notarize for distribution
- Write tests for all business logic in
Services/andModels/ - Use
XCTestframework (standard Swift testing) - Mock file I/O using protocols and dependency injection
- Test YAML frontmatter parsing edge cases (empty, malformed, missing)
swift test --filter PKMAppTests.FileServiceTests- Open
Package.swiftin Xcode - Set breakpoints in Swift source files
- Run via Product → Run (⌘R)
- Use Xcode's debugger and console
lldb .build/debug/PKMApp
(lldb) run- Follow Swift API Design Guidelines
- Use SwiftLint (optional, not yet configured)
- Prefer
actoroverDispatchQueuefor concurrency - Use
async/awaitover completion handlers - Document public APIs with DocC-style comments
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make changes and add tests
- Run tests (
swift test) - Commit with descriptive messages
- Push and open a Pull Request
See .github/PULL_REQUEST_TEMPLATE.md for PR guidelines.
Issue: "error: manifest parse error(s)"
Fix: Check Package.swift syntax. Ensure Swift tools version matches your installation:
swift --versionIssue: "Cannot find 'Yams' in scope"
Fix: Resolve dependencies:
swift package resolve
swift buildIssue: App doesn't appear in menu bar
Fix: Check MenuBarController.swift initialization. Ensure NSStatusBar.system.statusItem(withLength:) is called on main thread.
Issue: Permission errors reading PKM vault
Fix: Grant Full Disk Access to the app in System Preferences → Security & Privacy → Privacy → Full Disk Access.
Open an issue on GitHub or check existing issues for common questions.