MCPcopy Create free account
hub / github.com/github/gh-aw / NewExperimentsCommand

Function NewExperimentsCommand

pkg/cli/experiments_command.go:89–125  ·  view source on GitHub ↗

NewExperimentsCommand creates the experiments command with its subcommands.

()

Source from the content-addressed store, hash-verified

87
88// NewExperimentsCommand creates the experiments command with its subcommands.
89func NewExperimentsCommand() *cobra.Command {
90 cmd := &cobra.Command{
91 Use: "experiments",
92 Hidden: true,
93 Short: "Explore ongoing experiments in the repository",
94 Long: `Explore ongoing experiments in the repository.
95
96Experiments are tracked via git branches with the "experiments/" prefix (e.g.,
97experiments/my-workflow). Each branch stores a state.json file written by the
98workflow's pick_experiment step, containing variant counts and run history.
99
100Available subcommands:
101 - list - List all experiment workflow branches (default)
102 - analyze - Analyze a specific experiment workflow in detail`,
103 Example: ` ` + string(constants.CLIExtensionPrefix) + ` experiments # List all experiments (default)
104 ` + string(constants.CLIExtensionPrefix) + ` experiments list # List all experiments
105 ` + string(constants.CLIExtensionPrefix) + ` experiments list --json # Output in JSON format
106 ` + string(constants.CLIExtensionPrefix) + ` experiments analyze my-workflow # Analyze experiments/my-workflow
107 ` + string(constants.CLIExtensionPrefix) + ` experiments analyze my-workflow --json # Analyze in JSON format`,
108 RunE: func(cmd *cobra.Command, args []string) error {
109 jsonOutput, _ := cmd.Flags().GetBool("json")
110 repoOverride, _ := cmd.Flags().GetString("repo")
111 return RunExperimentsList(ExperimentsListConfig{
112 RepoOverride: repoOverride,
113 JSONOutput: jsonOutput,
114 })
115 },
116 }
117
118 addJSONFlag(cmd)
119 addRepoFlag(cmd)
120
121 cmd.AddCommand(NewExperimentsListSubcommand())
122 cmd.AddCommand(NewExperimentsAnalyzeSubcommand())
123
124 return cmd
125}
126
127// NewExperimentsListSubcommand creates the experiments list subcommand.
128func NewExperimentsListSubcommand() *cobra.Command {

Callers 3

initFunction · 0.92

Calls 6

RunExperimentsListFunction · 0.85
addJSONFlagFunction · 0.85
addRepoFlagFunction · 0.85
GetStringMethod · 0.65

Tested by 2