Init Command¶
The init command initializes the tool's configuration and performs initial setup.
Usage¶
Description¶
Initializes the default configuration for the tool, sets up authentication with GitHub (if needed), and configures SSH keys. This command creates configuration files in the appropriate directories and prepares the tool for first use.
The credential wizards (GitHub, Bitbucket, AI) are interactive. When init runs without an interactive terminal — piped/redirected stdin, CI, or a test harness — those wizards are skipped automatically and only the base configuration is written, so init never blocks waiting on a prompt that can't be answered. Configure a provider later by running its subcommand (e.g. mytool init bitbucket) from a terminal, or by setting the relevant config keys directly.
Flags¶
| Flag | Description | Default |
|---|---|---|
-d, --dir |
Directory to initialize the config in | ~/.mytool/ |
-c, --clean |
Reset existing configuration and replace with defaults | false |
-l, --skip-login |
Skip the GitHub login process | false (or true in CI) |
-k, --skip-key |
Skip SSH key configuration | false (or true in CI) |
CI Mode Detection
When the CI environment variable is set to true, the --skip-login, --skip-key, and --skip-bitbucket flags default to true to avoid interactive prompts in automated environments. Independently of those flags, the credential wizards are also skipped whenever stdin is not an interactive terminal — so init is safe to run in pipelines and scripts without hanging.
Example¶
# Initialize with default settings
mytool init
# Initialize and reset existing config
mytool init --clean
# Initialize to a custom directory
mytool init --dir /etc/mytool/
Subcommands¶
Init GitHub¶
Force reconfiguration of GitHub authentication and SSH keys, regardless of current configuration state.
Usage:
Description: Runs the full GitHub authentication flow (token generation and SSH key configuration) even if already configured. Useful when tokens expire or you need to switch accounts.
Init AI¶
When the AI feature is enabled, the init command gains an ai subcommand for configuring AI provider integration.
Usage:
Description: Configures the AI provider and API keys used by AI-powered features. Presents an interactive form to select a provider and enter API keys for Claude, OpenAI, and Gemini.
Implementation¶
The init command is implemented in cmd/initialise/init.go and uses the pkg/setup package to perform the actual initialization work.