| layout | page |
|---|---|
| title | Onboarding |
| nav_order | 2 |
| description | Onboarding guide for Code-Forge |
| permalink | /onboarding |
Code-Forge is a sophisticated AI-powered coding assistant platform built in Rust, designed to provide intelligent code generation, manipulation, and analysis capabilities through a modular and extensible architecture.
-
Domain Layer (
forge_domain)- Defines core domain models and interfaces
- Handles chat requests/responses
- Manages tool definitions and executions
- Provides conversation management
-
Provider Layer (
forge_provider)- Implements AI model integration (OpenRouter)
- Handles API communication
- Manages model parameters and configurations
-
Tool Layer (
forge_tool)- Implements various coding tools:
- File system operations (read, write, search, replace)
- Shell command execution
- Code outline generation
- Thinking framework for complex problem-solving
- Implements various coding tools:
-
Server Layer (
forge_services)- Provides HTTP API endpoints
- Manages database operations
- Handles conversation persistence
- Implements system configurations
-
File System Operations
- Read/Write capabilities
- Directory listing
- File search with regex support
- Smart file replacement with diff blocks
- Code validation for multiple languages
-
Code Analysis
- Language-aware code parsing
- Function and class outline generation
- Support for Rust, JavaScript, and Python
- Syntax validation
-
Conversation Management
- Persistent conversations
- Context management
- Title generation
- History tracking
-
Tool Framework
- Extensible tool system
- JSON schema-based tool definitions
- Asynchronous tool execution
- Error handling and validation
The system uses SQLite with migrations for:
- Conversation storage
- Configuration management
- System settings
- Uses OpenRouter as the AI provider
- Supports multiple AI models
- Implements streaming responses
- Handles tool-augmented conversations
-
Language Support
- Rust validation and parsing
- JavaScript/TypeScript support
- Python code analysis
- Extensible language framework
-
Tool Implementation
- File system tools with safety checks
- Shell command execution with security measures
- Code outline generation using tree-sitter
- Think framework for reasoning
- Define tool interface in
forge_domain - Implement tool in
forge_tool - Add tool registration in tool service
- Update tool definitions and schemas
- Comprehensive test coverage
- Snapshot testing for responses
- Integration tests for tools
- Mock providers for testing
-
File System Safety
- Path validation
- Permission checks
- Content validation
-
Shell Command Security
- Command whitelisting
- Working directory restrictions
- Input sanitization
Required configurations:
- Database URL
- API Keys
- Model configurations
- System paths
- Rust toolchain
- SQLite
- Tree-sitter (for code analysis)
- Shell access (for command execution)
- Set up environment variables
- Run database migrations
- Build and start the server
- Initialize configurations
-
Modularity
- Clear separation of concerns
- Domain-driven design
- Interface-based communication
-
Error Handling
- Custom error types
- Proper error propagation
- Informative error messages
-
Async Design
- Asynchronous operations
- Stream processing
- Resource management
-
Testing Strategy
- Unit tests
- Integration tests
- Snapshot testing
- Mock services
The system is designed for extension through:
- New tool implementations
- Additional language support
- Alternative AI providers
- Custom conversation handlers
-
Performance Optimization
- Caching strategies
- Response optimization
- Resource pooling
-
Feature Extensions
- Additional language support
- More sophisticated code analysis
- Enhanced security measures
-
Integration Capabilities
- IDE plugins
- CI/CD integration
- Version control system integration