MCPcopy
hub / github.com/docker/docker-agent / newGettingStartedCmd

Function newGettingStartedCmd

cmd/root/getting_started.go:18–52  ·  view source on GitHub ↗

newGettingStartedCmd launches the interactive getting-started tour: a normal `run` of the default agent with the scripted tour overlay started immediately. It dispatches through the registered run command (the same mechanism the root command uses when invoked with no arguments) so the session behave

()

Source from the content-addressed store, hash-verified

16// mechanism the root command uses when invoked with no arguments) so the
17// session behaves exactly like a regular interactive run.
18func newGettingStartedCmd() *cobra.Command {
19 return &cobra.Command{
20 Use: "getting-started",
21 Aliases: []string{"tour"},
22 Short: "Learn docker agent with a hands-on interactive tour",
23 Long: `Learn docker agent by doing: a short interactive tour inside the chat UI.
24
25It walks through sending messages, approving tool calls, the command palette
26(Ctrl+k), slash commands, and how agents are configured. About 2 minutes,
27skippable at any point with Esc. Replay it anytime with this command or the
28/getting-started slash command inside the TUI.`,
29 Example: ` docker-agent getting-started`,
30 GroupID: "core",
31 Args: cobra.NoArgs,
32 RunE: func(cmd *cobra.Command, args []string) error {
33 telemetry.TrackCommand(cmd.Context(), "getting-started", args)
34
35 if !isatty.IsTerminal(os.Stdout.Fd()) {
36 return errors.New("the getting-started tour is interactive and needs a terminal")
37 }
38
39 runCmd, _, err := cmd.Root().Find([]string{"run"})
40 if err != nil {
41 return err
42 }
43 if err := runCmd.PersistentFlags().Set("tour", "true"); err != nil {
44 return err
45 }
46 if err := runCmd.PersistentPreRunE(runCmd, nil); err != nil {
47 return err
48 }
49 return runCmd.RunE(runCmd, nil)
50 },
51 }
52}

Callers 1

NewRootCmdFunction · 0.85

Calls 6

TrackCommandFunction · 0.92
ContextMethod · 0.80
IsTerminalMethod · 0.80
NewMethod · 0.45
FindMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected