2025-12-04 12:30:05 -03:00
# BotApp Development Prompt Guide
**Version:** 6.1.0
**Purpose:** LLM context for BotApp desktop application development
---
2025-12-18 16:18:19 -03:00
## Weekly Maintenance - EVERY MONDAY
### Package Review Checklist
**Every Monday, review the following:**
1. **Dependency Updates**
```bash
cargo outdated
cargo audit
```
2. **Package Consolidation Opportunities**
- Check if new crates can replace custom code
- Look for crates that combine multiple dependencies
- Review `Cargo.toml` for redundant dependencies
3. **Code Reduction Candidates**
- Custom implementations that now have crate equivalents
- Boilerplate that can be replaced with derive macros
- Tauri plugin replacements for custom code
4. **Tauri Plugin Updates**
```bash
# Check for new Tauri plugins that simplify code
# Review tauri-plugin-* ecosystem
```
### Packages to Watch
| Area | Potential Packages | Purpose |
|------|-------------------|---------|
| Dialogs | `tauri-plugin-dialog` | Native file dialogs |
| Notifications | `tauri-plugin-notification` | System notifications |
| Clipboard | `tauri-plugin-clipboard` | Clipboard access |
| Auto-update | `tauri-plugin-updater` | App updates |
---
Add rclone sync for desktop, rename docs chapters, clarify admin/user views
Desktop Sync (botapp):
- Add src/desktop/sync.rs with rclone-based file synchronization
- Support Push, Pull, and Bisync modes
- Commands: get_sync_status, start_sync, stop_sync, configure_remote
- Check rclone installation, list remotes, manage sync folder
- Register all sync commands in Tauri invoke handler
Server (botserver):
- Update /files/sync/* endpoints to indicate desktop-only feature
- Add is_desktop and message fields to SyncStatus struct
- Web users see clear message that sync requires desktop app
Documentation (botbook):
- Rename chapter-09-api -> chapter-09-tools (LLM Tools)
- Rename chapter-10-api -> chapter-10-rest (REST Endpoints)
- Add admin-user-views.md explaining User vs Admin interfaces
- Document all /api/user/* and /api/admin/* endpoint patterns
- Update Drive docs with sync feature and requirements
- Fix all cross-references to renamed chapters
Deferred: Billing APIs (Dec 1, 2024 placeholder remains)
2025-12-05 06:50:32 -03:00
## Official Icons - MANDATORY
**NEVER generate icons with LLM. ALWAYS use official SVG icons from assets.**
Icons are stored in:
- `botui/ui/suite/assets/icons/` - Runtime icons (source of truth)
### Available App Icons
| Icon | File | Usage |
|------|------|-------|
| Logo | `gb-logo.svg` | Main GB branding |
| Bot | `gb-bot.svg` | Bot/assistant |
| Analytics | `gb-analytics.svg` | Charts, dashboards |
| Calendar | `gb-calendar.svg` | Scheduling |
| Chat | `gb-chat.svg` | Messaging |
| Compliance | `gb-compliance.svg` | Security |
| Designer | `gb-designer.svg` | Workflows |
| Drive | `gb-drive.svg` | File storage |
| Mail | `gb-mail.svg` | Email |
| Meet | `gb-meet.svg` | Video calls |
| Paper | `gb-paper.svg` | Documents |
| Research | `gb-research.svg` | Search |
| Sources | `gb-sources.svg` | Knowledge |
| Tasks | `gb-tasks.svg` | Task management |
### Icon Guidelines
- All icons use `stroke="currentColor"` for theming
- ViewBox: `0 0 24 24`
- Stroke width: `1.5`
- Rounded line caps and joins
**DO NOT:**
- Generate new icons with AI/LLM
- Use emoji or unicode symbols as icons
- Use external icon libraries
- Create inline SVG content
---
2025-12-04 12:30:05 -03:00
## Project Overview
BotApp is a **Tauri-based desktop wrapper** for General Bots. It provides native desktop experience by wrapping botui's web interface with Tauri's native window capabilities.
### Workspace Position
```
botapp/ # THIS PROJECT - Desktop app wrapper
botui/ # Web UI (consumed by botapp)
botserver/ # Main server (business logic)
botlib/ # Shared library
botbook/ # Documentation
```
### What BotApp Provides
- **Native Desktop Window**: Tauri-powered native application
- **System Tray**: Background operation with tray icon
- **File Dialogs**: Native file picker integration
- **Desktop Notifications**: OS-level notifications
- **Auto-Update**: Built-in update mechanism (future)
---
## Quick Start
```bash
# Ensure botserver is running
cd ../botserver & & cargo run &
# Development mode
cd botapp
cargo tauri dev
# Production build
cargo tauri build
```
---
## Architecture
### Tauri Structure
```
botapp/
├── src/
│ └── main.rs # Rust backend, Tauri commands
├── ui/ # Frontend assets
│ └── app-guides/ # App-specific HTML
├── js/
│ └── app-extensions.js # JavaScript extensions
├── icons/ # App icons (all sizes)
├── tauri.conf.json # Tauri configuration
├── Cargo.toml # Rust dependencies
└── build.rs # Build script
```
### Communication Flow
```
Native UI (HTML/CSS/JS)
↓ Tauri IPC (invoke)
Rust #[tauri::command]
↓ HTTP (reqwest)
2025-12-12 23:20:08 -03:00
botserver API
2025-12-04 12:30:05 -03:00
↓
Business Logic + Database
```
---
## Code Generation Rules
### CRITICAL REQUIREMENTS
```
- Tauri commands must be async-safe
- All file operations use Tauri APIs
- No direct filesystem access from JS
- Desktop-specific features only in botapp
- Shared logic stays in botserver
- Zero warnings required
```
### Tauri Command Pattern
```rust
use tauri::command;
#[command]
pub async fn my_command(
window: tauri::Window,
param: String,
) -> Result< MyResponse , String > {
// Implementation
Ok(MyResponse { /* ... */ })
}
// Register in main.rs
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![
my_command,
])
.run(tauri::generate_context!())
.expect("error running app");
}
```
### JavaScript Invocation
```javascript
// From frontend
const result = await window.__TAURI__.invoke('my_command', {
param: 'value'
});
```
---
## Feature Flags
```toml
[features]
default = ["desktop"]
desktop = []
desktop-tray = ["dep:ksni", "dep:trayicon"]
```
---
## Dependencies
| Library | Version | Purpose |
|---------|---------|---------|
| tauri | 2 | Desktop framework |
| tauri-plugin-dialog | 2 | File dialogs |
| tauri-plugin-opener | 2 | URL/file opener |
| botlib | path | Shared types |
| reqwest | 0.12 | HTTP client |
| tokio | 1.41 | Async runtime |
---
## Platform-Specific Code
### Unix (Linux/macOS)
```rust
#[cfg(unix)]
use ksni; // System tray on Linux
```
### Windows
```rust
#[cfg(windows)]
use trayicon; // System tray on Windows
use image; // Icon handling
```
---
## Tauri Configuration (tauri.conf.json)
2025-12-12 16:39:43 -03:00
Key settings (Tauri v2 format):
2025-12-04 12:30:05 -03:00
```json
{
2025-12-12 16:39:43 -03:00
"$schema": "https://schema.tauri.app/config/2",
"productName": "General Bots",
"version": "6.1.0",
"identifier": "br.com.pragmatismo.botapp",
2025-12-04 12:30:05 -03:00
"build": {
2025-12-12 16:39:43 -03:00
"devUrl": "http://localhost:3000",
"frontendDist": "../botui/ui/suite"
2025-12-04 12:30:05 -03:00
},
2025-12-12 16:39:43 -03:00
"app": {
"security": {
"csp": null
2025-12-04 12:30:05 -03:00
},
"windows": [{
"title": "General Bots",
"width": 1200,
2025-12-12 16:39:43 -03:00
"height": 800,
"resizable": true,
"fullscreen": false
2025-12-04 12:30:05 -03:00
}]
2025-12-12 16:39:43 -03:00
},
"bundle": {
"active": true,
"targets": "all",
"icon": []
2025-12-04 12:30:05 -03:00
}
}
```
---
## Adding Features
### Process
1. **Check if feature belongs here** - Only desktop-specific features
2. **Add Tauri command** in `src/main.rs`
3. **Register handler** in `tauri::Builder`
4. **Add JS invocation** in `js/app-extensions.js`
5. **Update UI** if needed
### Example: Add Screenshot
```rust
// src/main.rs
#[tauri::command]
async fn take_screenshot(window: tauri::Window) -> Result< Vec < u8 > , String> {
// Use platform-specific screenshot API
Ok(screenshot_bytes)
}
```
```javascript
// js/app-extensions.js
async function takeScreenshot() {
return await window.__TAURI__.invoke('take_screenshot');
}
```
---
## Icons
Required icon sizes in `icons/` :
```
icon.ico # Windows (256x256)
icon.icns # macOS
icon.png # Linux (512x512)
32x32.png
128x128.png
128x128@2x .png
```
---
## Building
### Development
```bash
cargo tauri dev
```
### Production
```bash
# All platforms
cargo tauri build
# Specific target
cargo tauri build --target x86_64-unknown-linux-gnu
cargo tauri build --target x86_64-pc-windows-msvc
cargo tauri build --target x86_64-apple-darwin
```
### Output Locations
```
target/release/bundle/
├── deb/ # Debian package
├── appimage/ # AppImage
├── msi/ # Windows installer
├── dmg/ # macOS disk image
└── macos/ # macOS app bundle
```
---
## Environment Variables
```bash
2025-12-12 23:20:08 -03:00
BOTSERVER_URL=http://localhost:8081 # botserver location
2025-12-04 12:30:05 -03:00
TAURI_DEBUG=1 # Debug mode
```
---
## Testing
```bash
# Build check
cargo build
# Run dev mode
cargo tauri dev
# Run tests
cargo test
```
---
## Rules
- **Desktop-only features** - Shared logic in botserver
- **Tauri APIs** - No direct fs access from JS
- **Platform abstractions** - Use cfg for platform code
- **Security** - Minimal allowlist in tauri.conf.json
- **Zero warnings** - Clean compilation required
2025-12-12 16:39:43 -03:00
- **No cargo audit** - Exempt per project requirements