Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
32
backend/cmd/validate_codex_models/main.go
Normal file
32
backend/cmd/validate_codex_models/main.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Command validate_codex_models validates a Codex client model catalog file.
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v7/internal/registry"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var inputPath string
|
||||
flag.StringVar(&inputPath, "file", "", "Codex client model catalog JSON file")
|
||||
flag.Parse()
|
||||
|
||||
if strings.TrimSpace(inputPath) == "" {
|
||||
fmt.Fprintln(os.Stderr, "error: --file is required")
|
||||
os.Exit(2)
|
||||
}
|
||||
data, err := os.ReadFile(inputPath)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: read %s: %v\n", inputPath, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = registry.ValidateCodexClientModelsJSON(data); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: invalid Codex client model catalog %s: %v\n", inputPath, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("Validated Codex client model catalog: %s\n", inputPath)
|
||||
}
|
||||
Loading…
Reference in a new issue