botlib/PROMPT.md

114 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2026-01-22 20:24:03 -03:00
# BotLib Development Guide
2025-12-04 12:28:10 -03:00
2026-01-22 20:24:03 -03:00
**Version:** 6.2.0
**Purpose:** Shared library for General Bots workspace
2025-12-04 12:28:10 -03:00
---
2025-12-21 23:40:41 -03:00
## ZERO TOLERANCE POLICY
2025-12-21 23:40:41 -03:00
**EVERY SINGLE WARNING MUST BE FIXED. NO EXCEPTIONS.**
---
2026-01-22 20:24:03 -03:00
## ❌ ABSOLUTE PROHIBITIONS
2025-12-04 12:28:10 -03:00
```
2026-01-22 20:24:03 -03:00
❌ NEVER use #![allow()] or #[allow()] in source code
❌ NEVER use _ prefix for unused variables - DELETE or USE them
2025-12-21 23:40:41 -03:00
❌ NEVER use .unwrap() - use ? or proper error handling
❌ NEVER use .expect() - use ? or proper error handling
2026-01-22 20:24:03 -03:00
❌ NEVER use panic!() or unreachable!()
❌ NEVER use todo!() or unimplemented!()
❌ NEVER leave unused imports or dead code
❌ NEVER add comments - code must be self-documenting
2025-12-04 12:28:10 -03:00
```
---
2026-01-22 20:24:03 -03:00
## 🏗️ MODULE STRUCTURE
2025-12-04 12:28:10 -03:00
```
2026-01-22 20:24:03 -03:00
src/
├── lib.rs # Public exports, feature gates
├── error.rs # Error types (thiserror)
├── models.rs # Shared data models
├── message_types.rs # Message type definitions
├── http_client.rs # HTTP client wrapper (feature-gated)
├── branding.rs # Version, branding constants
└── version.rs # Version information
```
2025-12-04 12:28:10 -03:00
2025-12-21 23:40:41 -03:00
---
2025-12-04 12:28:10 -03:00
2026-01-22 20:24:03 -03:00
## ✅ MANDATORY CODE PATTERNS
2025-12-04 12:28:10 -03:00
2026-01-22 20:24:03 -03:00
### Error Handling
2025-12-04 12:28:10 -03:00
2025-12-21 23:40:41 -03:00
```rust
// ❌ WRONG
let value = something.unwrap();
2025-12-04 12:28:10 -03:00
2025-12-21 23:40:41 -03:00
// ✅ CORRECT
let value = something?;
let value = something.ok_or_else(|| Error::NotFound)?;
2025-12-04 12:28:10 -03:00
```
2026-01-22 20:24:03 -03:00
### Self Usage
2025-12-04 12:28:10 -03:00
```rust
2025-12-21 23:40:41 -03:00
impl MyStruct {
2026-01-22 20:24:03 -03:00
fn new() -> Self { Self { } } // ✅ Not MyStruct
2025-12-04 12:28:10 -03:00
}
```
2026-01-22 20:24:03 -03:00
### Format Strings
2025-12-04 12:28:10 -03:00
```rust
2026-01-22 20:24:03 -03:00
format!("Hello {name}") // ✅ Not format!("{}", name)
2025-12-04 12:28:10 -03:00
```
2025-12-21 23:40:41 -03:00
### Display vs ToString
2025-12-04 12:28:10 -03:00
```rust
2025-12-21 23:40:41 -03:00
// ❌ WRONG
impl ToString for MyType { }
2025-12-04 12:28:10 -03:00
2025-12-21 23:40:41 -03:00
// ✅ CORRECT
impl std::fmt::Display for MyType { }
2025-12-04 12:28:10 -03:00
```
2025-12-21 23:40:41 -03:00
### Derive Eq with PartialEq
2025-12-04 12:28:10 -03:00
```rust
2026-01-22 20:24:03 -03:00
#[derive(PartialEq, Eq)] // ✅ Always both
2025-12-21 23:40:41 -03:00
struct MyStruct { }
2025-12-04 12:28:10 -03:00
```
---
2026-01-22 20:24:03 -03:00
## 📦 KEY DEPENDENCIES
2025-12-21 23:40:41 -03:00
| Library | Version | Purpose |
|---------|---------|---------|
| anyhow | 1.0 | Error handling |
| thiserror | 2.0 | Error derive |
| chrono | 0.4 | Date/time |
| serde | 1.0 | Serialization |
| uuid | 1.11 | UUIDs |
| diesel | 2.1 | Database ORM |
| reqwest | 0.12 | HTTP client |
---
2026-01-22 20:24:03 -03:00
## 🔑 REMEMBER
2025-12-21 23:40:41 -03:00
- **ZERO WARNINGS** - Every clippy warning must be fixed
- **NO ALLOW IN CODE** - Never use #[allow()] in source files
2026-01-22 20:24:03 -03:00
- **NO DEAD CODE** - Delete unused code
- **NO UNWRAP/EXPECT** - Use ? operator
- **INLINE FORMAT ARGS** - `format!("{name}")` not `format!("{}", name)`
2025-12-21 23:40:41 -03:00
- **USE SELF** - In impl blocks, use Self not the type name
- **DERIVE EQ** - Always derive Eq with PartialEq
- **DISPLAY NOT TOSTRING** - Implement Display, not ToString
2026-01-22 20:24:03 -03:00
- **Version 6.2.0** - do not change without approval