feat(doctor): add fn doctor CLI + 14 functions for system management
Adds `fn doctor` read-only diagnostic command with subcommands artefacts, services, sync, uses-functions, unused, and --json flag for agents. Each subcommand wraps a registry function in functions/infra/. New functions: - artefact_doctor, services_status, pc_locations_drift, audit_uses_functions, find_unused_functions (Go diagnostics) - backup_sqlite_db, rotate_backups, wait_for_http, wait_for_port, port_kill, tail_journal, pre_commit_hook_install (bash utilities) - notify_telegram (Go HTTP) - backup_all pipeline (tag launcher) Plus prior session leftovers (scan_secrets_in_dirty, append_diary_entry, git utilities, http_session_cookie_middleware, compile/full-git pipelines). Fixes pc_locations_drift filepath.Join bug with absolute dir_path. Documents fn doctor in CLAUDE.md, .claude/rules/fn_doctor.md (rule 23), docs/architecture.md, CHANGELOG.md (2026-05-07), and diary entry. First fn doctor uses-functions run found drift in 7/12 apps (deuda para sincronizar app.md con imports reales). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -119,6 +119,22 @@ El agente consulta la operacional para:
|
||||
|
||||
---
|
||||
|
||||
## Capa diagnostica: `fn doctor`
|
||||
|
||||
Sobre el modelo registry+operations existe el comando `fn doctor` (read-only) que reporta estado del sistema:
|
||||
|
||||
- `artefacts` — salud por artefacto (git/venv/manifest/upstream).
|
||||
- `services` — apps tag `service` + systemctl + puerto.
|
||||
- `sync` — drift `pc_locations` BD vs disco del PC actual.
|
||||
- `uses-functions` — drift entre imports reales en codigo de apps y `uses_functions` declarado en `app.md`.
|
||||
- `unused` — funciones del registry sin consumidores.
|
||||
|
||||
Cada subcomando es wrapper fino sobre una funcion del registry (`functions/infra/{artefact_doctor,services_status,pc_locations_drift,audit_uses_functions,find_unused_functions}.go`). La logica vive en el registry; el CLI solo formatea. `--json` produce salida estructurada para agentes. Detalle en `.claude/rules/fn_doctor.md`.
|
||||
|
||||
Util tras deploys, `fn sync`, `git pull` masivos o como gate antes de evaluar metricas del bucle reactivo.
|
||||
|
||||
---
|
||||
|
||||
## Mejoras incorporadas al schema v1.0
|
||||
|
||||
| Problema | Solución |
|
||||
|
||||
Reference in New Issue
Block a user