feat: add params_schema column for function composability

Nueva columna params_schema en functions con migración 009. Almacena JSON
con descripción semántica de inputs/outputs para que agentes razonen sobre
composabilidad de funciones. Incluye: campo en modelo Go, parsing de params/output
del frontmatter YAML, serialización a JSON, FTS5 rebuild con nueva columna,
hash de contenido actualizado, y warning en indexer cuando faltan params.
This commit is contained in:
2026-04-05 18:45:01 +02:00
parent 7ca3ffb92c
commit 0da3e530dd
6 changed files with 89 additions and 2 deletions
+8
View File
@@ -238,6 +238,8 @@ func Index(db *DB, root string) (*IndexResult, error) {
}
// Post-insert: warn about file_path entries that don't exist on disk
// and functions missing params_schema
missingParams := 0
for _, f := range functions {
if f.FilePath != "" {
abs := filepath.Join(root, f.FilePath)
@@ -251,6 +253,12 @@ func Index(db *DB, root string) (*IndexResult, error) {
result.Warnings = append(result.Warnings, fmt.Sprintf("%s: test_file_path %q not found", f.ID, f.TestFilePath))
}
}
if f.ParamsSchema == "" {
missingParams++
}
}
if missingParams > 0 {
result.Warnings = append(result.Warnings, fmt.Sprintf("%d functions missing params_schema (run 'fn check params' to list)", missingParams))
}
for _, t := range types {
if t.FilePath != "" {