feat: tabla apps en registry — modelo, parser, indexer y CLI

Agrega soporte completo para indexar aplicaciones del directorio apps/.
Cada app tiene un descriptor app.md con frontmatter YAML que el indexer
recoge automaticamente. Incluye migracion 004, modelo App, ParseAppMD,
ValidateApp, store CRUD con FTS5, y soporte en fn list/search/show.
Crea descriptores app.md para docker_tui, pipeline_launcher y metabase_registry.
This commit is contained in:
2026-03-29 00:13:57 +01:00
parent 95959f713c
commit f570e783fe
11 changed files with 465 additions and 6 deletions
+35
View File
@@ -11,6 +11,7 @@ import (
type IndexResult struct {
Functions int
Types int
Apps int
ValidationErrors []string
Errors []string
}
@@ -76,6 +77,28 @@ func Index(db *DB, root string) (*IndexResult, error) {
})
}
// Parse apps from apps/*/app.md
var apps []*App
appsDir := filepath.Join(root, "apps")
if fi, err := os.Stat(appsDir); err == nil && fi.IsDir() {
entries, _ := os.ReadDir(appsDir)
for _, e := range entries {
if !e.IsDir() {
continue
}
appMD := filepath.Join(appsDir, e.Name(), "app.md")
if _, err := os.Stat(appMD); err != nil {
continue
}
a, err := ParseAppMD(appMD, root)
if err != nil {
result.Errors = append(result.Errors, fmt.Sprintf("parse %s: %v", appMD, err))
continue
}
apps = append(apps, a)
}
}
// Build known ID sets
knownFunctions := make(map[string]bool, len(functions))
for _, f := range functions {
@@ -111,6 +134,18 @@ func Index(db *DB, root string) (*IndexResult, error) {
result.Functions++
}
for _, a := range apps {
if verr := ValidateApp(a, knownFunctions, knownTypes); verr != nil {
result.ValidationErrors = append(result.ValidationErrors, verr.Error())
continue
}
if err := db.InsertApp(a); err != nil {
result.Errors = append(result.Errors, fmt.Sprintf("insert %s: %v", a.ID, err))
continue
}
result.Apps++
}
return result, nil
}