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

Function NewExperimentsAnalyzeSubcommand

pkg/cli/experiments_command.go:157–187  ·  view source on GitHub ↗

NewExperimentsAnalyzeSubcommand creates the experiments analyze subcommand.

()

Source from the content-addressed store, hash-verified

155
156// NewExperimentsAnalyzeSubcommand creates the experiments analyze subcommand.
157func NewExperimentsAnalyzeSubcommand() *cobra.Command {
158 cmd := &cobra.Command{
159 Use: "analyze <experiment>",
160 Short: "Analyze a specific experiment workflow in detail",
161 Long: `Analyze a specific experiment workflow in detail.
162
163The experiment argument is the workflow ID (branch name without the "experiments/"
164prefix, e.g., "my-workflow" for the "experiments/my-workflow" branch).
165
166Reads the state.json file from the branch and shows per-variant counts, total
167runs, and the most recent run assignments.`,
168 Example: ` ` + string(constants.CLIExtensionPrefix) + ` experiments analyze my-workflow # Analyze experiments/my-workflow
169 ` + string(constants.CLIExtensionPrefix) + ` experiments analyze my-workflow --json # Output in JSON format
170 ` + string(constants.CLIExtensionPrefix) + ` experiments analyze my-workflow --repo owner/repo # Analyze in a specific repository`,
171 Args: cobra.ExactArgs(1),
172 RunE: func(cmd *cobra.Command, args []string) error {
173 jsonOutput, _ := cmd.Flags().GetBool("json")
174 repoOverride, _ := cmd.Flags().GetString("repo")
175 return RunExperimentsAnalyze(ExperimentsAnalyzeConfig{
176 ExperimentName: args[0],
177 RepoOverride: repoOverride,
178 JSONOutput: jsonOutput,
179 })
180 },
181 }
182
183 addJSONFlag(cmd)
184 addRepoFlag(cmd)
185
186 return cmd
187}
188
189// RunExperimentsList lists all experiment branches.
190func RunExperimentsList(config ExperimentsListConfig) error {

Calls 4

RunExperimentsAnalyzeFunction · 0.85
addJSONFlagFunction · 0.85
addRepoFlagFunction · 0.85
GetStringMethod · 0.65