-
Notifications
You must be signed in to change notification settings - Fork 1
Add GitHub Copilot instructions for repository #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,179 @@ | ||||||
| # GitHub Copilot Instructions for RustIRC | ||||||
|
|
||||||
| ## Project Overview | ||||||
|
|
||||||
| RustIRC is a modern IRC client built in Rust that combines the best features from established IRC clients (mIRC, HexChat, WeeChat). The project prioritizes full IRC protocol compliance (RFC 1459/2812, IRCv3), cross-platform support (Windows, macOS, Linux), and provides multiple interface modes (GUI with Iced 0.13.1, TUI with ratatui, CLI). | ||||||
|
|
||||||
| **Current Version**: v0.3.8 - Enhanced Iced Material Design GUI | ||||||
| **Status**: Production-ready with 100% functional Material Design 3 implementation | ||||||
|
|
||||||
| ## Technology Stack | ||||||
|
|
||||||
| - **Language**: Rust (MSRV: 1.75+) | ||||||
| - **Async Runtime**: Tokio for network I/O | ||||||
| - **GUI Framework**: Iced 0.13.1 with Material Design 3 components | ||||||
| - **TUI Framework**: ratatui for terminal interface | ||||||
| - **Security**: rustls for TLS, complete SASL authentication (PLAIN, EXTERNAL, SCRAM-SHA-256) | ||||||
| - **Scripting**: mlua for Lua integration | ||||||
| - **Architecture**: Event-driven with modular 6-crate workspace structure | ||||||
|
|
||||||
| ## Essential Commands | ||||||
|
|
||||||
| ### Building and Running | ||||||
| ```bash | ||||||
| # Build the project | ||||||
| cargo build | ||||||
| cargo build --release | ||||||
|
|
||||||
| # Run in different modes | ||||||
| cargo run # GUI mode (default) | ||||||
| cargo run -- --cli # CLI prototype mode | ||||||
| cargo run -- --tui # TUI mode with ratatui | ||||||
| cargo run -- --config path/to/config.toml # Custom config | ||||||
|
|
||||||
| # Run tests | ||||||
| cargo test | ||||||
| cargo test -- --nocapture # Show println! output | ||||||
| ``` | ||||||
|
|
||||||
| ### Code Quality | ||||||
| ```bash | ||||||
| # Format code (required before commits) | ||||||
| cargo fmt | ||||||
|
|
||||||
| # Lint code (must pass before commits) | ||||||
| cargo clippy -- -D warnings | ||||||
|
|
||||||
| # Pre-commit check | ||||||
| cargo fmt --check && cargo clippy -- -D warnings | ||||||
|
|
||||||
| # Generate documentation | ||||||
| cargo doc --open | ||||||
| ``` | ||||||
|
|
||||||
| ## Coding Standards | ||||||
|
|
||||||
| ### Critical Rules | ||||||
| 1. **Zero Placeholder Code**: Never leave "TODO" or "In a real implementation" comments. Implement all functionality completely. | ||||||
| 2. **No Removal Strategy**: Fix compilation errors by implementing missing functionality, never by removing/disabling features. | ||||||
| 3. **Complete Platform Support**: Implement full Windows (PowerShell), macOS (osascript), Linux (notify-send) support using conditional compilation. | ||||||
| 4. **Error Handling**: Always use proper Result types with descriptive error messages. Follow Rust error handling idioms. | ||||||
| 5. **Memory Safety**: Leverage Rust's ownership model. Use references appropriately, avoid unnecessary clones unless required for lifetime management. | ||||||
|
|
||||||
| ### Rust Best Practices | ||||||
| - Follow Rust naming conventions (snake_case for functions/variables, CamelCase for types) | ||||||
| - Use `async/await` with Tokio for all network operations | ||||||
| - Implement proper trait bounds and lifetime annotations | ||||||
| - Disable pagers in git commands: `git --no-pager` | ||||||
| - Use `#[cfg(target_os = "...")]` for platform-specific code | ||||||
|
|
||||||
| ### IRC Protocol Specifics | ||||||
| - **Field Naming**: Verify against protocol definitions (e.g., WHOIS uses `targets` not `target`) | ||||||
| - **Message Filtering**: Handle case-sensitive filtering (both "System" and "system") | ||||||
| - **Command Implementation**: Use `rustirc_protocol::Command` for IRC method implementation | ||||||
| - **Protocol Compliance**: Full support for RFC 1459/2812 and IRCv3 extensions | ||||||
|
|
||||||
| ### GUI Development (Iced 0.13.1) | ||||||
| - Use proper border syntax with `0.0.into()` for radius | ||||||
| - Apply container styling for pane dividers | ||||||
| - Implement Material Design 3 patterns with SerializableColor wrapper | ||||||
| - Use `.into()` conversions for automatic color type conversions | ||||||
| - Handle lifetime issues with clone-before-move pattern | ||||||
|
|
||||||
| ## Common Patterns | ||||||
|
|
||||||
| ### Compilation Error Resolution | ||||||
| 1. **Type Mismatches**: Convert types properly using Into/From traits | ||||||
| 2. **Lifetime Issues**: Use clone-before-move pattern: `let value = data.clone(); move || { use value }` | ||||||
| 3. **Borrow Checker**: Extract values before closures to satisfy borrow checker | ||||||
| 4. **Platform Code**: Use conditional compilation with complete implementations | ||||||
|
|
||||||
| ### Multi-Server Architecture | ||||||
| - Use `HashMap<String, ServerData>` for server management | ||||||
| - Check server-specific connection state before IRC operations | ||||||
| - Implement proper command routing with server validation | ||||||
| - Provide informative error messages for unavailable servers | ||||||
|
|
||||||
| ### Material Design 3 Integration | ||||||
| - SerializableColor wrapper for config persistence: `[f32; 4]` with serde traits | ||||||
| - Implement `.scale_alpha()` for transparency adjustments | ||||||
| - Use `.build()` APIs for MaterialText/MaterialButton components | ||||||
| - Apply responsive layouts with proper enum traits | ||||||
|
|
||||||
| ## Testing Strategy | ||||||
| - Unit tests for protocol commands | ||||||
| - Integration tests for connection scenarios | ||||||
| - Mock IRC servers for edge cases | ||||||
| - UI tests using framework-specific tools | ||||||
| - Performance benchmarks for message throughput | ||||||
| - Security audits for input validation | ||||||
|
|
||||||
| ## GitHub Actions / CI/CD | ||||||
| - BASH_ENV helper functions required for cross-platform timeout support | ||||||
| - sccache HTTP 400 fallback to local disk cache | ||||||
| - Timeout protection for all cargo operations | ||||||
| - Clippy must run AFTER successful build completion | ||||||
| - All platforms must pass: Windows, Linux (x64/ARM64), macOS (x64/ARM64) | ||||||
|
|
||||||
| ## Directory Structure | ||||||
| ``` | ||||||
| RustIRC/ | ||||||
| ├── src/ # Application entry point and main logic | ||||||
| ├── crates/ # Modular crate structure (6 crates) | ||||||
| ├── tests/ # Integration tests | ||||||
| ├── docs/ # User documentation | ||||||
| ├── ref_docs/ # Reference materials and development plans | ||||||
| ├── to-dos/ # Phase-specific task lists | ||||||
| ├── .github/ # GitHub workflows and configurations | ||||||
| └── scripts/ # Development and build scripts | ||||||
| ``` | ||||||
|
|
||||||
| ## Security Considerations | ||||||
| - All network communication over TLS by default | ||||||
| - Secure credential storage (system keychain integration) | ||||||
| - Sandboxed scripting environment | ||||||
| - Input validation against malformed IRC messages | ||||||
| - DCC security warnings and IP masking options | ||||||
|
|
||||||
| ## Documentation Requirements | ||||||
| - Maintain rustdoc comments for all public APIs | ||||||
| - Include examples in documentation | ||||||
| - Update CHANGELOG.md for all user-facing changes | ||||||
| - Keep README.md badges and status up to date | ||||||
| - Document all architectural decisions | ||||||
|
|
||||||
| ## Performance Goals | ||||||
| - Handle 100+ simultaneous channels without lag | ||||||
| - Efficient user list management with optimized data structures | ||||||
| - Background logging and message processing | ||||||
| - Responsive UI even under heavy message load | ||||||
| - 60 FPS animations in GUI mode | ||||||
|
|
||||||
| ## Common Pitfalls to Avoid | ||||||
| ❌ Running clippy before or parallel to build | ||||||
|
||||||
| ❌ Running clippy before or parallel to build | |
| ❌ Running clippy before the build completes or in parallel with the build |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Git-specific guidance seems out of place in a "Rust Best Practices" section. Consider moving this to a more appropriate section like "Essential Commands" or creating a separate "Version Control" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback