fix(wizard): move semantic_search config out of ~/.claude/settings.json#137
fix(wizard): move semantic_search config out of ~/.claude/settings.json#137tkavelli wants to merge 1 commit intoparcadei:mainfrom
Conversation
WHAT CHANGED:
1. opc/scripts/setup/wizard.py:
- Semantic search config now writes to ~/.config/tldr/config.json
instead of ~/.claude/settings.json
- Added cleanup: removes stale "semantic_search" key from
~/.claude/settings.json if present from previous installations
- WHY: Claude Code does not recognise the "semantic_search" key
and reports the settings file as invalid ("Found N invalid
settings files"). The tldr daemon reads per-project config
from <project>/.tldr/config.json at runtime anyway.
CONTEXT:
The wizard was injecting a non-standard key into Claude Code's
global settings file. Claude Code validates its settings schema
and flags unknown keys, causing a warning on every startup.
The daemon's default config already matches the wizard's defaults
(bge-large-en-v1.5, threshold=20), so the global write was mostly
redundant — but the GPU-detection logic (choosing all-MiniLM-L6-v2
for CPU-only systems) is preserved in the new location.
|
PR author is not in the allowed authors list. |
📝 WalkthroughWalkthroughThe configuration handling for semantic search is migrated from a global Claude settings file ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
opc/scripts/setup/wizard.py (1)
1076-1078:⚠️ Potential issue | 🟡 MinorStale reference to old config location.
Line 1078 still tells the user to enable semantic search in
.claude/settings.json, but it should now point to~/.config/tldr/config.json.🐛 Proposed fix
- console.print(" [dim]Enable later in .claude/settings.json[/dim]") + console.print(" [dim]Enable later in ~/.config/tldr/config.json[/dim]")
🧹 Nitpick comments (1)
opc/scripts/setup/wizard.py (1)
1032-1033: Wrap the config write intry/exceptfor consistency with surrounding I/O.The read (line 1021) and the cleanup write (line 1042) are both guarded by
try/except, but this write is not. A permission error here would propagate up to the outerexcept Exceptionat line 1088, aborting the entire TLDR step with a generic message instead of gracefully continuing.♻️ Proposed fix
- tldr_config_dir.mkdir(parents=True, exist_ok=True) - tldr_config_path.write_text(json.dumps(tldr_config, indent=2)) + try: + tldr_config_dir.mkdir(parents=True, exist_ok=True) + tldr_config_path.write_text(json.dumps(tldr_config, indent=2)) + except Exception: + console.print(" [yellow]WARN[/yellow] Could not write TLDR config to ~/.config/tldr/config.json")
Summary
~/.config/tldr/config.jsoninstead of~/.claude/settings.jsonsemantic_searchkey from~/.claude/settings.jsonleft by previous installationsProblem
The setup wizard injects a
semantic_searchkey into~/.claude/settings.json(Claude Code's global settings). Claude Code does not recognise this key and reportsFound N invalid settings fileson every startup.Additionally, the
tldrdaemon reads this config from the project-level.claude/settings.json(or.tldr/config.json), not from the global one — so the global write never actually reached the daemon.Fix
Write to
~/.config/tldr/config.json(a dedicated TLDR config location) and clean up the stale key from~/.claude/settings.jsonon next wizard run.Test plan
python -m scripts.setup.wizard— semantic search step writes to~/.config/tldr/config.json~/.claude/settings.jsondoes not containsemantic_searchkeytldr semantic search "test" .— daemon still works (uses its own defaults)Summary by CodeRabbit
Bug Fixes
Refactor