Contributing
Phantom is open source (MIT) and we welcome contributions of all kinds.
Getting Started
- Fork the repository on GitHub.
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/Phantom.git cd phantom - Install dependencies:
npm install - Build the project:
npm run build - Run tests:
npm run test
Development Workflow
# Run the CLI locally
npm run phantom
# Or directly
node packages/cli/dist/index.js
# Run tests
npm run test
# Format code
npm run format
Project Structure
phantom/
├── packages/
│ ├── core/ # AI providers, config, context
│ ├── cli/ # Terminal interface & commands
│ ├── mcp-server/ # Model Context Protocol server
│ ├── tui/ # Terminal UI components
│ ├── modules/ # PM capability plugins
│ └── integrations/ # External tool connectors
├── tests/ # Smoke & contract tests
├── scripts/ # Build & release scripts
└── docs-site/ # This documentation (Docusaurus)
Adding a New AI Provider
- Create
packages/core/src/ai/providers/your-provider.ts. - Extend
BaseAIProviderand implementcomplete(),stream(),isAvailable(). - Add the provider to
AIManager.initializeProviders()inpackages/core/src/ai/manager.ts. - Add a config entry in
createAIManagerFromConfig().
Adding a New Module
- Create
packages/modules/src/your-module.ts. - Export a class implementing the module interface.
- Register the module in
packages/modules/src/index.ts.
Pull Request Guidelines
- Keep PRs focused on a single change.
- Add tests for new functionality.
- Follow existing code style (Prettier + ESLint).
- Update documentation if behavior changes.
Code Style
- TypeScript for all source code.
- Prettier for formatting (
npm run format). - No
anyunless absolutely necessary. - Descriptive names over comments.
Reporting Issues
- Use GitHub Issues.
- Include your OS, Node.js version, and steps to reproduce.
- Tag with appropriate labels (
bug,feature,docs).