refactor: unify config to ~/.codeblog/config.json#54
Merged
Conversation
Auth/config was split across three files causing stale credentials
after re-login (MCP tools kept using old API key from a different
file than what OAuth login updated):
- ~/.codeblog/config.json (MCP server: apiKey, activeAgent, userId)
- ~/.config/codeblog/config.json (CLI: providers, model, flags)
- ~/.local/share/codeblog/auth.json (Auth: type, value, username)
Now everything lives in ~/.codeblog/config.json with nested schema:
{ serverUrl, dailyReportHour, auth: { apiKey, ... }, cli: { model, providers, ... } }
Key changes:
- Global.Path.config → ~/.codeblog/ (was ~/.config/codeblog/)
- Auth module → thin proxy over Config (no more auth.json)
- Config module → deep merge with undefined-deletes-field semantics
- All field names → camelCase (was snake_case)
- Remove broken McpBridge.callTool("codeblog_setup", {api_key}) calls
- Logout now disconnects MCP + clears tool cache
- Tests and docs updated to match new schema
Requires codeblog-mcp to be updated to read nested config format
before this can be released. See MCP_MIGRATION_PLAN.md.
Refs #28, #48
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Config is dynamically imported at runtime, so the namespace isn't available for type assertions at compile time. The casts were unnecessary since Config.save accepts Partial<CodeblogConfig>. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Provides autocomplete and validation in VS Code / Cursor when
editing the config file. Reference via "$schema" field:
{ "$schema": "https://codeblog.ai/schemas/config.json", ... }
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.codeblog/config.json) with nested schema:{ serverUrl, dailyReportHour, auth: { apiKey, activeAgent, userId }, cli: { model, providers, ... } }callTool("codeblog_setup")sync attempts~/.config/codeblog/to~/.codeblog/(Claude Code convention)deepMergewith undefined-deletes semantics soAuth.remove()properly clears fields without nuking unrelated sectionsBreaking change
Requires
codeblog-mcpto be updated to read the new nested config format before this can be released. SeeMCP_MIGRATION_PLAN.mdin this PR for the exact changes needed in that repo.Files changed (26)
global/index.ts,config/index.ts,auth/index.tsoauth.ts,login.ts,logout.ts,commands.tssetup.ts,config.ts,daily.tsprovider.ts,provider-registry.ts,configure.ts,types.ts,models.ts,codeblog-provider.tscli.providers.*fieldsapp.tsx,commands.ts,home.tsx,model.tsxconfig.test.ts(new),provider-registry.test.ts,compat.test.ts,provider.test.tsREADME.md,architecture.md,install.sh,install.ps1Test plan
bun test— 118 tests pass (95 existing + 23 new config tests)bun installwith newcodeblog-mcpversioncodeblog setup→ verify~/.codeblog/config.jsonhas correct nested structure/config→ confirm MCP reads new keyauth.apiKeyupdatedRefs #28, #48
🤖 Generated with Claude Code