Skip to content

feat(config): new credentials model and profile deprecation#244

Draft
LorrisSaintGenez wants to merge 7 commits into
mainfrom
feat/profile-depr
Draft

feat(config): new credentials model and profile deprecation#244
LorrisSaintGenez wants to merge 7 commits into
mainfrom
feat/profile-depr

Conversation

@LorrisSaintGenez

@LorrisSaintGenez LorrisSaintGenez commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

Migrates the CLI to a new credentials model (state.toml + OS keychain) and deprecates the legacy config.toml-based profile system.

state.toml store (#232): self-contained store for current application, per-app alias and api_key_uuid; atomic save (temp file + rename).

Per-app OS keychain (#233): SaveAppSecrets/LoadAppSecrets in pkg/keychain; neutral package to avoid import cycles with pkg/config.

API key UUID (#234): CreateAPIKey returns CreatedAPIKey{Value, UUID}; Application.APIKeyUUID populated by EnsureAPIKey.

Read resolution (#235): credential getters rewired — env → flag → state.toml + keychain → config.toml → admin fallback. Active app resolved once per command; keychain loaded once and cached.

Write paths (#236): auth login, application create and application select persist to the new model (keychain first, then state.toml); config.toml no longer written. Existing keys reused. auth crawler stores the crawler key in the per-app keychain entry.

Deprecations (#237): --profile flag and all profile subcommands marked deprecated with replacement hints; auth failure hint updated; all user-facing strings reworded from "CLI profile" to the new model.

Extra warning on legacy writes (26ae179): when state.toml already exists (new storage model in use), profile add/remove/setdefault print an additional warning that changes to config.toml profiles will be ignored in a future version.

Test

make build, then:

# Write + read new model
./algolia auth login
cat ~/.config/algolia/state.toml
security find-generic-password -s algolia-cli -a "app:<APP_ID>" -w | sed 's/^go-keyring-base64://' | base64 -d

# Re-select must not create a new dashboard key
./algolia application select

# Crawler key
./algolia auth crawler

# Legacy fallback — config.toml mtime must not change
./algolia indices list

# Deprecation warnings
./algolia --help
./algolia indices list -p <alias>
./algolia profile --help

# With a state.toml present, profile add/remove/setdefault print an extra
# warning: config.toml profile changes ignored in a future version
./algolia profile setdefault <name>

GROUT-305

LorrisSaintGenez and others added 6 commits June 9, 2026 08:15
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Jun 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 88 complexity · 14 duplication

Metric Results
Complexity 88
Duplication 14

View in Codacy

TIP This summary will be updated as you push new changes.

@LorrisSaintGenez LorrisSaintGenez marked this pull request as ready for review June 11, 2026 20:48
profile add/remove/setdefault still write config.toml; once state.toml
exists (new storage model in use), changes to legacy profiles stop being
honored in a future version — say so before executing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LorrisSaintGenez LorrisSaintGenez marked this pull request as draft June 11, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant