From 97932e8bdc95ec5063e6bbd3df1b7ffab5126a15 Mon Sep 17 00:00:00 2001 From: Alexey Zimarev Date: Sat, 11 Apr 2026 16:07:14 +0200 Subject: [PATCH 1/2] docs: add profile management to README Closes #7 Co-Authored-By: Claude Opus 4.6 --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 11f1b54e10..43bd3a4b0f 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,42 @@ kapacitor agent status # check if daemon is running kapacitor agent stop # stop the background daemon ``` +### Profiles + +Profiles let you work with multiple Capacitor servers — for example, a company server for work repos and a separate one for open-source projects. Each profile stores its own server URL, visibility settings, and daemon configuration. + +```bash +kapacitor profile add work --server-url https://cap.example.com +kapacitor profile add oss --server-url https://cap.oss.dev --remote "github.com/myorg/*" +kapacitor profile list +kapacitor profile show work +kapacitor profile remove work +``` + +The `--remote` flag associates a profile with git remote patterns. When you open a repo whose remote matches a pattern, that profile activates automatically. + +#### Switching profiles + +```bash +kapacitor use work # bind 'work' profile to current repo +kapacitor use work --global # set 'work' as the global default +kapacitor use oss --save # bind and write .kapacitor.json for team sharing +``` + +Without `--global`, `use` binds the profile to the current git repo root (or the current directory if not in a repo). With `--save`, it writes a `.kapacitor.json` file that can be committed so the whole team uses the same profile. + +#### Profile resolution order + +The CLI resolves which profile to use in this order: + +1. `--server-url` CLI flag +2. `KAPACITOR_URL` environment variable +3. `KAPACITOR_PROFILE` environment variable +4. `.kapacitor.json` in the repo root +5. Git remote pattern matching from `--remote` flags +6. Repo-specific binding from `kapacitor use` +7. Global active profile (or `default`) + ### Configuration ```bash @@ -173,6 +209,8 @@ kapacitor config set excluded_repos "myorg/secret-project,personal/diary" ```bash kapacitor status # server health check +kapacitor whoami # show current authenticated user +kapacitor login # authenticate via OAuth kapacitor update # check for CLI updates kapacitor logout # delete stored tokens ``` From c644d34fd19081dc90b73ec38fd979c889ff4046 Mon Sep 17 00:00:00 2001 From: Alexey Zimarev Date: Sat, 11 Apr 2026 16:46:26 +0200 Subject: [PATCH 2/2] docs: clarify profile resolution works at directory level, not just git repos Co-Authored-By: Claude Opus 4.6 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 43bd3a4b0f..c10f17c1a7 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ The `--remote` flag associates a profile with git remote patterns. When you open #### Switching profiles ```bash -kapacitor use work # bind 'work' profile to current repo +kapacitor use work # bind 'work' profile to current repo/directory kapacitor use work --global # set 'work' as the global default kapacitor use oss --save # bind and write .kapacitor.json for team sharing ``` @@ -179,9 +179,9 @@ The CLI resolves which profile to use in this order: 1. `--server-url` CLI flag 2. `KAPACITOR_URL` environment variable 3. `KAPACITOR_PROFILE` environment variable -4. `.kapacitor.json` in the repo root +4. `.kapacitor.json` in the repo root (or current directory if not in a repo) 5. Git remote pattern matching from `--remote` flags -6. Repo-specific binding from `kapacitor use` +6. Directory binding from `kapacitor use` 7. Global active profile (or `default`) ### Configuration