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
+6 -2
View File
@@ -86,7 +86,8 @@ func (db *DB) InsertFunction(f *Function) error {
tests, test_file_path, file_path, content_hash, created_at, updated_at,
props, emits, has_state, framework, variant,
notes, documentation, code,
source_repo, source_license, source_file
source_repo, source_license, source_file,
params_schema
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?,
@@ -94,7 +95,8 @@ func (db *DB) InsertFunction(f *Function) error {
?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?,
?, ?, ?,
?, ?, ?
?, ?, ?,
?
)`,
f.ID, f.Name, string(f.Kind), f.Lang, f.Domain, f.Version, string(f.Purity), f.Signature,
f.Description, marshalStrings(f.Tags), marshalStrings(f.UsesFunctions), marshalStrings(f.UsesTypes), marshalStrings(f.Returns),
@@ -103,6 +105,7 @@ func (db *DB) InsertFunction(f *Function) error {
marshalProps(f.Props), marshalStrings(f.Emits), hasState, f.Framework, marshalStrings(f.Variant),
f.Notes, f.Documentation, f.Code,
f.SourceRepo, f.SourceLicense, f.SourceFile,
f.ParamsSchema,
)
return err
}
@@ -559,6 +562,7 @@ func scanFunctions(rows interface{ Next() bool; Scan(...any) error }) ([]Functio
&propsJSON, &emitsJSON, &hasState, &f.Framework, &variantJSON,
&f.Notes, &f.Documentation, &f.Code, &f.ContentHash,
&f.SourceRepo, &f.SourceLicense, &f.SourceFile,
&f.ParamsSchema,
)
if err != nil {
return nil, fmt.Errorf("scanning function: %w", err)