botbook/src/04-gbui/apps/tasks.md

229 lines
4.2 KiB
Markdown
Raw Normal View History

# Tasks
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
> **Describe What You Want, Get a Working App**
2025-12-03 19:56:35 -03:00
---
## What is Tasks?
2025-12-17 17:44:07 -03:00
Tasks is where you describe what you want and the system builds it. No coding - just tell it what you need.
2025-12-17 17:44:07 -03:00
| You Say | You Get |
|---------|---------|
| "CRM for my cellphone store" | Working app with customers, sales, inventory |
| "Track repair status" | Kanban board with status workflow |
| "Sales dashboard" | Charts and metrics auto-updating |
2025-12-03 19:56:35 -03:00
---
## How It Works
2025-12-17 17:44:07 -03:00
```
DESCRIBE → PLAN → EXECUTE → DONE
```
2025-12-17 17:44:07 -03:00
### 1. Describe
2025-12-17 17:44:07 -03:00
Write what you want in plain language:
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
```
"Create a CRM for my cellphone store with:
- Customer list (name, phone, email)
- Product inventory with stock levels
- Sales tracking
- Repair status board"
```
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### 2. Plan
2025-12-17 17:44:07 -03:00
System shows the execution plan:
2025-12-17 17:44:07 -03:00
```
Step 1: Create tables (customers, products, sales, repairs)
Step 2: Generate application UI
Step 3: Add search and filters
Step 4: Configure repair workflow
2025-12-17 17:44:07 -03:00
Confidence: 92% | ETA: 3 minutes
```
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### 3. Execute
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
Watch progress in real-time:
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
```
[████████████████░░░░] 75%
Step 3 of 4: Adding search...
```
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### 4. Done
2025-12-17 17:44:07 -03:00
Your app is ready:
2025-12-17 17:44:07 -03:00
```
✅ Application: /apps/cellphone-crm
✅ Tables: customers, products, sales, repairs
```
2025-12-03 19:56:35 -03:00
---
2025-12-17 17:44:07 -03:00
## Creating a Task
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### Write Your Intent
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
Be specific about what you want:
2025-12-17 17:44:07 -03:00
| ✅ Good | ❌ Too Vague |
|---------|--------------|
| "CRM for cellphone store with customer tracking and repair status" | "Make an app" |
| "Inventory with low stock alerts when below 10 units" | "Track stuff" |
| "Sales dashboard with daily revenue chart" | "Dashboard" |
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### Choose Mode
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
| Mode | Best For |
|------|----------|
| **Automatic** | Trusted, simple tasks |
| **Supervised** | Learning, want to review each step |
| **Dry Run** | Testing - see what would happen |
2025-12-17 17:44:07 -03:00
### Click Execute
2025-12-17 17:44:07 -03:00
The system runs each step and shows progress.
2025-12-03 19:56:35 -03:00
---
2025-12-17 17:44:07 -03:00
## Task Progress
2025-12-17 17:44:07 -03:00
### Status Icons
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
| Icon | Meaning |
|------|---------|
| ✓ | Completed |
| ◐ | Running |
| ○ | Pending |
| ⚠ | Needs attention |
| ✕ | Failed |
2025-12-17 17:44:07 -03:00
### Steps Are Saved
2025-12-17 17:44:07 -03:00
Every step is stored so you can:
2025-12-17 17:44:07 -03:00
- **Resume** if interrupted
- **Track** exactly where you are
- **Debug** if something fails
2025-12-03 19:56:35 -03:00
---
2025-12-17 17:44:07 -03:00
## Your Generated App
2025-12-17 17:44:07 -03:00
Apps are created at `.gbdrive/apps/{name}/`:
2025-12-17 17:44:07 -03:00
```
.gbdrive/apps/cellphone-crm/
├── index.html # Your application
├── _assets/
│ ├── htmx.min.js
│ └── styles.css
└── schema.json # Table definitions
```
2025-12-17 17:44:07 -03:00
### Direct API Access
2025-12-17 17:44:07 -03:00
Your app talks directly to botserver:
2025-12-17 17:44:07 -03:00
```html
<!-- List customers -->
<div hx-get="/api/db/customers" hx-trigger="load">
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
<!-- Add customer -->
<form hx-post="/api/db/customers">
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
<!-- Search -->
<input hx-get="/api/db/customers"
hx-trigger="keyup changed delay:300ms">
```
2025-12-17 17:44:07 -03:00
No middleware - HTMX calls the API directly.
2025-12-03 19:56:35 -03:00
---
2025-12-17 17:44:07 -03:00
## Data Storage
2025-12-17 17:44:07 -03:00
All data uses the `user_data` virtual table:
2025-12-17 17:44:07 -03:00
```
Your app: cellphone-crm
Table: customers
API: /api/db/customers
Storage: user_data (namespaced)
```
2025-12-17 17:44:07 -03:00
### Benefits
2025-12-17 17:44:07 -03:00
- Tables created on demand
- Each app isolated
- Add fields anytime
- No migrations needed
2025-12-03 19:56:35 -03:00
---
2025-12-17 17:44:07 -03:00
## Task Actions
2025-12-17 17:44:07 -03:00
| Action | When | What It Does |
|--------|------|--------------|
| **Pause** | Running | Stop temporarily |
| **Resume** | Paused | Continue from where stopped |
| **Cancel** | Anytime | Stop and discard |
| **Retry** | Failed | Try failed step again |
---
2025-12-17 17:44:07 -03:00
## From Chat
2025-12-17 17:44:07 -03:00
Create tasks by talking to your bot:
2025-12-17 17:44:07 -03:00
**You:** "I need a CRM for my cellphone store"
2025-12-17 17:44:07 -03:00
**Bot:** "I'll create that. Here's the plan:
- 4 steps, ~3 minutes
- Tables: customers, products, sales, repairs
2025-12-17 17:44:07 -03:00
Execute?"
2025-12-17 17:44:07 -03:00
**You:** "Yes"
2025-12-17 17:44:07 -03:00
**Bot:** "Started. I'll notify you when done."
2025-12-03 19:56:35 -03:00
---
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
## Examples
2025-12-17 17:44:07 -03:00
### Cellphone Store CRM
2025-12-17 17:44:07 -03:00
```
"CRM with customers, products, sales, and repair tracking
with status: received, diagnosing, repairing, ready, delivered"
```
2025-12-17 17:44:07 -03:00
### Restaurant Reservations
2025-12-17 17:44:07 -03:00
```
"Reservation system with tables, bookings, and waitlist"
```
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
### Inventory Tracker
2025-12-03 19:56:35 -03:00
2025-12-17 17:44:07 -03:00
```
"Inventory with products, suppliers, and low stock alerts"
```
2025-12-03 19:56:35 -03:00
---
## See Also
2025-12-17 17:44:07 -03:00
- [Autonomous Tasks](../../21-autonomous-tasks/README.md) - Complete guide
- [Dev Chat Widget](../dev-chat.md) - Test while developing
- [HTMX Architecture](../htmx-architecture.md) - How the UI works