Contributing to Poltergeist
September 4, 2026 ยท View on GitHub
Thank you for your interest in contributing to Poltergeist! This guide covers both Node.js CLI and macOS app development.
๐ Getting Started
Prerequisites
- Node.js 24+ and pnpm 11 for CLI development
- Xcode 15+ with Command Line Tools for macOS app development
- Watchman installed (
brew install watchman) - SwiftLint and swift-format for Swift code quality (
brew install swiftlint swift-format)
Development Setup
# Clone the repository
git clone https://github.com/steipete/poltergeist.git
cd poltergeist
# Install CLI dependencies
pnpm install
# Build CLI
pnpm run build
# Verify setup
pnpm test
For macOS app development:
# Navigate to macOS app
cd apps/mac
# Open in Xcode
open Poltergeist.xcodeproj
# Or build from command line
xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist build
๐ Development Guidelines
Code Style & Quality
We prioritize code quality and proper refactoring over speed. All contributions must meet these standards:
Node.js/TypeScript Standards
- Type Safety First: Use proper TypeScript types, never
anyor workarounds - Modern JavaScript: ES2022+ features, async/await over promises
- Functional Style: Prefer immutable operations and pure functions
- Error Handling: Comprehensive error handling with proper typing
Swift Standards
- Swift 6: Strict concurrency checking enabled
- Modern Swift: Use latest language features and best practices
- Memory Safety: Proper
@MainActorusage and concurrency annotations - Architecture: Clean separation of concerns with proper abstractions
Code Quality Checks
Before submitting any PR, ensure all quality checks pass:
CLI/Node.js Checks
pnpm run build # TypeScript compilation
pnpm test # Test suite
pnpm run lint # Oxfmt formatting and Oxlint linting
pnpm run typecheck # Type validation
pnpm run format:check # Code formatting
macOS App Checks
cd apps/mac
./scripts/lint.sh # SwiftLint validation
./scripts/format.sh # swift-format fixes
xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist build
No Quick Fixes Policy
We follow a "No Quick Fixes" policy:
- โ No ignoring of linting errors or warnings
- โ No
@ts-ignoreor similar workarounds - โ No
// swiftlint:disableunless absolutely necessary - โ No band-aid solutions that don't address root causes
- โ Proper refactoring and type-safe solutions
- โ Clean code that removes unused imports and dead code
- โ Quality over speed in implementation
๐๏ธ Architecture Overview
CLI Architecture (Node.js/TypeScript)
src/
โโโ cli.ts # Command line interface entry point
โโโ builders/ # Target-specific build implementations
โ โโโ base-builder.ts # Abstract base class for all builders
โ โโโ executable-builder.ts
โ โโโ app-bundle-builder.ts
โ โโโ index.ts
โโโ utils/ # Utility modules
โ โโโ filesystem.ts # File system operations
โ โโโ process-manager.ts
โ โโโ config-manager.ts
โโโ poltergeist.ts # Core application logic
โโโ state.ts # State management system
โโโ build-queue.ts # Smart build queue management
โโโ priority-engine.ts # Intelligent priority scoring
โโโ watchman.ts # Watchman file watching integration
Key principles:
- Builder Pattern: Each target type has a dedicated builder
- State Management: Unified state system with atomic operations
- Queue Management: Intelligent build scheduling and deduplication
- Watchman Integration: Efficient file watching with smart exclusions
macOS App Architecture (Swift)
Poltergeist/
โโโ PoltergeistApp.swift # App entry point
โโโ Models/ # Data models
โ โโโ Project.swift # Project and target state models
โ โโโ Preferences.swift # User preferences
โโโ Services/ # Business logic services
โ โโโ ProjectMonitor.swift # Core monitoring service
โ โโโ NotificationManager.swift
โ โโโ FileWatcher.swift
โ โโโ IconLoader.swift
โโโ Features/ # UI components
โ โโโ StatusBarController.swift
โ โโโ StatusBarMenuView.swift
โ โโโ SettingsView.swift
โโโ Utils/ # Utility extensions
โโโ NSMenuItem+Extensions.swift
โโโ VisualEffectView.swift
Key principles:
- MVVM Architecture: Clear separation of UI and business logic
- SwiftUI + AppKit: Modern UI with legacy integration where needed
- Actor-based Concurrency: Proper
@MainActorusage for UI updates - Service-Oriented: Core functionality in dedicated service classes
๐ Development Workflow
1. Branch Strategy
- main: Production-ready code only
- feature/: New features (
feature/smart-notifications) - fix/: Bug fixes (
fix/build-queue-deadlock) - refactor/: Code improvements (
refactor/state-management)
2. Commit Message Format
type: Brief description (50 chars max)
Detailed explanation of what and why, not how.
Reference issues: Fixes #123, Closes #456
Breaking changes should be clearly noted.
Types: feat, fix, refactor, test, docs, ci, chore
3. Pull Request Process
-
Create Feature Branch
git checkout -b feature/your-feature-name -
Make Changes
- Follow code style guidelines
- Add/update tests for new functionality
- Update documentation as needed
-
Quality Checks
# CLI checks pnpm run build && pnpm test --run && pnpm run lint && pnpm run typecheck # macOS app checks (if applicable) cd apps/mac && ./scripts/lint.sh && ./scripts/format.sh -
Commit and Push
git add . git commit -m "feat: Add intelligent build prioritization" git push origin feature/your-feature-name -
Create Pull Request
- Clear title and description
- Reference related issues
- Include testing instructions
- Screenshots for UI changes
๐งช Testing Guidelines
CLI Testing
- Unit Tests: Test individual functions and classes
- Integration Tests: Test component interactions
- E2E Tests: Test complete workflows
- Performance Tests: Ensure scalability
# Run specific test files
pnpm test --run priority-engine.test.ts
# Run with coverage
pnpm run test:coverage
# Watch mode for development
pnpm test --watch
macOS App Testing
- Unit Tests: Test business logic and models
- UI Tests: Test user interface interactions
- Integration Tests: Test CLI/app communication
cd apps/mac
xcodebuild test -project Poltergeist.xcodeproj -scheme Poltergeist
Test Requirements
- New Features: Must include comprehensive tests
- Bug Fixes: Must include regression tests
- Coverage: Maintain >80% test coverage
- Performance: No degradation in existing benchmarks
๐ Documentation Standards
Code Documentation
- TypeScript: JSDoc comments for public APIs
- Swift: Swift documentation comments for public interfaces
- README Updates: Keep installation and usage instructions current
- Changelog: Document all user-facing changes
Documentation Requirements
- New Features: Update README with usage examples
- API Changes: Update API documentation
- Configuration: Document new config options
- Breaking Changes: Migration guides required
๐ Debugging & Troubleshooting
CLI Debugging
# Enable debug logging
POLTERGEIST_LOG_LEVEL=debug poltergeist haunt
# Verbose output
poltergeist haunt --verbose
# Check state files
ls -la /tmp/poltergeist/
cat /tmp/poltergeist/your-project-hash-target.state
macOS App Debugging
# Console logs
log stream --predicate 'subsystem BEGINSWITH "com.poltergeist"'
# Xcode debugging
# Set breakpoints and use Xcode's debugger
# Enable scheme debugging options for detailed output
Common Issues & Solutions
CLI Issues
- Watchman not found: Install with
brew install watchman - Permission errors: Check file permissions in
/tmp/poltergeist/ - Build hangs: Check for circular dependencies in build commands
- State corruption: Clean state with
poltergeist clean
macOS App Issues
- SwiftLint failures: Run
./scripts/lint.shto see specific violations - Build errors: Ensure Xcode Command Line Tools are installed
- Concurrency warnings: Review
@MainActorusage and async patterns
๐ CI/CD Integration
Our CI/CD pipeline automatically validates all contributions:
Automated Checks
- Multi-platform testing: Node.js 24 on Ubuntu, macOS, and Windows
- Swift 6 compilation: Strict concurrency and type checking
- Code quality: SwiftLint, swift-format, Oxfmt, Oxlint, TypeScript validation
- Test coverage: Comprehensive coverage reporting
- Security scanning: Dependency vulnerability checks
Release Process
- Automated releases: Tagged releases trigger dual-platform builds
- CLI packaging: npm package with proper semver
- macOS app distribution: Signed DMG and ZIP artifacts
- Release notes: Auto-generated from commit history
๐ก Contribution Ideas
CLI Enhancements
- New Build Targets: Support for additional languages/frameworks
- Performance Optimizations: Faster file watching and build detection
- Configuration Improvements: Enhanced project detection and setup
- Integration Features: IDE plugins, shell completions
macOS App Features
- Enhanced UI: Better build progress visualization
- System Integration: Touch Bar support, widgets
- Notification Improvements: Rich notifications with actions
- Performance Monitoring: Build analytics and insights
Cross-Platform Features
- State Synchronization: Better CLI/app integration
- Remote Monitoring: Network-based project monitoring
- Plugin System: Extensible architecture for custom builders
- Configuration Management: Shared configuration between CLI and app
๐ง Getting Help
- Issues: GitHub Issues for bugs and feature requests
- Discussions: GitHub Discussions for questions and ideas
- Code Review: All PRs receive thorough review and feedback
๐ Recognition
Contributors are recognized in:
- Changelog: All contributions documented
- README: Major contributors listed
- Release Notes: Contribution highlights in releases
Thank you for contributing to Poltergeist! Your efforts help make development workflows more efficient for developers worldwide. ๐