chore: auto-commit (11 archivos)

- app.md
- call_monitor
- db.go
- main.go
- operations.db
- operations.db-shm
- operations.db-wal
- migrations/006_function_sequences.sql
- migrations/007_calls_command_snippet.sql
- sequences.go
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 02:06:45 +02:00
parent c4f08bc0c3
commit 134d8cf59e
12 changed files with 735 additions and 6 deletions
+34 -5
View File
@@ -44,6 +44,24 @@ func main() {
dry := fs.Bool("dry-run", false, "Generate drafts without persisting to registry.db.proposals.")
fs.Parse(os.Args[2:])
runPropose(*root, *dry)
case "sequences":
detect := fs.Bool("detect", false, "Run sequence detection (required).")
report := fs.Bool("report", false, "Print human-readable report (implied when --propose is not set).")
propose := fs.Bool("propose", false, "Write new_pipeline proposals to registry.db for uncovered candidates.")
formatJSON := fs.Bool("format", false, "Output JSON instead of text (use with --report or --detect).")
root := fs.String("root", "", "Path to fn_registry root (default: walk up from cwd).")
minOcc := fs.Int("min-occurrences", 5, "Minimum occurrences to be a candidate.")
windowSecs := fs.Int("window-secs", 30, "Max gap in seconds between consecutive calls in a sequence.")
lookbackDays := fs.Int("lookback-days", 30, "How many days of calls to scan.")
fs.Parse(os.Args[2:])
cfg := SequenceConfig{
WindowSecs: *windowSecs,
LookbackDays: *lookbackDays,
MinOccurrences: *minOcc,
MinSessions: 2,
MinSuccessRate: 0.9,
}
runSequences(resolveDB(*dbPath), *detect, *report, *propose, *formatJSON, *root, cfg)
case "-h", "--help", "help":
usage()
default:
@@ -60,10 +78,18 @@ USO:
call_monitor <subcomando> [flags]
SUBCOMANDOS:
init Crea/abre operations.db y aplica migraciones (idempotente).
status Resumen: conteo de filas por tabla + top funciones por calls_total.
snapshot Lee registry.db.functions y snapshotea (function_id, content_hash) en
function_versions con source='index'. Idempotente: solo inserta nuevas tuplas.
init Crea/abre operations.db y aplica migraciones (idempotente).
status Resumen: conteo de filas por tabla + top funciones por calls_total.
snapshot Lee registry.db.functions y snapshotea (function_id, content_hash) en
function_versions con source='index'. Idempotente: solo inserta nuevas tuplas.
sequences Detecta secuencias A→B(→C) repetidas candidatas a pipeline one-shot.
--detect Ejecutar deteccion (obligatorio).
--report Imprimir reporte human-readable (default cuando no se usa --propose).
--propose Escribir proposals new_pipeline a registry.db.
--format Output JSON en vez de texto.
--min-occurrences N Minimo de ocurrencias para ser candidata (default 5).
--window-secs N Max gap en segundos entre calls consecutivas (default 30).
--lookback-days N Dias de historial a escanear (default 30).
FLAGS GLOBALES:
--db PATH Ruta a operations.db (default: ./operations.db junto al binario).
@@ -73,7 +99,10 @@ EJEMPLOS:
call_monitor init
call_monitor status --top 20
call_monitor snapshot
call_monitor snapshot --registry /home/lucas/fn_registry/registry.db`)
call_monitor snapshot --registry /home/lucas/fn_registry/registry.db
call_monitor sequences --detect --report
call_monitor sequences --detect --propose
call_monitor sequences --detect --report --format --min-occurrences 3`)
}
func resolveRegistryDB(override string) string {