You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,15 @@ Verification order: `npm run lint` then `npm test`.
19
19
## Architecture
20
20
21
21
-`src/index.js` — single entrypoint. `commander` CLI, defines subcommands + aliases (`c`=commit, `e`=easy, `st`=status, `p`=push, `t`=story, `s`=start, `pv`=provider, `m`=model). UI modules are **lazy-loaded** via `app()`/`require()` to keep startup fast — don't eagerly require UI modules at the top of index.js.
22
-
-`src/helpers/` — pure logic: `git.js` (wraps `simple-git`), `ai.js` (provider HTTP via axios), `config.js` (config + saved AI connections), `patch.js`.
22
+
-`src/helpers/` — pure logic: `git.js` (wraps `simple-git`), `ai.js` (provider HTTP via axios), `config.js` (config + saved AI connections + legacy migration), `providers.js` (single provider registry: labels, credential fields, model keys, defaults, model-fetch dispatch), `patch.js`.
23
23
-`src/ui/` — all interaction: `app.js` (main menu loop), `common.js` (styles `s.*`, `clear`, `header`), `screen.js` (inquirer prompts, `spinner`/`done`/`fail`), `diff-view.js`.
24
24
-`src/ui/modules/` — one file per feature, each exporting `doXxx(info)` for the menu flow plus smaller helpers. Follow this pattern for new features; keep git/AI logic in `helpers/`.
25
25
26
26
## Gotchas
27
27
28
28
-**Module-level caches**: `helpers/config.js` caches config (`getConfig` returns the same object), `helpers/git.js` caches the simple-git instance, `helpers/ai.js` caches provider connection status. Tests must call `resetConfigCache()` / `resetGitCache()` / `resetAIConnectionCache()` in `beforeEach` (existing tests do this).
29
29
-**Config precedence**: defaults ← `~/.eckra/config.json` ← active saved AI connection (`aiConnections` map, resolved in `getConfig`) ← repo-local `.eckrarc` (searched up the directory tree) ← `ECKRA_*` env vars. `.eckrarc` is gitignored because it can hold API keys. Global config is written with `0600` permissions — keep that security behavior.
30
-
-**Saved AI connections**: multiple provider credentials (per provider and per account) live in the global config under `aiConnections`; `activeAiConnection` selects one. Manage them only via the dedicated helpers (`saveAIConnection`, `setActiveAIConnection`, …) or `eckra provider` — the raw `aiConnections` key is excluded from `eckra config set/unset` (`MANAGED_CONFIG_KEYS`). When a connection is active, provider settings/model changes must be written back into it, not to the flat keys (see `saveProviderSettings` in `ui/modules/settings.js`).
30
+
-**Connections-first AI settings**: all provider credentials/models live as named connections in the global config under `aiConnections`; `activeAiConnection` selects one (resolution: explicit → `default` → first alphabetical — see `resolveActiveConnectionName` in `helpers/config.js`). Setup writes a `default` connection; legacy flat keys (`openaiApiKey`, …) are auto-copied into it once by `migrateLegacyToDefaultIfNeeded` (flat keys stay on disk for downgrade safety). All provider metadata (labels, key fields, model keys, model fetching) comes from `src/helpers/providers.js` — add new providers there, not as switches. UI exposes only **Switch** and **Manage** (`manageProvidersMenu` + shared `connectionWizard`). `eckra config set/unset` rejects provider-managed keys (`PROVIDER_MANAGED_KEYS`) with guidance to use `eckra provider`.
31
31
-**Provider URLs**: `lmStudioUrl` / `ollamaUrl` are normalized (trailing slashes stripped) in `getConfig` so downstream path concatenation doesn't double up `/`.
32
32
-**Conventional commits**: AI-generated messages follow `type: subject` style; keep new commit messages consistent with the repo history (`feat:`, `fix:`, `refactor:`, `docs:`…).
33
33
-`.eckrarc`, `.eckra/`, `docs/`, `*.log` are gitignored.
Copy file name to clipboardExpand all lines: README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ Or jump straight into action:
77
77
|`eckra doctor`|`dr`| Health check |
78
78
|`eckra suggest`|`sg`| Print an AI commit message |
79
79
|`eckra setup`|| Run the setup/onboarding wizard |
80
-
|`eckra model`|`m`| Show current AI settings & change model/provider/connection|
80
+
|`eckra model`|`m`| Show current AI settings & switch/manage providers|
81
81
82
82
> [!TIP]
83
83
> `eckra e` stages everything, generates an AI message, and asks you before committing and pushing.
@@ -190,30 +190,32 @@ ollama pull qwen3.5:2b
190
190
|`Amazon Bedrock`| Bedrock API key + AWS Region (`bedrock-runtime` endpoint) |`us.anthropic.claude-haiku-4-5`|
191
191
|`Amazon Bedrock Mantle`| Bedrock API key + AWS Region (`bedrock-mantle` endpoint) |`us.anthropic.claude-haiku-4-5`|
192
192
193
-
Providers are configured via the settings menu (`More > Settings`) or`~/.eckra/config.json`. eckra fetches the available models for you — run `eckra model` to see your current AI settings (provider, connection, model, masked API key) and where they're stored, then change the model, re-configure the provider, or switch saved connections from the same menu. The same actions live in Settings.
193
+
Providers are configured during setup and stored as **named connections** in`~/.eckra/config.json`. The configuration you pick during `eckra setup` becomes your `default` connection. eckra fetches the available models for you — run `eckra model` to see your current AI settings (provider, connection, model, masked API key) and where they're stored, then switch or manage providers from the same menu.
eckra can store several provider configurations at once — different providers and/or multiple accounts for the same provider (e.g. a work and a personal OpenAI key). One connection is active at a time and every AI call uses it.
197
+
eckra stores several provider configurations side by side — different providers and/or multiple accounts for the same provider (e.g. a work and a personal OpenAI key). One connection is active at a time and every AI call uses it. With no explicit choice, eckra falls back to the `default` connection.
198
198
199
-
After configuring a provider in **More > Settings**, eckra offers to save it as a named connection. You can also add one directly, then switch anytime:
199
+
The AI surfaces expose exactly two actions — **Switch Provider / Account** (pick an existing connection) and **Manage Providers** (everything else: add, edit credentials/model per connection, rename, delete). They live in the Settings menu and behind `eckra model`:
200
200
201
201
```bash
202
202
eckra provider list # All saved connections, active marked with ✓
203
-
eckra provider add # Interactive: provider → key → model → name
203
+
eckra provider add # Interactive wizard: provider → key → model → name
204
204
eckra provider add --name work --provider openai \
eckra provider edit work # Wizard: fix the API key or change the model
206
207
eckra provider use work # Switch globally
207
208
eckra provider use home --local # Pin a connection to this repo only (.eckrarc)
208
209
eckra provider show work # Details (secrets masked)
209
210
eckra provider rename work is # Rename (stays active if it was)
210
211
eckra provider remove work -y # Delete
211
212
```
212
213
213
-
The same actions live in the settings menu under **Switch Provider / Account** and **Manage Saved Providers**.
214
+
> [!NOTE]
215
+
> Upgrading from an older eckra? Your existing flat settings are migrated automatically into a `default` connection on first run — nothing to do. The old keys stay in the file for downgrade safety but are no longer used.
214
216
215
217
> [!NOTE]
216
-
> The active connection can also be set per environment with `ECKRA_ACTIVE_AI_CONNECTION`, or per repository via `.eckrarc` (`eckra config set activeAiConnection <name> --local`). With no active connection, eckra falls back to your base settings.
218
+
> The active connection can also be set per environment with `ECKRA_ACTIVE_AI_CONNECTION`, or per repository via `.eckrarc` (`eckra config set activeAiConnection <name> --local`).
217
219
218
220
> [!NOTE]
219
221
> Per-repository overrides go in `.eckrarc` (gitignored, as it can hold API keys).
> Add `--local` to target the project's `.eckrarc` instead.
236
238
237
-
A few useful keys: `commitType` (commit message format), `subjectMaxLength` (max subject characters, default 50), `locale` (language for messages, default `en`), `timeout` (AI request timeout in ms, default 30000), and `activeAiConnection` (the saved connection in use). Saved connections themselves live under the `aiConnections` key — manage them with `eckra provider`, not `eckra config set`.
239
+
A few useful keys: `commitType` (commit message format), `subjectMaxLength` (max subject characters, default 50), `locale` (language for messages, default `en`), `timeout` (AI request timeout in ms, default 30000), and `activeAiConnection` (the saved connection in use). Provider credentials and models live inside named connections — manage them with `eckra provider` / `eckra model`, not `eckra config set` (which now rejects those keys with guidance).
0 commit comments