Skip to content

Commit c126a17

Browse files
Fotios Tsakiridisclaude
andcommitted
Release v2.83.3 - SQL Index Optimization & Context Rules
- Add 10 new database indexes for query performance - Remove redundant idx_code index from projects table - Add database design rules to global context - Add file placement rules to global context - Fix migration backup import for context fields - Fix web UI ticket creation description visibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 721bb1f commit c126a17

15 files changed

Lines changed: 406 additions & 33 deletions

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@ All notable changes to CodeHero will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.83.3] - 2026-01-26
9+
10+
### Improved
11+
- **Global Context - Database Design Rules** - Comprehensive database guidelines
12+
- Correct field types table (DECIMAL for money, UNSIGNED for IDs, etc.)
13+
- Table structure best practices (naming conventions, standard columns)
14+
- Extensibility patterns (separate tables vs hardcoded columns)
15+
- Foreign key actions (ON DELETE + ON UPDATE) with use-case examples
16+
- Expanded checklist (10 items instead of 5)
17+
18+
- **Global Context - File Placement Rules** - Clear workspace path guidelines
19+
- File type → path mapping table
20+
- Project structure examples (Web, App, Hybrid)
21+
- Forbidden locations list with explanations
22+
- Checklist before creating files
23+
24+
### Fixed
25+
- **Migration Backup Import** - Now properly restores context fields
26+
- Added `global_context` and `project_context` to import function
27+
- All three context fields (context, global_context, project_context) now preserved
28+
29+
- **Web UI Ticket Creation** - Description now visible immediately
30+
- Added initial conversation message when creating ticket via UI
31+
- Matches MCP behavior - description shows in chat before daemon starts
32+
33+
- **Dashboard Max Workers Display** - Shows correct config value
34+
- Changed default from 3 to 10
35+
- Reads actual value from MAX_PARALLEL_PROJECTS config
36+
837
## [2.83.2] - 2026-01-25
938

1039
### Fixed

INSTALL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
```bash
1414
cd /root
15-
unzip codehero-2.83.2.zip
15+
unzip codehero-2.83.3.zip
1616
cd codehero
1717
```
1818

@@ -129,8 +129,8 @@ sudo systemctl restart codehero-web codehero-daemon
129129
```bash
130130
# Download and extract new version
131131
cd /root
132-
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.83.2.zip
133-
unzip codehero-2.83.2.zip
132+
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.83.3.zip
133+
unzip codehero-2.83.3.zip
134134
cd codehero
135135

136136
# Preview what will change (recommended)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<p align="center">
1313
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Dual-blue.svg" alt="License"></a>
14-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-2.83.2-green.svg" alt="Version"></a>
14+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-2.83.3-green.svg" alt="Version"></a>
1515
<img src="https://img.shields.io/badge/Ubuntu-22.04%20|%2024.04-orange.svg" alt="Ubuntu">
1616
<a href="https://anthropic.com"><img src="https://img.shields.io/badge/Powered%20by-Claude%20AI-blueviolet.svg" alt="Claude AI"></a>
1717
<a href="https://github.com/fotsakir/codehero/stargazers"><img src="https://img.shields.io/github/stars/fotsakir/codehero?style=social" alt="Stars"></a>
@@ -378,8 +378,8 @@ apt-get update && apt-get install -y unzip wget net-tools
378378

379379
# Download and extract
380380
cd /root
381-
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.83.2.zip
382-
unzip codehero-2.83.2.zip
381+
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.83.3.zip
382+
unzip codehero-2.83.3.zip
383383
cd codehero
384384

385385
# Run setup
@@ -405,7 +405,7 @@ The installer automatically sets up:
405405
```bash
406406
# Download new version
407407
cd /root
408-
unzip codehero-2.83.2.zip
408+
unzip codehero-2.83.3.zip
409409
cd codehero
410410

411411
# Preview changes (recommended)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.83.2
1+
2.83.3

config/global-context.md

Lines changed: 280 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,48 @@ adb install build/app/outputs/flutter-apk/app-debug.apk
198198
- [ ] **Web**: Desktop + Mobile responsive
199199
- [ ] **Mobile apps**: Portrait + Landscape orientation
200200

201+
### Tags/Badges σε Cards (ΠΡΟΣΟΧΗ!)
202+
- Position tags με `absolute` ΜΟΝΟ αν το parent έχει `relative`
203+
- Αφήνε padding στο content για να μην επικαλύπτεται: `pt-8` αν το tag είναι πάνω
204+
- Χρησιμοποίησε `z-index` σωστά: tag `z-10`, content `z-0`
205+
- ΠΟΤΕ μην βάζεις tag πάνω σε κείμενο - χρησιμοποίησε corners (top-right, top-left)
206+
207+
**Παράδειγμα:**
208+
```html
209+
<div class="relative bg-white rounded-lg p-4 pt-10">
210+
<span class="absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded z-10">Tag</span>
211+
<h3 class="z-0">Τίτλος</h3>
212+
<p>Περιεχόμενο που δεν επικαλύπτεται</p>
213+
</div>
214+
```
215+
216+
### Εικόνες & Placeholders (MANDATORY!)
217+
- ΠΟΤΕ μην αφήνεις κενό χώρο για εικόνες
218+
- Χρησιμοποίησε placeholder service: `https://placehold.co/400x300/EEE/333?text=Κατηγορία`
219+
- Ή δημιούργησε SVG placeholder με σχετικό icon
220+
- Για κατηγορίες χρησιμοποίησε σχετικά icons (FontAwesome, Heroicons)
221+
222+
**Παραδείγματα placeholders:**
223+
| Κατηγορία | Placeholder |
224+
|-----------|-------------|
225+
| Οχήματα | 🚗 icon ή placehold.co με "Οχήματα" |
226+
| Ακίνητα | 🏠 icon |
227+
| Ηλεκτρονικά | 📱 icon |
228+
| Γενικό | Γκρι background με όνομα κατηγορίας |
229+
230+
**Κώδικας:**
231+
```html
232+
<!-- Με εικόνα ή fallback -->
233+
<img src="photo.jpg"
234+
onerror="this.src='https://placehold.co/400x300/f3f4f6/9ca3af?text=Χωρίς+Εικόνα'"
235+
alt="Περιγραφή">
236+
237+
<!-- SVG Placeholder -->
238+
<div class="bg-gray-100 flex items-center justify-center h-48">
239+
<svg class="w-16 h-16 text-gray-400">...</svg>
240+
</div>
241+
```
242+
201243
---
202244

203245
## MANDATORY UI TESTING RULES
@@ -450,6 +492,164 @@ curl -o libs/tailwind.min.css https://cdn.tailwindcss.com/...
450492

451493
---
452494

495+
## DATABASE DESIGN (MANDATORY!)
496+
497+
### Σωστοί Τύποι Πεδίων (ΚΡΙΣΙΜΟ!)
498+
499+
| Δεδομένο | Σωστός Τύπος | ❌ Λάθος | Γιατί |
500+
|----------|--------------|----------|-------|
501+
| ID/Primary Key | `INT UNSIGNED` ή `BIGINT UNSIGNED` | `INT` (signed) | Δεν χρειαζόμαστε αρνητικά IDs |
502+
| Foreign Key | Ίδιος τύπος με το PK | Διαφορετικός | Πρέπει να ταιριάζουν ακριβώς |
503+
| Τιμή/Χρήματα | `DECIMAL(10,2)` | `FLOAT`, `DOUBLE` | Float έχει precision errors |
504+
| Email | `VARCHAR(255)` | `TEXT` | Email max 254 chars by RFC |
505+
| Username | `VARCHAR(50)` | `VARCHAR(255)` | Περιττό μέγεθος |
506+
| Password hash | `VARCHAR(255)` | `TEXT`, `CHAR` | bcrypt = 60 chars, future-proof |
507+
| Short text | `VARCHAR(n)` | `TEXT` | TEXT δεν έχει index limit |
508+
| Long text | `TEXT` ή `MEDIUMTEXT` | `VARCHAR(10000)` | VARCHAR max 65535 bytes |
509+
| Boolean | `TINYINT(1)` ή `BOOLEAN` | `INT`, `ENUM('0','1')` | Σπατάλη χώρου |
510+
| Status/Type | `ENUM(...)` | `VARCHAR`, `INT` | Validation + readability |
511+
| Date μόνο | `DATE` | `DATETIME`, `VARCHAR` | Σωστός τύπος για dates |
512+
| Date + Time | `DATETIME` | `TIMESTAMP` (για events) | TIMESTAMP για auto-update |
513+
| Created/Updated | `TIMESTAMP` | `DATETIME` | Auto-update support |
514+
| IP Address | `VARCHAR(45)` | `VARCHAR(15)` | IPv6 = 45 chars |
515+
| Phone | `VARCHAR(20)` | `INT` | Phones έχουν + και spaces |
516+
| UUID | `CHAR(36)` ή `BINARY(16)` | `VARCHAR` | Fixed length |
517+
| JSON data | `JSON` | `TEXT` | Validation + indexing |
518+
| Percentage | `DECIMAL(5,2)` | `INT`, `FLOAT` | 0.00 - 100.00 |
519+
520+
### Δομή Πίνακα - Best Practices
521+
522+
**Standard Columns (ΠΑΝΤΑ περιλαμβάνουμε):**
523+
```sql
524+
CREATE TABLE table_name (
525+
-- Primary Key
526+
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
527+
528+
-- Business columns εδώ...
529+
530+
-- Standard timestamps (ΠΑΝΤΑ!)
531+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
532+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
533+
534+
-- Optional: Soft delete
535+
deleted_at TIMESTAMP NULL DEFAULT NULL
536+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
537+
```
538+
539+
**Naming Conventions:**
540+
| Τι | Convention | Παράδειγμα |
541+
|----|------------|------------|
542+
| Table names | Πληθυντικός, snake_case | `users`, `order_items` |
543+
| Column names | Ενικός, snake_case | `user_id`, `created_at` |
544+
| Primary key | `id` | `id` |
545+
| Foreign key | `{table_singular}_id` | `user_id`, `product_id` |
546+
| Boolean | `is_` ή `has_` prefix | `is_active`, `has_verified` |
547+
| Timestamps | `_at` suffix | `created_at`, `expires_at` |
548+
| Indexes | `idx_{columns}` | `idx_user_id`, `idx_status_created` |
549+
550+
**Επεκτασιμότητα - Σκέψου το Μέλλον:**
551+
```sql
552+
-- ❌ ΛΑΘΟΣ: Hardcoded columns
553+
CREATE TABLE users (
554+
phone1 VARCHAR(20),
555+
phone2 VARCHAR(20), -- Τι γίνεται αν θέλει 3 τηλέφωνα;
556+
phone3 VARCHAR(20)
557+
);
558+
559+
-- ✅ ΣΩΣΤΟ: Separate table για πολλαπλές τιμές
560+
CREATE TABLE users (
561+
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT
562+
);
563+
564+
CREATE TABLE user_phones (
565+
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
566+
user_id INT UNSIGNED NOT NULL,
567+
phone VARCHAR(20) NOT NULL,
568+
type ENUM('mobile','home','work') DEFAULT 'mobile',
569+
is_primary TINYINT(1) DEFAULT 0,
570+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
571+
);
572+
```
573+
574+
### Indexes - ΠΑΝΤΑ προσθέτουμε:
575+
| Column Type | Index Type | Παράδειγμα |
576+
|-------------|------------|------------|
577+
| Primary Key | PRIMARY | `id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT` |
578+
| Foreign Key | INDEX | `INDEX idx_user_id (user_id)` |
579+
| WHERE columns | INDEX | `INDEX idx_status (status)` |
580+
| ORDER BY columns | INDEX | `INDEX idx_created (created_at)` |
581+
| Unique fields | UNIQUE | `UNIQUE idx_email (email)` |
582+
| Composite WHERE | COMPOSITE | `INDEX idx_user_status (user_id, status)` |
583+
584+
### Foreign Keys - Σωστά Actions (ΚΡΙΣΙΜΟ!)
585+
586+
**ON DELETE + ON UPDATE Actions:**
587+
| Action | ON DELETE | ON UPDATE |
588+
|--------|-----------|-----------|
589+
| `CASCADE` | Διαγραφή parent → διαγραφή children | Update parent ID → update children |
590+
| `RESTRICT` | Απαγόρευση διαγραφής αν υπάρχουν children | Απαγόρευση update αν υπάρχουν children |
591+
| `SET NULL` | Διαγραφή parent → NULL στο child | Update parent ID → NULL στο child |
592+
| `NO ACTION` | Ίδιο με RESTRICT (SQL standard) | Ίδιο με RESTRICT |
593+
594+
**Πότε χρησιμοποιούμε τι:**
595+
| Σχέση | ON DELETE | ON UPDATE | Παράδειγμα |
596+
|-------|-----------|-----------|------------|
597+
| Parent-Child (ownership) | `CASCADE` | `CASCADE` | user → user_settings |
598+
| Parent-Child (data) | `CASCADE` | `CASCADE` | order → order_items |
599+
| Reference (required) | `RESTRICT` | `CASCADE` | order → product |
600+
| Reference (optional) | `SET NULL` | `CASCADE` | post → category (nullable) |
601+
| Audit/Log | `RESTRICT` | `CASCADE` | payment → order |
602+
| Self-reference | `SET NULL` ή `CASCADE` | `CASCADE` | employee → manager |
603+
604+
**Παράδειγμα Σωστής Δομής:**
605+
```sql
606+
CREATE TABLE orders (
607+
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
608+
user_id INT UNSIGNED NOT NULL,
609+
product_id INT UNSIGNED NOT NULL,
610+
status ENUM('pending','processing','completed','cancelled') DEFAULT 'pending',
611+
total_amount DECIMAL(10,2) NOT NULL DEFAULT 0.00,
612+
notes TEXT NULL,
613+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
614+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
615+
616+
-- Foreign Keys με ΣΩΣΤΑ actions
617+
FOREIGN KEY (user_id) REFERENCES users(id)
618+
ON DELETE CASCADE ON UPDATE CASCADE, -- Διαγραφή user = διαγραφή orders
619+
FOREIGN KEY (product_id) REFERENCES products(id)
620+
ON DELETE RESTRICT ON UPDATE CASCADE, -- Δεν μπορείς να διαγράψεις product με orders
621+
622+
-- Indexes
623+
INDEX idx_user_id (user_id),
624+
INDEX idx_product_id (product_id),
625+
INDEX idx_status (status),
626+
INDEX idx_created (created_at)
627+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
628+
```
629+
630+
### Query Optimization - ΠΑΝΤΑ ελέγχουμε:
631+
```sql
632+
-- Πριν γράψεις query, έλεγξε με EXPLAIN:
633+
EXPLAIN SELECT * FROM orders WHERE user_id = 1 AND status = 'pending';
634+
635+
-- Αν δεις "type: ALL" → ΧΡΕΙΑΖΕΤΑΙ INDEX!
636+
-- Στόχος: "type: ref" ή "type: range"
637+
```
638+
639+
### Database Checklist πριν τελειώσεις:
640+
- [ ] Τύποι πεδίων είναι σωστοί (DECIMAL για χρήματα, κλπ)
641+
- [ ] Primary keys είναι UNSIGNED
642+
- [ ] Foreign keys έχουν ίδιο τύπο με το PK που αναφέρονται
643+
- [ ] Κάθε foreign key έχει INDEX
644+
- [ ] Foreign keys έχουν σωστό ON DELETE ΚΑΙ ON UPDATE
645+
- [ ] Υπάρχουν created_at και updated_at columns
646+
- [ ] WHERE columns έχουν INDEX
647+
- [ ] ORDER BY columns έχουν INDEX
648+
- [ ] Πίνακες έχουν utf8mb4 charset
649+
- [ ] EXPLAIN δείχνει σωστή χρήση indexes
650+
651+
---
652+
453653
## NO BUILD WORKFLOW
454654

455655
**NEVER use build tools** (Vite, Webpack, npm run build)
@@ -464,13 +664,87 @@ const MyComponent = {
464664

465665
---
466666

467-
## WORKSPACE PATHS
667+
## WORKSPACE PATHS (CRITICAL!)
668+
669+
### Πού Δουλεύεις
670+
Όταν εκτελείς ticket, το σύστημα σου δίνει τα paths στο context:
671+
- **Web path**: Για web εφαρμογές (PHP, HTML, frontend)
672+
- **App path**: Για backend/app (Node.js API, Python, CLI, mobile)
673+
674+
**ΚΡΙΣΙΜΟ:** Δούλεψε ΜΟΝΟ μέσα στα paths που σου δόθηκαν!
675+
676+
### Κανόνες Τοποθέτησης Αρχείων
677+
678+
| Τύπος Αρχείου | Που Πάει | Path |
679+
|---------------|----------|------|
680+
| HTML, CSS, JS, PHP | Web folder | `{web_path}/` |
681+
| Images, fonts, assets | Web folder | `{web_path}/assets/` |
682+
| Libraries (local) | Web folder | `{web_path}/libs/` |
683+
| Backend API (Node/Python) | App folder | `{app_path}/` |
684+
| Config files | Root του project | `{web_path}/` ή `{app_path}/` |
685+
| SQL/migrations | Project folder | `{web_path}/database/` ή `{app_path}/database/` |
686+
687+
### Project Structure Examples
468688

689+
**Web Project (PHP/HTML):**
690+
```
691+
{web_path}/
692+
├── index.php # Entry point
693+
├── css/ # Stylesheets
694+
├── js/ # JavaScript
695+
├── libs/ # Downloaded libraries (Tailwind, Vue, etc.)
696+
├── assets/ # Images, fonts
697+
├── includes/ # PHP includes
698+
├── database/ # SQL files
699+
└── config.php # Configuration
700+
```
701+
702+
**App Project (Node.js API):**
703+
```
704+
{app_path}/
705+
├── index.js # Entry point
706+
├── src/ # Source code
707+
├── routes/ # API routes
708+
├── models/ # Data models
709+
├── config/ # Configuration
710+
├── database/ # Migrations, schema
711+
└── package.json # Dependencies
469712
```
470-
Allowed: /var/www/projects/{name}/
471-
/opt/apps/{name}/
472713

473-
FORBIDDEN: /opt/codehero/
474-
/etc/nginx/
475-
/etc/systemd/
714+
**Hybrid Project (Frontend + Backend):**
715+
```
716+
{web_path}/ # Frontend (Vue/React)
717+
├── index.html
718+
├── css/
719+
├── js/
720+
└── libs/
721+
722+
{app_path}/ # Backend API
723+
├── index.js
724+
├── routes/
725+
└── models/
476726
```
727+
728+
### ΑΠΑΓΟΡΕΥΜΕΝΕΣ Τοποθεσίες (NEVER!)
729+
730+
```
731+
❌ FORBIDDEN - ΠΟΤΕ μην γράφεις εδώ:
732+
/opt/codehero/ # System files
733+
/etc/nginx/ # Server config
734+
/etc/systemd/ # Service files
735+
/var/log/ # Logs
736+
/tmp/ # Temporary (εκτός για screenshots)
737+
/home/claude/ # Home directory
738+
/root/ # Root home
739+
740+
✅ ALLOWED - Μόνο εδώ:
741+
{web_path}/... # Το web path του project
742+
{app_path}/... # Το app path του project
743+
```
744+
745+
### Checklist Πριν Δημιουργήσεις Αρχείο
746+
747+
- [ ] Είμαι μέσα στο `{web_path}` ή `{app_path}` του project;
748+
- [ ] Ο τύπος αρχείου ταιριάζει με το path (web files → web_path);
749+
- [ ] Χρησιμοποιώ relative paths μέσα στο project;
750+
- [ ] Libraries πάνε στο `libs/` folder, όχι στο root;

0 commit comments

Comments
 (0)