(cmd *cobra.Command, args []string)
| 199 | } |
| 200 | |
| 201 | func (f *debugFlags) runDebugTitleCommand(cmd *cobra.Command, args []string) (commandErr error) { |
| 202 | telemetry.TrackCommand(cmd.Context(), "debug", append([]string{"title"}, args...)) |
| 203 | defer func() { // do not inline this defer so that commandErr is not resolved early |
| 204 | telemetry.TrackCommandError(cmd.Context(), "debug", append([]string{"title"}, args...), commandErr) |
| 205 | }() |
| 206 | |
| 207 | ctx := cmd.Context() |
| 208 | |
| 209 | t, err := f.loadTeam(ctx, args[0], teamloader.WithModelOverrides(f.modelOverrides)) |
| 210 | if err != nil { |
| 211 | return err |
| 212 | } |
| 213 | defer stopToolSets(ctx, t) |
| 214 | |
| 215 | agent, err := t.DefaultAgent() |
| 216 | if err != nil { |
| 217 | return err |
| 218 | } |
| 219 | |
| 220 | // Use the same title generation code path as the TUI (see runTUI in new.go), |
| 221 | // including any dedicated title_model configured for the agent's model. |
| 222 | models := agent.TitleModels(ctx) |
| 223 | if len(models) == 0 { |
| 224 | return fmt.Errorf("agent %q has no model configured", agent.Name()) |
| 225 | } |
| 226 | gen := sessiontitle.New(models[0], models[1:]...) |
| 227 | |
| 228 | title, err := gen.Generate(ctx, "debug", []string{args[1]}) |
| 229 | if err != nil { |
| 230 | return fmt.Errorf("generating title with agent %q: %w", agent.Name(), err) |
| 231 | } |
| 232 | |
| 233 | fmt.Fprintln(cmd.OutOrStdout(), title) |
| 234 | |
| 235 | return nil |
| 236 | } |
nothing calls this directly
no test coverage detected