Add resolved PromptKit profile inspection

This commit is contained in:
2026-10-04 13:54:17 +00:00
parent 79154882b8
commit db8acbea43
6 changed files with 222 additions and 1 deletions

View File

@@ -118,6 +118,51 @@ func runConfigExplain(args []string, stdout, stderr io.Writer, opts Options) int
return 0
}
func runConfigProfile(args []string, stdout, stderr io.Writer, opts Options) int {
fs := flag.NewFlagSet("config profile", flag.ContinueOnError)
fs.SetOutput(io.Discard)
configPath := fs.String("config", "", "config file path")
overlay := fs.String("config-overlay", "", "configuration overlay")
if err := fs.Parse(args); err != nil {
fmt.Fprintf(stderr, "notarius: %v\n", err)
return 2
}
if fs.NArg() != 1 || strings.TrimSpace(fs.Arg(0)) == "" {
fmt.Fprintln(stderr, "notarius: config profile requires exactly one nonblank profile ID")
return 2
}
profileID := fs.Arg(0)
loaded, _, err := loadConfigKit(*configPath, *overlay, nil, opts)
if err != nil {
writeConfigLoadError(stderr, err)
return 1
}
inspector, err := newPromptKitInspection(loaded.Config, opts)
if err != nil {
fmt.Fprintf(stderr, "notarius: inspect PromptKit configuration: %v\n", err)
return 1
}
profile, err := inspector.InspectProfile(context.Background(), profileID)
if err != nil {
fmt.Fprintf(stderr, "notarius: %v\n", err)
return 1
}
result := struct {
ProfileID string `json:"profile_id"`
APIKeyRequired bool `json:"api_key_required"`
EffectiveModelParams frameworkllm.PromptKitEffectiveModelParams `json:"effective_model_params"`
}{
ProfileID: profile.ProfileID,
APIKeyRequired: profile.CredentialRequired,
EffectiveModelParams: profile.EffectiveModelParams,
}
if err := json.NewEncoder(stdout).Encode(result); err != nil {
fmt.Fprintf(stderr, "notarius: write PromptKit profile inspection: %v\n", err)
return 1
}
return 0
}
func newPromptKitInspection(cfg config.Config, opts Options) (*frameworkllm.PromptKitProfileInspector, error) {
return frameworkllm.NewPromptKitProfileInspector(frameworkllm.PromptKitProfileInspectorConfig{
Source: promptKitProfileSourceConfig(cfg),