NewExperimentsAnalyzeSubcommand creates the experiments analyze subcommand.
()
| 155 | |
| 156 | // NewExperimentsAnalyzeSubcommand creates the experiments analyze subcommand. |
| 157 | func 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 | |
| 163 | The experiment argument is the workflow ID (branch name without the "experiments/" |
| 164 | prefix, e.g., "my-workflow" for the "experiments/my-workflow" branch). |
| 165 | |
| 166 | Reads the state.json file from the branch and shows per-variant counts, total |
| 167 | runs, 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. |
| 190 | func RunExperimentsList(config ExperimentsListConfig) error { |