newSecretsBootstrapSubcommand creates the `secrets bootstrap` subcommand
()
| 14 | |
| 15 | // newSecretsBootstrapSubcommand creates the `secrets bootstrap` subcommand |
| 16 | func newSecretsBootstrapSubcommand() *cobra.Command { |
| 17 | var engineFlag string |
| 18 | var nonInteractiveFlag bool |
| 19 | |
| 20 | cmd := &cobra.Command{ |
| 21 | Use: "bootstrap", |
| 22 | Short: "Analyze workflows and set up required secrets", |
| 23 | Long: `Analyze all workflows in the repository to determine which secrets |
| 24 | are required, check which ones are already configured, and interactively |
| 25 | prompt for any missing required secrets. |
| 26 | |
| 27 | Only required secrets are prompted for. Optional secrets are not shown.`, |
| 28 | Example: ` gh aw secrets bootstrap # Check and set up all required secrets |
| 29 | gh aw secrets bootstrap --non-interactive # Display missing secrets without prompting |
| 30 | gh aw secrets bootstrap --engine copilot # Check secrets for a specific engine`, |
| 31 | RunE: func(cmd *cobra.Command, args []string) error { |
| 32 | repo, _ := cmd.Flags().GetString("repo") |
| 33 | return runTokensBootstrap(engineFlag, repo, nonInteractiveFlag) |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | cmd.Flags().BoolVar(&nonInteractiveFlag, "non-interactive", false, "Check secrets without prompting (display-only mode)") |
| 38 | cmd.Flags().StringVarP(&engineFlag, "engine", "e", "", "Check tokens for specific engine (copilot, claude, codex, gemini, crush)") |
| 39 | addRepoFlag(cmd) |
| 40 | |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runTokensBootstrap(engine, repo string, nonInteractive bool) error { |
| 45 | tokensBootstrapLog.Printf("Running tokens bootstrap: engine=%s, repo=%s, nonInteractive=%v", engine, repo, nonInteractive) |
no test coverage detected