Files
docker-agent/cmd/root/getting_started.go
T
Sayt-0 23381c5c70 fix(tui): make the tour's tool step trigger a real confirmation
The suggested ask ("what's in this folder?") routes to the filesystem
list tool, which carries ReadOnlyHint and is auto-approved by the
dispatcher, so no confirmation dialog ever appeared and the step could
not complete. Suggest "run ls in the shell" instead: the shell tool
always prompts. The step body now says that only side-effecting tools
wait for approval instead of claiming nothing runs unapproved.

Also tone the card down: drop the emoji from step titles and the
palette entry (keep the welcome wave and the end-of-tour confetti) and
replace the em-dashes in tour copy, notifications, and command help
with plain punctuation.
2026-07-03 11:07:30 +02:00

53 lines
1.7 KiB
Go

package root
import (
"errors"
"os"
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"
"github.com/docker/docker-agent/pkg/telemetry"
)
// 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 behaves exactly like a regular interactive run.
func newGettingStartedCmd() *cobra.Command {
return &cobra.Command{
Use: "getting-started",
Aliases: []string{"tour"},
Short: "Learn docker agent with a hands-on interactive tour",
Long: `Learn docker agent by doing: a short interactive tour inside the chat UI.
It walks through sending messages, approving tool calls, the command palette
(Ctrl+k), slash commands, and how agents are configured. About 2 minutes,
skippable at any point with Esc. Replay it anytime with this command or the
/getting-started slash command inside the TUI.`,
Example: ` docker-agent getting-started`,
GroupID: "core",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
telemetry.TrackCommand(cmd.Context(), "getting-started", args)
if !isatty.IsTerminal(os.Stdout.Fd()) {
return errors.New("the getting-started tour is interactive and needs a terminal")
}
runCmd, _, err := cmd.Root().Find([]string{"run"})
if err != nil {
return err
}
if err := runCmd.PersistentFlags().Set("tour", "true"); err != nil {
return err
}
if err := runCmd.PersistentPreRunE(runCmd, nil); err != nil {
return err
}
return runCmd.RunE(runCmd, nil)
},
}
}