Initial commit: LLM Automation Docs & Remediation Engine v2.0

Features:
- Automated datacenter documentation generation
- MCP integration for device connectivity
- Auto-remediation engine with safety checks
- Multi-factor reliability scoring (0-100%)
- Human feedback learning loop
- Pattern recognition and continuous improvement
- Agentic chat support with AI
- API for ticket resolution
- Frontend React with Material-UI
- CI/CD pipelines (GitLab + Gitea)
- Docker & Kubernetes deployment
- Complete documentation and guides

v2.0 Highlights:
- Auto-remediation with write operations (disabled by default)
- Reliability calculator with 4-factor scoring
- Human feedback system for continuous learning
- Pattern-based progressive automation
- Approval workflow for critical actions
- Full audit trail and rollback capability
This commit is contained in:
LLM Automation System
2025-10-17 23:47:28 +00:00
commit 1ba5ce851d
89 changed files with 20468 additions and 0 deletions

50
docs/api/endpoints.md Normal file
View File

@@ -0,0 +1,50 @@
# API Endpoints Reference
## Complete Endpoint List
| Method | Endpoint | Description | Auth |
|--------|----------|-------------|------|
| GET | `/api/v1/sections` | List all sections | No |
| GET | `/api/v1/sections/{id}` | Get section content | No |
| GET | `/api/v1/summary` | Get sections summary | No |
| GET | `/api/v1/search` | Search documentation | No |
| GET | `/api/v1/stats` | Get statistics | No |
| GET | `/api/v1/llm-optimized/{id}` | Get LLM-optimized content | No |
| GET | `/health` | Health check | No |
| GET | `/mcp/methods` | List MCP methods | Yes |
| GET | `/mcp/connections` | List connections | Yes |
| POST | `/mcp/execute/ssh` | Execute SSH command | Yes |
| POST | `/mcp/execute/snmp/get` | SNMP GET query | Yes |
| POST | `/mcp/execute/api` | API request | Yes |
## Response Formats
All API responses follow this structure:
### Success Response
```json
{
"success": true,
"data": { ... },
"timestamp": "2025-01-20T10:30:00Z"
}
```
### Error Response
```json
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE",
"timestamp": "2025-01-20T10:30:00Z"
}
```
## HTTP Status Codes
- `200` - Success
- `400` - Bad Request
- `401` - Unauthorized
- `404` - Not Found
- `429` - Too Many Requests
- `500` - Internal Server Error

135
docs/api/index.md Normal file
View File

@@ -0,0 +1,135 @@
# API Documentation
La documentazione datacenter è accessibile tramite API REST ottimizzata per umani e LLM.
## Base URL
```
https://docs.datacenter.local/api/v1
```
## Authentication
Attualmente l'API è accessibile senza autenticazione nella rete interna.
Per accesso esterno è richiesta autenticazione API key.
## Endpoints
### GET /sections
Lista tutte le sezioni disponibili con metadata.
**Response:**
```json
[
{
"id": "01_infrastruttura_fisica",
"title": "Infrastruttura Fisica",
"section": "01",
"last_updated": "2025-01-20T10:30:00Z",
"size_bytes": 45000,
"token_estimate": 11250,
"url": "/docs/sections/01_infrastruttura_fisica/",
"api_url": "/api/v1/sections/01_infrastruttura_fisica"
}
]
```
### GET /sections/{section_id}
Ottieni contenuto completo di una sezione.
**Parameters:**
- `format` (query): `markdown` | `html` | `json` (default: `markdown`)
**Example:**
```bash
curl https://docs.datacenter.local/api/v1/sections/02_networking?format=markdown
```
### GET /summary
Summary ottimizzato per LLM con key points di ogni sezione.
**Response:**
```json
[
{
"section_id": "01_infrastruttura_fisica",
"title": "Infrastruttura Fisica",
"key_points": [
"Informazioni Generali Datacenter",
"Layout e Organizzazione",
"Sistema Elettrico"
],
"subsections": ["1.1", "1.2", "2.1", ...],
"last_updated": "2025-01-20T10:30:00Z"
}
]
```
### GET /search
Ricerca full-text nella documentazione.
**Parameters:**
- `q` (query, required): Search query
- `limit` (query): Max results (default: 10, max: 50)
**Example:**
```bash
curl "https://docs.datacenter.local/api/v1/search?q=ups&limit=5"
```
### GET /stats
Statistiche generali della documentazione.
### GET /llm-optimized/{section_id}
Contenuto ottimizzato specificamente per consumo LLM.
**Features:**
- Markdown pulito
- Metadata espliciti
- Istruzioni per LLM
- Token count
## Rate Limiting
- API pubblica: 100 req/min
- Con API key: 1000 req/min
## Esempi d'uso
### Python
```python
import requests
# Get all sections
response = requests.get('https://docs.datacenter.local/api/v1/sections')
sections = response.json()
# Get specific section
response = requests.get(
'https://docs.datacenter.local/api/v1/sections/02_networking',
params={'format': 'markdown'}
)
content = response.json()
print(f"Section: {content['metadata']['title']}")
print(f"Tokens: {content['metadata']['token_estimate']}")
print(content['content'])
```
### cURL
```bash
# Get summary
curl https://docs.datacenter.local/api/v1/summary | jq
# Search
curl "https://docs.datacenter.local/api/v1/search?q=vmware&limit=10" | jq
# Get stats
curl https://docs.datacenter.local/api/v1/stats | jq
```

93
docs/api/mcp.md Normal file
View File

@@ -0,0 +1,93 @@
# MCP Server Documentation
Il MCP (Model Context Protocol) Server fornisce metodi per LLM per connettersi e recuperare dati dalle infrastrutture.
## Base URL
```
https://docs.datacenter.local/mcp
```
## Metodi Disponibili
### GET /methods
Lista tutti i metodi disponibili con descrizione e parametri.
### GET /connections
Lista connessioni configurate (senza credenziali).
## Execution Endpoints
### POST /execute/ssh
Esegui comando SSH su device.
**Request:**
```json
{
"connection_name": "switch-core-01",
"command": "show version"
}
```
### POST /execute/snmp/get
Query SNMP GET su OID specifico.
**Request:**
```json
{
"connection_name": "ups-01",
"oid": ".1.3.6.1.2.1.33.1.2.1.0"
}
```
### POST /execute/api
Esegui richiesta API REST.
**Request:**
```json
{
"connection_name": "vcenter-prod",
"endpoint": "/rest/vcenter/vm",
"method": "GET"
}
```
## Esempi
### Python con MCP
```python
import asyncio
from mcp_client import MCPClient
async def get_infrastructure_data():
client = MCPClient('https://docs.datacenter.local/mcp')
# Get VMware VMs
vms = await client.vmware_get_vms('vcenter-prod')
# Get switch config
config = await client.cisco_get_interfaces('switch-core-01')
# Get UPS status
ups_status = await client.ups_get_status('ups-01')
return {
'vms': vms,
'network': config,
'power': ups_status
}
data = asyncio.run(get_infrastructure_data())
```
## Security
- Accesso limitato a rete management
- Read-only operations only
- Audit logging completo
- Rate limiting per connessione