|
| 1 | +--- |
| 2 | +name: kodus-centralized-config |
| 3 | +description: Use when the user wants to manage centralized configuration via `kodus config centralized` commands (status, init, sync, disable, and download). |
| 4 | +--- |
| 5 | + |
| 6 | +# Kodus Centralized Config |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Centralized configuration allows teams to manage their Kodus configuration files in a single repository, providing a single source of truth for their settings. This skill enables users to manage their centralized configuration through Kodus CLI commands, including initializing centralized config, syncing configuration, disabling centralized config, and downloading generated config files. |
| 11 | + |
| 12 | +The configuration files are generated based on the user's current settings, and users have the option to review these changes in a pull request before they are merged into the repository. This approach ensures that teams can maintain control over their configuration while benefiting from the convenience of centralized management. |
| 13 | + |
| 14 | +If the setting is enabled, then any pull request merged to the selected repository will trigger a sync to update the configuration in Kodus. This allows teams to easily manage and update their configuration as needed, without having to manually apply changes in Kodus. |
| 15 | + |
| 16 | +At any time the user can run a manual sync command to pull the latest configuration from the repository, however this is not recommended. |
| 17 | + |
| 18 | +## Goal |
| 19 | + |
| 20 | +Manage centralized configuration through Kodus CLI commands only. |
| 21 | + |
| 22 | +Use this skill when the request involves enabling centralized config, selecting the source repository, syncing configuration, disabling centralized config, or downloading generated config files. |
| 23 | + |
| 24 | +## Trigger Hints |
| 25 | + |
| 26 | +- Mentions of centralized config, centralized configuration, config sync source repo, or source repository for rules. |
| 27 | +- Requests to run: `kodus config centralized status|init|sync|disable|download`. |
| 28 | +- Requests to enable or disable centralized config from terminal. |
| 29 | + |
| 30 | +## Workflow |
| 31 | + |
| 32 | +Unless specifically stated, YOU must run the Kodus CLI commands on behalf of the user. Do not provide instructions to run commands without also running them yourself. |
| 33 | + |
| 34 | +1. Confirm team-key authentication is available. |
| 35 | + |
| 36 | +- Centralized config commands require team-key auth. |
| 37 | +- If missing, instruct the user to run: |
| 38 | + |
| 39 | +```bash |
| 40 | +kodus auth team-key --key <your-key> |
| 41 | +``` |
| 42 | + |
| 43 | +2. Check current centralized status first when context is unclear. |
| 44 | + |
| 45 | +```bash |
| 46 | +kodus config centralized status |
| 47 | +``` |
| 48 | + |
| 49 | +3. Initialize centralized config when requested. |
| 50 | + |
| 51 | +- Preferred command shape: |
| 52 | + |
| 53 | +```bash |
| 54 | +kodus config centralized init [owner/repo] --sync-option <pr|manual> |
| 55 | +``` |
| 56 | + |
| 57 | +ALWAYS run the command `kodus config remote list` first to get the list of repositories the user has access to and their current selection. You must provide the repo in the shape `owner/repo` for example `organization/repository-name`. If you cannot find the repository in the list, then tell the user about it. |
| 58 | + |
| 59 | +- Defaults and behavior: |
| 60 | +- `--sync-option` defaults to `pr`. Defines the behaviour of the initial sync after enabling centralized config. |
| 61 | + - `pr` creates a pull request with their current config. A link to the PR is provided in the command output. Merging the PR triggers a sync to update the configuration in Kodus. |
| 62 | + - `manual` simply enables centralized config without creating a PR, the user will need to create a PR themselves with their desired config or run a manual sync after pushing changes to the repository. |
| 63 | +- If repository is omitted in an interactive terminal, CLI prompts repository selection. |
| 64 | +- In non-interactive mode, repository must be provided explicitly. |
| 65 | + |
| 66 | +Prefer providing the repository in the command to avoid interactive prompts, especially in non-interactive contexts. If the repository is not provided and the terminal is interactive, the CLI will prompt the user to select a repository from their accessible repositories. If the terminal is non-interactive and the repository is not provided, the command will fail with an error indicating that the repository is required. |
| 67 | + |
| 68 | +4. Sync centralized config on demand. |
| 69 | + |
| 70 | +A sync will pull the latest configuration from the repository and override the user's current configuration defined in the Kodus database with the config from the repository. Syncs happen automatically when a PR is merged regardless of the initial sync option selected, but users can also choose to run a manual sync at any time to pull the latest changes from the repository. |
| 71 | + |
| 72 | +```bash |
| 73 | +kodus config centralized sync |
| 74 | +``` |
| 75 | + |
| 76 | +Avoid running sync automatically after init to give users control over when to pull changes, especially if they want to review or customize the generated config before applying it. |
| 77 | + |
| 78 | +Running sync will override the user's current configuration with the config from the repository, so it's best to let users decide when to do this, be sure to warn them of this when they ask to run sync and recommend downloading the config first as a backup before syncing. |
| 79 | + |
| 80 | +5. Disable centralized config when requested. |
| 81 | + |
| 82 | +```bash |
| 83 | +kodus config centralized disable |
| 84 | +``` |
| 85 | + |
| 86 | +6. Download centralized config zip artifact. |
| 87 | + |
| 88 | +```bash |
| 89 | +kodus config centralized download --out <path/to/centralized-config.zip> |
| 90 | +``` |
| 91 | + |
| 92 | +- `--out` is required. |
| 93 | + |
| 94 | +## Output Guidance |
| 95 | + |
| 96 | +- Prefer using `--json` to receive structured output. |
| 97 | +- When providing output to the user, summarize the key information and next steps rather than dumping raw command output. |
| 98 | + |
| 99 | +## Safety Notes |
| 100 | + |
| 101 | +- Do not suggest manually editing backend parameters for centralized config when CLI commands exist. |
| 102 | +- If repository selection fails, verify the repository is already selected in Kodus (`kodus config remote list`). |
0 commit comments