Thank you for your interest in contributing to Poltergeist! This guide covers both Node.js CLI and macOS app development.
- Node.js 24+ and pnpm 11 for CLI development
- Xcode 27 with Command Line Tools for macOS app development (CI uses the Apple Silicon
xcode-27runner) - Watchman installed (
brew install watchman) - SwiftLint and swift-format for Swift code quality (
brew install swiftlint swift-format)
# 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 testFor 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 buildWe prioritize code quality and proper refactoring over speed. All contributions must meet these 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 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
Before submitting any PR, ensure all quality checks pass:
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 formattingcd apps/mac
./scripts/lint.sh # SwiftLint validation
./scripts/format.sh # swift-format fixes
xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist buildWe 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
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
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
- main: Production-ready code only
- feature/: New features (
feature/smart-notifications) - fix/: Bug fixes (
fix/build-queue-deadlock) - refactor/: Code improvements (
refactor/state-management)
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
-
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
- 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- 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- New Features: Must include comprehensive tests
- Bug Fixes: Must include regression tests
- Coverage: Maintain >80% test coverage
- Performance: No degradation in existing benchmarks
- 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
- New Features: Update README with usage examples
- API Changes: Update API documentation
- Configuration: Document new config options
- Breaking Changes: Migration guides required
# 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# 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- 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
- 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
Our CI/CD pipeline automatically validates all contributions:
- 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
- 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
- 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
- Enhanced UI: Better build progress visualization
- System Integration: Touch Bar support, widgets
- Notification Improvements: Rich notifications with actions
- Performance Monitoring: Build analytics and insights
- 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
- Issues: GitHub Issues for bugs and feature requests
- Discussions: GitHub Discussions for questions and ideas
- Code Review: All PRs receive thorough review and feedback
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. 🚀