Salta ai contenuti

Project Map (Codebase)

Questi contenuti non sono ancora disponibili nella tua lingua.

Living Document - Questa mappa riflette la struttura del repository BLACKTRAILS-PLATFORM.

BLACKTRAILS-PLATFORM/
β”‚
β”œβ”€β”€ πŸ“„ ROOT DOCS # Documentazione di Progetto
β”‚ β”œβ”€β”€ ANTHROPIC_MIGRATION.md # Migrazione a Claude
β”‚ β”œβ”€β”€ DEPLOY_CHECKLIST.md # Checklist Deploy
β”‚ β”œβ”€β”€ PRODUCTION_AUDIT.md # Audit Produzione
β”‚ β”œβ”€β”€ PRODUCTION_READY.txt # Status Produzione
β”‚ β”œβ”€β”€ PRODUCTION_TEST_GUIDE.md # Guida Test Produzione
β”‚ └── SUMMARY.md # Sommario Generale
β”‚
β”œβ”€β”€ πŸ—„οΈ db/ # Database Schema
β”‚ └── schema.sql # Schema PostgreSQL (Neon)
β”‚
β”œβ”€β”€ πŸ“š docs/ # Documentazione Tecnica
β”‚ β”œβ”€β”€ DATABASE.md # ⭐ Schema Multi-Database
β”‚ β”œβ”€β”€ DB_MIGRATION_PLAN.md # Piano Migrazione DB
β”‚ β”œβ”€β”€ GITHUB_AUDIT_2025-12-18.md # Audit GitHub Repos
β”‚ β”œβ”€β”€ in1_algoritmo.md # Algoritmo IN-1 (ALMA)
β”‚ β”œβ”€β”€ LIBRARY_PIPELINE_ANALYSIS.md # Analisi Pipeline Docs
β”‚ β”œβ”€β”€ MIGRATION_REPORT_2025-12-18.md
β”‚ └── structure.md # Struttura Generale
β”‚
β”œβ”€β”€ πŸ“– library/ # 🎯 Source of Truth (Docs as Code)
β”‚ β”œβ”€β”€ public/ # Docs Pubblici (Sync DB)
β”‚ β”‚ β”œβ”€β”€ en/ # English Docs
β”‚ β”‚ β”‚ β”œβ”€β”€ algorithms/
β”‚ β”‚ β”‚ β”œβ”€β”€ legal/
β”‚ β”‚ β”‚ β”œβ”€β”€ philosophy/
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ rhama.md
β”‚ β”‚ β”‚ β”‚ └── rhama-paradigm.md
β”‚ β”‚ β”‚ └── projects/
β”‚ β”‚ └── it/ # Italian Docs
β”‚ β”‚ β”œβ”€β”€ algoritmi/
β”‚ β”‚ β”œβ”€β”€ filosofia/
β”‚ β”‚ β”‚ β”œβ”€β”€ manifesto.md
β”‚ β”‚ β”‚ β”œβ”€β”€ rhama.md
β”‚ β”‚ β”‚ └── rhama-paradigm.md
β”‚ β”‚ β”œβ”€β”€ legal/
β”‚ β”‚ └── progetti/
β”‚ β”œβ”€β”€ private/ # Docs Privati (Solo Git)
β”‚ β”‚ β”œβ”€β”€ finanza/
β”‚ β”‚ └── strategie/
β”‚ └── README.md
β”‚
β”œβ”€β”€ πŸ› οΈ maintenance/ # Script Manutenzione
β”‚ β”œβ”€β”€ deploy-worker.ps1 # Deploy Cloudflare Worker
β”‚ β”œβ”€β”€ deploy.ps1 # Deploy Generale
β”‚ β”œβ”€β”€ maintenance-*.html # Pagine Manutenzione Brand
β”‚ β”œβ”€β”€ worker-split.js # Split Worker Code
β”‚ └── README.md
β”‚
β”œβ”€β”€ πŸ“¦ scripts/ # Automation Scripts
β”‚ β”œβ”€β”€ sync-library.js # ⭐ Sync Docs β†’ DB
β”‚ β”œβ”€β”€ migrate-haiku-to-rhama.js # Migrazione Haiku β†’ Rhama
β”‚ β”œβ”€β”€ setup-production-db.js # Setup DB Produzione
β”‚ β”œβ”€β”€ cloudflare-deploy-v2.js # Deploy Cloudflare Pages
β”‚ β”œβ”€β”€ generate-phonetics.js # Generazione Fonetiche
β”‚ β”œβ”€β”€ translate-rhamas.js # Traduzione Rhama
β”‚ β”œβ”€β”€ verify-production.js # Verifica Produzione
β”‚ └── [altri 15+ script utility]
β”‚
β”œβ”€β”€ 🎨 src/ # Codice Sorgente
β”‚ β”œβ”€β”€ brands/ # Multi-Brand Architecture
β”‚ β”‚ β”œβ”€β”€ blacktrails/
β”‚ β”‚ β”‚ β”œβ”€β”€ routes.js
β”‚ β”‚ β”‚ └── views/
β”‚ β”‚ β”œβ”€β”€ elements/
β”‚ β”‚ β”‚ β”œβ”€β”€ routes.js
β”‚ β”‚ β”‚ └── views/
β”‚ β”‚ β”œβ”€β”€ forest/
β”‚ β”‚ β”‚ β”œβ”€β”€ routes.js
β”‚ β”‚ β”‚ └── views/
β”‚ β”‚ β”œβ”€β”€ gcore/
β”‚ β”‚ β”‚ β”œβ”€β”€ routes.js
β”‚ β”‚ β”‚ └── views/ [9 *.ejs]
β”‚ β”‚ └── in1/
β”‚ β”‚ β”œβ”€β”€ routes.js # 14 endpoints (Rhama, Soul Card, API)
β”‚ β”‚ β”œβ”€β”€ services/
β”‚ β”‚ β”‚ β”œβ”€β”€ almaOrchestrator.js # ALMA orchestration layer
β”‚ β”‚ β”‚ β”œβ”€β”€ almaRhama.js # Rhama generation logic
β”‚ β”‚ β”‚ β”œβ”€β”€ almaService.js # ALMA API client
β”‚ β”‚ β”‚ β”œβ”€β”€ poetService.js # Poet model integration
β”‚ β”‚ β”‚ β”œβ”€β”€ config/
β”‚ β”‚ β”‚ β”‚ └── almaConfig.js
β”‚ β”‚ β”‚ └── prompts/
β”‚ β”‚ β”‚ β”œβ”€β”€ alma.js # ⭐ ALMA system prompt (Alchemy Detection)
β”‚ β”‚ β”‚ β”œβ”€β”€ alma_BACKUP_PRE_ZENSPHERE.js
β”‚ β”‚ β”‚ └── poeta.js
β”‚ β”‚ └── views/
β”‚ β”‚ β”œβ”€β”€ index.ejs # IN-1 homepage
β”‚ β”‚ β”œβ”€β”€ rhama.ejs # Rhama generator UI
β”‚ β”‚ β”œβ”€β”€ soul-card.ejs # ⭐ Soul Card (Aurora Boreale)
β”‚ β”‚ β”œβ”€β”€ vision.ejs # Vision page
β”‚ β”‚ └── legal.ejs # Legal docs
β”‚ β”‚
β”‚ β”œβ”€β”€ core/ # Core System
β”‚ β”‚ β”œβ”€β”€ index.js # Entry Point
β”‚ β”‚ β”œβ”€β”€ db.js # Database Client
β”‚ β”‚ β”œβ”€β”€ auth.js # Authentication
β”‚ β”‚ β”œβ”€β”€ middleware.js # Express Middleware
β”‚ β”‚ β”œβ”€β”€ permissions.js # RBAC Permissions
β”‚ β”‚ └── email.js # Email Service
β”‚ β”‚
β”‚ └── public/ # Public Assets
β”‚ β”œβ”€β”€ routes/
β”‚ β”‚ β”œβ”€β”€ auth.js
β”‚ β”‚ └── landing.js
β”‚ β”œβ”€β”€ server.js # Main Server
β”‚ β”œβ”€β”€ utils/core/
β”‚ β”œβ”€β”€ views/
β”‚ β”œβ”€β”€ content/ [3 *.md]
β”‚ β”œβ”€β”€ css/ [4 *.css]
β”‚ β”œβ”€β”€ js/ [7 *.js]
β”‚ └── favicons/
β”‚
β”œβ”€β”€ πŸ§ͺ tests/ # Test Suite
β”‚ β”œβ”€β”€ test-alma-*.js # ALMA AI Tests
β”‚ β”œβ”€β”€ test-poeta.js # Poet Model Test
β”‚ β”œβ”€β”€ test-emotion-analyzer.js # Emotion Analysis
β”‚ β”œβ”€β”€ test-conversation.js # Conversation Flow
β”‚ β”œβ”€β”€ test-end-to-end.js # E2E Test
β”‚ └── [altri 30+ test files]
β”‚
β”œβ”€β”€ πŸ“‹ package.json # Dependencies
β”œβ”€β”€ package-lock.json
└── server.log # Runtime Log

src/brands/
β”œβ”€β”€ blacktrails/ β†’ blacktrails.io (Hub)
β”œβ”€β”€ elements/ β†’ elements.blacktrails.io (Property Mgmt)
β”œβ”€β”€ forest/ β†’ forest.blacktrails.io (AI Gallery)
β”œβ”€β”€ gcore/ β†’ gcore.blacktrails.io (Analytics)
└── in1/ β†’ in-1.ai (Rhama Generator)
  • core/db.js β†’ Neon PostgreSQL Client
  • core/auth.js β†’ JWT + Session Management
  • core/middleware.js β†’ Express Middleware Layer
  • core/permissions.js β†’ Role-Based Access Control
library/public/*.md
↓ (Git Commit)
scripts/sync-library.js
↓ (Parse Frontmatter + MD5 Hash)
PostgreSQL: library.documents
↓ (pgvector Embeddings)
AI RAG Search (IN-1, Forest)

Neon Cluster: blacktrails

  • Branch: main (Produzione)
  • Branch: dev (Sviluppo)

Schemas:

  • auth β†’ Users, Sessions
  • in1 β†’ Rhamas (with Alchemy Detection: Piombo/Transition/Oro)
  • elements β†’ Properties, Bookings
  • finance β†’ Transactions
  • library β†’ Documents (pgvector for RAG)
  • ai β†’ Models, Prompts
  • system β†’ Config, Logs
  • organization β†’ Teams, Invites

BrandDominioEntry PointTech Stack
BlackTrailsblacktrails.iosrc/brands/blacktrails/routes.jsNode.js + EJS
IN-1in-1.aisrc/brands/in1/routes.jsALMA AI + Claude
Elementselements.blacktrails.iosrc/brands/elements/routes.jsProperty Mgmt
Forestforest.blacktrails.iosrc/brands/forest/routes.jsAI Gallery
gCoregcore.blacktrails.iosrc/brands/gcore/routes.jsAnalytics

Main Routes (Public):

  • GET / - Homepage
  • GET /rhama - Rhama generator UI (main experience)
  • GET /soul-card - ⭐ Soul Card (collective emotional state visualization)
  • GET /vision - Vision & philosophy page
  • GET /legal, /privacy, /terms, /contact - Legal pages

API Routes:

  • POST /api/rhama - Main Rhama generation API (rate-limited)
    • Input: { messages: [...], turn: N }
    • Output: { status, response, rhama?, turn, alchemy? }
    • Alchemy Detection: Evaluates baseline emotional state (first turn)
    • Database: Saves to in1.rhamas with emotion tag
  • GET /api/rhamas/random - Random Rhama from database
  • POST /api/tree - Tree planting trigger (future)

User Routes (Auth Required):

  • GET /app - User dashboard (personal Rhama history)
  • GET /app/create - New Rhama creation page

Special Features:

  • Soul Card (/soul-card):
    • Queries in1.rhamas for today + historical emotional states
    • Calculates weighted color mix (Piombo=indigo, Transition=violet, Oro=gold)
    • Renders animated gradient card (Aurora Boreale effect)
    • CSS animations: aurora (15s), breathe (4s), cardFloat (4s)
    • Interactive 3D flip on click

CategoriaFileFocus
AI Flowtest-alma-v2-flow.jsALMA Pipeline Completo
Emotiontest-emotion-analyzer.jsAnalisi Emotiva
Conversationtest-conversation.jsMulti-Turn Dialogue
Safetytest-safety-keyword.jsContent Moderation
E2Etest-end-to-end.jsFull User Journey

AI Assistant: Quando la struttura del codice cambia (nuove cartelle, moduli, brand), esegui:

Terminal window
# 1. Scansiona la root del progetto
list_dir E:\BLACKTRAILS-PLATFORM (ricorsivo, escludi node_modules)
# 2. Aggiorna questo file mantenendo:
# - Albero ASCII completo
# - Tabelle Entry Points
# - Descrizioni moduli chiave
# 3. Commit con messaggio:
git commit -m "docs(truth): update project map"

Last Auto-Update: 2025-12-22 00:30 UTC
Last Changes: IN-1 routes detail (Soul Card, Alchemy Detection)
Next Review: On major refactoring
Maintainer: BlackTrails AI Agent
Source Repo: BLACKTRAILS-PLATFORM