botbook/PROMPT.md

280 lines
6.4 KiB
Markdown
Raw Permalink Normal View History

2026-01-22 20:24:01 -03:00
# botbook Development Guide
2025-12-04 12:30:06 -03:00
2026-02-13 22:31:47 +00:00
**Version:** 6.2.0
2026-01-22 20:24:01 -03:00
**Purpose:** Documentation for General Bots (mdBook)
2025-12-04 12:30:06 -03:00
---
2026-02-13 22:31:47 +00:00
## CRITICAL: Keyword Naming Rules
**Keywords NEVER use underscores. Always use spaces.**
2026-02-13 22:31:47 +00:00
### Correct Syntax
```basic
SEND MAIL to, subject, body, attachments
GENERATE PDF template, data, output
MERGE PDF files, output
DELETE "url"
ON ERROR RESUME NEXT
SET BOT MEMORY key, value
KB STATISTICS
```
2026-02-13 22:31:47 +00:00
### WRONG - Never Use Underscores
```basic
SEND_MAIL ' WRONG!
GENERATE_PDF ' WRONG!
DELETE_HTTP ' WRONG!
```
2026-01-22 20:24:01 -03:00
### Keyword Mappings
| Write This | NOT This |
|------------|----------|
| `SEND MAIL` | `SEND_MAIL` |
| `GENERATE PDF` | `GENERATE_PDF` |
| `MERGE PDF` | `MERGE_PDF` |
| `DELETE` | `DELETE_HTTP` |
| `SET HEADER` | `SET_HEADER` |
| `FOR EACH` | `FOR_EACH` |
---
2026-02-13 22:31:47 +00:00
## OFFICIAL ICONS - MANDATORY
2026-01-22 20:24:01 -03:00
**NEVER generate icons with LLM. Use official SVG icons from `botui/ui/suite/assets/icons/`**
### Usage in Documentation
```markdown
<!-- Reference icons in docs -->
![Chat](../assets/icons/gb-chat.svg)
2026-01-22 20:24:01 -03:00
<!-- With HTML for sizing -->
<img src="../assets/icons/gb-analytics.svg" alt="Analytics" width="24">
```
2025-12-04 12:30:06 -03:00
---
2026-02-13 22:31:47 +00:00
## STRUCTURE
2025-12-04 12:30:06 -03:00
```
botbook/
├── book.toml # mdBook configuration
├── src/
│ ├── SUMMARY.md # Table of contents
│ ├── README.md # Introduction
2026-01-22 20:24:01 -03:00
│ ├── 01-introduction/ # Quick Start
│ ├── 02-templates/ # Package System
│ ├── 03-knowledge-base/ # Knowledge Base
│ ├── 06-gbdialog/ # BASIC Dialogs
│ ├── 08-config/ # Configuration
│ ├── 10-rest/ # REST API
│ └── assets/ # Images, diagrams
2025-12-04 12:30:06 -03:00
├── i18n/ # Translations
└── book/ # Generated output
```
---
2026-02-13 22:31:47 +00:00
## DOCUMENTATION RULES
2025-12-04 12:30:06 -03:00
```
- All documentation MUST match actual source code
- Extract real keywords from botserver/src/basic/keywords/
- Use actual examples from botserver/templates/
2026-01-22 20:24:01 -03:00
- Version numbers must be 6.2.0
2025-12-04 12:30:06 -03:00
- No placeholder content - only verified features
```
---
2026-02-13 22:31:47 +00:00
## NO ASCII DIAGRAMS - MANDATORY
2025-12-04 12:30:06 -03:00
2026-01-22 20:24:01 -03:00
**NEVER use ASCII art diagrams. ALL diagrams must be SVG.**
2025-12-04 12:30:06 -03:00
2026-02-13 22:31:47 +00:00
### Prohibited ASCII Patterns
2025-12-04 12:30:06 -03:00
```
2026-02-13 22:31:47 +00:00
+-------+
| Box |
+-------+
2025-12-04 12:30:06 -03:00
```
2026-02-13 22:31:47 +00:00
### What to Use Instead
| Instead of... | Use... |
|---------------|--------|
| ASCII box diagrams | SVG diagrams in `assets/` |
| ASCII flow charts | SVG with arrows and boxes |
2026-01-22 20:24:01 -03:00
| ASCII directory trees | Markdown tables |
---
2026-02-13 22:31:47 +00:00
## SVG DIAGRAM GUIDELINES
2026-01-22 20:24:01 -03:00
All SVGs must support light/dark modes:
```xml
<style>
2026-01-22 20:24:01 -03:00
.title-text { fill: #1E1B4B; }
.main-text { fill: #334155; }
2026-02-13 22:31:47 +00:00
@media (prefers-color-scheme: dark) {
.title-text { fill: #F1F5F9; }
.main-text { fill: #E2E8F0; }
}
</style>
```
---
2026-02-13 22:31:47 +00:00
## CONVERSATION EXAMPLES
2026-01-22 20:24:01 -03:00
Use WhatsApp-style HTML format for bot interactions:
```html
<div class="wa-chat">
2026-01-22 20:24:01 -03:00
<div class="wa-message bot">
<div class="wa-bubble">
2026-01-22 20:24:01 -03:00
<p>Hello! How can I help?</p>
<div class="wa-time">10:30</div>
</div>
</div>
2026-01-22 20:24:01 -03:00
<div class="wa-message user">
<div class="wa-bubble">
2026-01-22 20:24:01 -03:00
<p>I want to enroll</p>
<div class="wa-time">10:31</div>
</div>
</div>
</div>
```
2026-01-22 20:24:01 -03:00
---
2026-02-13 22:31:47 +00:00
## SOURCE CODE REFERENCES
2026-01-22 20:24:01 -03:00
| Topic | Source Location |
|-------|-----------------|
| BASIC Keywords | `botserver/src/basic/keywords/` |
2026-02-13 22:31:47 +00:00
| Database Models | `botserver/src/core/shared/models.rs` |
2026-01-22 20:24:01 -03:00
| API Routes | `botserver/src/core/urls.rs` |
| Configuration | `botserver/src/core/config/` |
| Templates | `botserver/templates/` |
2026-01-22 20:24:01 -03:00
---
2026-02-13 22:31:47 +00:00
## BUILDING BOTSERVER
**CRITICAL: ALWAYS USE DEBUG BUILD DURING DEVELOPMENT**
```bash
# CORRECT - Use debug build (FAST)
cargo build
# WRONG - NEVER use --release during development (SLOW)
# cargo build --release # DO NOT USE!
# Run debug server
cargo run
```
**Why Debug Build:**
- Debug builds compile in ~30 seconds
- Release builds take 5-10 minutes with LTO
- Debug builds are sufficient for development and testing
- Only use `--release` for production deployment
---
## BUILDING DOCUMENTATION
2026-01-22 20:24:01 -03:00
```bash
# Install mdBook
cargo install mdbook
# Build documentation
cd botbook && mdbook build
# Serve locally with hot reload
mdbook serve --open
```
2026-01-22 20:24:01 -03:00
---
2026-02-13 22:31:47 +00:00
## TESTING PROCEDURES
### Tool Testing Workflow
**CRITICAL: NO STOP UNTIL NO MORE ERRORS IN TOOLS**
When testing bot tools, follow this sequential process WITHOUT STOPPING:
```
1. Test Tool #1
├─ Fill form one field at a time (if multi-step form)
├─ Verify NO ERRORS in output
├─ Check Result types are NOT visible (no "core::result::Result<..." strings)
├─ Verify database save (if applicable)
├─ IF ERRORS FOUND: FIX THEM IMMEDIATELY, RE-TEST SAME TOOL
├─ ONLY move to next tool when CURRENT tool has ZERO errors
2. Test Tool #2
└─ (repeat process - DO NOT STOP if errors found)
3. Continue until ALL tools tested with ZERO errors
```
**IMPORTANT:**
- Do NOT stop testing to summarize or ask questions
- Do NOT move to next tool if current tool has errors
- Fix errors immediately, rebuild, re-test same tool
- Only proceed when current tool is completely error-free
### Error Patterns to Watch For
**CRITICAL ERRORS (Must Fix Before Proceeding):**
- `core::result::Result<alloc::string::String, alloc::string::String>` in output
- `invalid input syntax for type timestamp`
- `Some("Desculpe, houve um erro...")`
- Empty balloon messages
- Rust debug info visible to users
### Playwright Testing Tricks
```javascript
// Click tool button
await page.getByRole('button', { name: 'Evento/Iluminação' }).click();
// Wait for response
await page.waitForTimeout(3000);
// Take snapshot
await page.snapshot();
// Fill form field by field
await page.getByRole('textbox').fill('field value');
await page.getByRole('textbox').press('Enter');
```
### Test Documentation
After testing each tool, document:
1. Tool name and ID
2. All required parameters
3. Expected behavior
4. Any issues found and fixes applied
5. Final test result (PASS/FAIL)
---
## REMEMBER
2026-01-22 20:24:01 -03:00
- **Accuracy** - Must match botserver source code
- **Completeness** - No placeholder sections
- **Clarity** - Accessible to BASIC enthusiasts
- **Keywords** - NEVER use underscores - always spaces
- **NO ASCII art** - Use SVG diagrams only
- **Version 6.2.0** - Always reference 6.2.0
- **GIT WORKFLOW** - ALWAYS push to ALL repositories (github, pragmatismo)
2026-02-13 22:31:47 +00:00
- **TESTING** - Test tools ONE BY ONE, fix ALL errors before moving to next tool
- **NO STOP** - DO NOT STOP testing until ALL tools have ZERO errors - fix immediately and re-test