feat: fn check params y fn show muestra params_schema
Nuevo subcomando 'fn check params' lista funciones sin params_schema documentado. 'fn show' ahora muestra el campo Params con el JSON semántico de inputs/outputs.
This commit is contained in:
@@ -35,6 +35,8 @@ func main() {
|
|||||||
cmdProposal(os.Args[2:])
|
cmdProposal(os.Args[2:])
|
||||||
case "run":
|
case "run":
|
||||||
cmdRun(os.Args[2:])
|
cmdRun(os.Args[2:])
|
||||||
|
case "check":
|
||||||
|
cmdCheck(os.Args[2:])
|
||||||
case "app":
|
case "app":
|
||||||
cmdApp(os.Args[2:])
|
cmdApp(os.Args[2:])
|
||||||
case "analysis":
|
case "analysis":
|
||||||
@@ -58,6 +60,7 @@ Usage:
|
|||||||
fn show <id> Muestra entrada completa
|
fn show <id> Muestra entrada completa
|
||||||
fn add [-k kind] Abre $EDITOR con template
|
fn add [-k kind] Abre $EDITOR con template
|
||||||
fn run <id_or_name> [args...] Ejecuta funcion/pipeline (go/py/bash)
|
fn run <id_or_name> [args...] Ejecuta funcion/pipeline (go/py/bash)
|
||||||
|
fn check params Lista funciones sin params_schema
|
||||||
fn ops <subcommand> Gestiona operations.db (fn ops help)
|
fn ops <subcommand> Gestiona operations.db (fn ops help)
|
||||||
fn proposal <add|list|show|update> Gestiona proposals
|
fn proposal <add|list|show|update> Gestiona proposals
|
||||||
fn app <list|clone|pull> Gestiona apps externas (Gitea)
|
fn app <list|clone|pull> Gestiona apps externas (Gitea)
|
||||||
@@ -387,6 +390,9 @@ func printFunction(f *registry.Function) {
|
|||||||
if len(f.Imports) > 0 {
|
if len(f.Imports) > 0 {
|
||||||
fmt.Printf("Imports: %s\n", strings.Join(f.Imports, ", "))
|
fmt.Printf("Imports: %s\n", strings.Join(f.Imports, ", "))
|
||||||
}
|
}
|
||||||
|
if f.ParamsSchema != "" {
|
||||||
|
fmt.Printf("Params: %s\n", f.ParamsSchema)
|
||||||
|
}
|
||||||
if f.Example != "" {
|
if f.Example != "" {
|
||||||
fmt.Printf("\nExample:\n%s\n", f.Example)
|
fmt.Printf("\nExample:\n%s\n", f.Example)
|
||||||
}
|
}
|
||||||
@@ -512,6 +518,53 @@ func printAnalysisEntry(a *registry.Analysis) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- check ---
|
||||||
|
|
||||||
|
func cmdCheck(args []string) {
|
||||||
|
if len(args) < 1 {
|
||||||
|
fmt.Fprintln(os.Stderr, "usage: fn check <subcommand>\n\nSubcommands:\n params Lista funciones sin params_schema documentado")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
switch args[0] {
|
||||||
|
case "params":
|
||||||
|
cmdCheckParams()
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(os.Stderr, "unknown check subcommand: %s\n", args[0])
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func cmdCheckParams() {
|
||||||
|
db := openDB()
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
|
fns, err := db.SearchFunctions("", "", "", "", "")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
var missing []registry.Function
|
||||||
|
for _, f := range fns {
|
||||||
|
if f.ParamsSchema == "" {
|
||||||
|
missing = append(missing, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(missing) == 0 {
|
||||||
|
fmt.Printf("All %d functions have params_schema documented.\n", len(fns))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("%d/%d functions missing params_schema:\n\n", len(missing), len(fns))
|
||||||
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
|
fmt.Fprintln(w, "ID\tLANG\tDOMAIN\tKIND")
|
||||||
|
for _, f := range missing {
|
||||||
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", f.ID, f.Lang, f.Domain, f.Kind)
|
||||||
|
}
|
||||||
|
w.Flush()
|
||||||
|
}
|
||||||
|
|
||||||
// --- add ---
|
// --- add ---
|
||||||
|
|
||||||
func cmdAdd(args []string) {
|
func cmdAdd(args []string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user