Skip to content

Say what to store, not where it goes - #619

Merged
razor-x merged 3 commits into
mainfrom
claude/cli-config-methods-4njgxv
Aug 12, 2026
Merged

Say what to store, not where it goes#619
razor-x merged 3 commits into
mainfrom
claude/cli-config-methods-4njgxv

Conversation

@razor-x

@razor-x razor-x commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

Storing a value meant knowing the key it lives under. Callers wrote config.delete('current_workspace_id') and config.set(`${auth.endpoint}.pat`, token), and the three writes that always go together needed a storeEndpoint helper to keep them together.

The config now answers in the CLI's own terms:

config.setEndpoint(endpoint)        // and the legacy key, and the stale workspace
config.getToken(endpoint)           // hides the per-endpoint key
config.setToken(endpoint, token)
config.unsetToken(endpoint)         // and any un-namespaced token left behind
config.getWorkspace()
config.setWorkspace(workspaceId)
config.unsetWorkspace()
config.getUseRemoteApiDefs()
config.setUseRemoteApiDefs(value)

Every key lives in config/values.ts and is read by config/seam-config.ts alone. Nothing else in the CLI names one.

What moved

  • New config/seam-config.tsSeamConfig, over any ConfigStore. The rules that were spread across callers live here: tokens are keyed per endpoint; getEndpoint falls back to the legacy server key; setEndpoint drops that key and the workspace that belonged to the old endpoint; unsetToken also drops the un-namespaced token an older CLI wrote.
  • getConfigStoregetConfig — what the CLI holds is its configuration, not a key/value store. ConfigStore stays as the storage underneath, which PersistentConfigStore and the memory store implement.
  • context.tsresolveAuth reads three methods, and its readString moves into the config, which is the only place that needs it.
  • auth/operations.ts — every write is a method call, and storeEndpoint is gone: what it did belongs to setEndpoint.
  • rootPathsseamPaths moves into the config module. Where the CLI keeps its files is config's business, and blueprint/source-npm.ts reads the cache directory from there rather than deriving the same root a second time.

Tests

test/auth/operations.test.ts and test/context.test.ts build a createMemoryConfig() and assert through the same methods, so they no longer restate the storage layout.

Two assertions deliberately still reach for the store, because what they check is invisible above it: that logging out drops an un-namespaced token, and that selecting an endpoint drops the legacy key. Those tests construct createSeamConfig(createMemoryConfigStore(…)) and assert on the store.

157 tests pass.


Generated by Claude Code

claude added 3 commits August 12, 2026 04:41
Storing a value meant knowing the key it lives under, so callers passed
keys around: config.delete('current_workspace_id'), config.set(`${endpoint}.pat`,
token), and a storeEndpoint helper for the three writes that go together.

The config now answers in the CLI's own terms — setWorkspace, unsetWorkspace,
getToken, setToken, unsetToken, setEndpoint — and the keys live in values.ts,
used by that one file. Reading and writing per endpoint, dropping the legacy
key, and clearing what belonged to the previous endpoint are its business
rather than each caller's.

seamPaths moves here too, as rootPaths: where the CLI keeps its files is
config's own business, and the blueprint cache reads it from here rather than
deriving the same root again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QCJ1v1NFc6b43GooAhij2c
Seam is not said internally unless it has to be, and the keys are read by
this one file, so a constant for each was a name to look up rather than a
literal to read.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QCJ1v1NFc6b43GooAhij2c
main's #618 gives login a token rather than options, and resolves a flag
over the environment over what is stored. Both are taken as they are; what
changes is that the reads and writes underneath them are method calls.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QCJ1v1NFc6b43GooAhij2c
@razor-x
razor-x merged commit 89e45e7 into main Aug 12, 2026
14 checks passed
@razor-x
razor-x deleted the claude/cli-config-methods-4njgxv branch August 12, 2026 04:57
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.

2 participants