Skip to content

feat(config): write to state.toml + keychain and deprecate profiles (2/2)#231

Draft
LorrisSaintGenez wants to merge 1 commit into
feat/profile-deprecationfrom
feat/profile-deprecation-commands
Draft

feat(config): write to state.toml + keychain and deprecate profiles (2/2)#231
LorrisSaintGenez wants to merge 1 commit into
feat/profile-deprecationfrom
feat/profile-deprecation-commands

Conversation

@LorrisSaintGenez
Copy link
Copy Markdown
Contributor

@LorrisSaintGenez LorrisSaintGenez commented Jun 4, 2026

What

  • Flip every credential write from config.toml to the state.toml (non-secrets) + OS keychain (secrets) store. config.toml is now only read as a legacy fallback and is never written.
  • auth login, application create, and application select persist the application metadata + api_key_uuid to state.toml, the API key to the keychain, and set the current application.
  • application list marks configured applications from state.toml; auth crawler stores crawler_user_id in state.toml and the crawler key in the keychain.
  • Deprecate the profile command group (add/list/remove/setdefault) in favor of auth login, application list, and application select. Stored profiles still resolve as aliases via the deprecated --profile flag until v2.0.

Test

Starting from a clean state (no state.toml):

  • algolia auth login: signs in, mints/reuses an API key, writes state.toml (application id + alias + api_key_uuid) and the OS keychain (API key), and sets the app as current. config.toml is left untouched.
  • algolia application list: lists your applications with the configured one marked (profile: <alias>), read from state.toml.
  • algolia application select: switches the current application in state.toml, minting a key into the keychain only if none exists yet.
  • algolia indices list: resolves credentials from state.toml + keychain and succeeds with no flags/env.
  • algolia auth crawler: stores crawler_user_id in state.toml and the crawler API key in the keychain for the current application.
  • algolia profile list (and the other profile … subcommands): still work via the stored aliases but print the deprecation notice pointing to the replacement commands.

Throughout, confirm config.toml is never written (it stays untouched / absent).

GROUT-305

Flip all credential writes from config.toml to the state.toml + OS
keychain store introduced in the stacked base PR. config.toml is now
only read as a legacy fallback and is never written.

- Profile.Add and Config.{RemoveProfile,SetDefaultProfile,SetCrawlerAuth}
  persist non-secrets to state.toml and secrets to the OS keychain.
- ConfiguredProfiles resolves applications from state.toml (metadata
  only; API keys are read lazily from the keychain where needed).
- Persist the API key UUID (api_key_uuid) when minting keys.
- Deprecate the `profile` command group in favor of `auth login`,
  `application list`, and `application select`.

Co-authored-by: Cursor <[email protected]>
@LorrisSaintGenez LorrisSaintGenez self-assigned this Jun 4, 2026
@LorrisSaintGenez LorrisSaintGenez changed the title feat(config): write to state.toml + keychain and deprecate profiles feat(config): write to state.toml + keychain and deprecate profiles (2/2) Jun 4, 2026
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 2 duplication

Metric Results
Complexity 8
Duplication 2

View in Codacy

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

@LorrisSaintGenez LorrisSaintGenez marked this pull request as draft June 4, 2026 22:56
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