You can run the full stack using Earthly. From the project root, execute the following command:
earthly lsThis will list all the available targets. You can then run the full stack using the following command:
earthly +pipelineThis will build the full stack using Earthly.
Thank you for your interest in contributing to Terraphim AI! This guide will help you get started with the development environment and contribution workflow.
-
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/terraphim-ai.git cd terraphim-ai -
Set up development environment:
# Install pre-commit hooks for code quality ./scripts/install-hooks.sh # Install sample data for system_operator role git clone https://github.com/terraphim/INCOSE-Systems-Engineering-Handbook.git /tmp/system_operator/
-
Configure Git remotes (if working with private code):
# Add private repository remote git remote add private git@github.com:zestic-ai/terraphim-private.git -
Start development servers:
# Terminal 1: Backend server cargo run # Terminal 2: Frontend (web) cd desktop yarn install yarn run dev # Alternative: Desktop app yarn run tauri dev # Alternative: Terminal interface cargo run --bin terraphim-tui
- Rust: Install via rustup
- Node.js: Version 18+
- Yarn: Package manager for JavaScript dependencies
- Git: For version control
Our project uses automated code quality checks. Run this once:
./scripts/install-hooks.shThis installs pre-commit hooks that will:
- Format Rust code with
cargo fmt - Lint Rust code with
cargo clippy - Format JavaScript/TypeScript with Biome
- Validate commit message format
- Check for secrets and large files
- Ensure consistent code style
No Python required! The script supports multiple hook managers (prek, lefthook, or native Git hooks).
We use Conventional Commits format:
<type>(<scope>): <description>
Examples:
feat: add user authentication system
fix(api): resolve memory leak in handler
docs(readme): update installation steps
chore(deps): bump tokio to 1.35.0
Valid types: feat, fix, docs, style, refactor, perf, test, chore, build, ci, revert
- Rust: Automatically formatted with
cargo fmt - JavaScript/TypeScript: Uses Biome for linting and formatting
- Configuration: Pre-commit hooks enforce these standards
If you want to develop without using Earthly, you need a local Node.js, Yarn, and Rust environment.
git clone https://github.com/terraphim/INCOSE-Systems-Engineering-Handbook.git /tmp/system_operator/cargo runcd desktop
yarn install
yarn run devYou can also run the full stack using Earthly. From the project root:
# List available targets
earthly ls
# Build full stack
earthly +pipeline# Run all Rust tests
cargo test --workspace
# Run specific crate tests
cargo test -p terraphim_service
# Run frontend tests
cd desktop
yarn test
# Run end-to-end tests
yarn run e2e- Add unit tests for new functionality
- Include integration tests for API endpoints
- Frontend components should have corresponding tests
- Use descriptive test names following Rust conventions
Terraphim AI uses a dual-repository approach for security:
- Public Repository (
terraphim/terraphim-ai): Open-source code only - Private Repository (
zestic-ai/terraphim-private): Proprietary and sensitive code
# Feature branches
feat/new-ui-component
feat/semantic-search
fix/memory-leak
docs/update-readme
refactor/cleanup-code
test/add-unit-tests
# Development branches
wip/experimental-feature
experimental/new-algorithm# Private patterns (will be blocked by pre-push hook)
private-feature # Use private repository instead
private_tf # Use private repository instead
internal-api # Use private repository instead
internal_docs # Use private repository instead
client-data # Use private repository instead
client_config # Use private repository instead
secret-auth # Use private repository instead
secret_key # Use private repository instead
wip-private-feature # Use private repository instead
customer-data # Use private repository instead
proprietary-code # Use private repository instead
confidential-docs # Use private repository insteadThe repository has a comprehensive pre-push hook that automatically:
- Validates branch names against private patterns
- Scans commit messages for private markers (
[PRIVATE],[INTERNAL], etc.) - Checks file contents for sensitive keywords
- Validates file patterns using
.gitprivateignore - Provides clear error messages with guidance
If you need to work with private or sensitive code:
-
Switch to private repository:
git remote set-url origin git@github.com:zestic-ai/terraphim-private.git
-
Create private branch:
git checkout -b private-feature # or git checkout -b internal-api -
Develop normally:
git add . git commit -m "feat: add private feature" git push origin private-feature
-
Switch back to public (when ready for open-source work):
git remote set-url origin https://github.com/terraphim/terraphim-ai.git
✗ Branch 'private_tf' matches private pattern '^private_'
Private branches should not be pushed to public remotes.
Push to private remote instead: git push private private_tfSolution:
# Configure branch to push to private remote
git config branch.private_tf.remote private
git config branch.private_tf.pushRemote private
# Push to private repository
git push private private_tf✗ Sensitive keyword 'truthforge' found in file changes
Remove sensitive content before pushing to public remote.Solution:
- Remove or replace sensitive content
- Use private repository for sensitive development
- Update
.gitprivateignoreif it's a false positive
-
Create a feature branch:
git checkout -b feat/your-feature-name
-
Make your changes:
- Follow our code style (enforced by pre-commit hooks)
- Add tests for new functionality
- Update documentation if needed
- Ensure no private/sensitive content
-
Commit with conventional format:
git commit -m "feat: add semantic search improvements" -
Push and create PR:
git push origin feat/your-feature-name
Then create a Pull Request on GitHub.
-
PR Requirements:
- All tests pass
- Code follows style guidelines (automatic via hooks)
- Commit messages follow conventional format
- Documentation updated if needed
- No breaking changes without justification
- No private/sensitive content (enforced by pre-push hook)
terraphim-ai/
├── crates/ # Rust library crates
│ ├── terraphim_service/ # Main service logic
│ ├── terraphim_config/ # Configuration management
│ ├── terraphim_tui/ # Terminal UI
│ └── ... # Other crates
├── desktop/ # Svelte frontend + Tauri app
├── terraphim_server/ # HTTP server binary
├── scripts/ # Development scripts
│ ├── hooks/ # Native Git hooks
│ └── install-hooks.sh # Hook installation script
├── docs/ # Documentation
└── .pre-commit-config.yaml # Code quality configuration
- Follow Rust API Guidelines
- Use
cargo fmtfor formatting (automatic via hooks) - Address all
cargo clippywarnings - Add comprehensive documentation for public APIs
- Use
#[cfg(test)]for test modules
- Use TypeScript for type safety
- Follow component-based architecture
- Use Biome for formatting and linting (automatic via hooks)
- Keep components small and focused
- Add proper error handling
Follow Conventional Commits:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for formatting changesrefactor:for code refactoringtest:for adding testschore:for maintenance tasks
- Update README.md for user-facing changes
- Add inline code documentation
- Update API documentation for breaking changes
- Include examples in documentation
- Discord: Join our Discord server for real-time discussion
- Discourse: Visit our community forum for detailed discussions
- GitHub Issues: Report bugs and request features
- Documentation: Check our development setup guide
We are committed to providing a welcoming and inclusive experience for everyone. Please be respectful and constructive in all interactions.
By contributing to Terraphim AI, you agree that your contributions will be licensed under the Apache 2.0 License.