feat: configurable Claude home directory and runtime model detection#264
feat: configurable Claude home directory and runtime model detection#264pennn778 wants to merge 8 commits intoYishenTu:mainfrom
Conversation
|
PR review findings:
|
…fix hardcoded path - Add isValidClaudeHomeDirName() validator and enforce it in setter to reject empty, '.', '..', non-dot-prefixed, and separator-containing names - Stop calling setClaudeHomeDirName() on every keystroke in settings UI; only persist to data.json so a restart is required for path changes - Replace hardcoded COMMANDS_PATH with getCommandsPath() in delete() and remove the deprecated constant - Add unit tests for validation logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review feedback addressedPushed a fix commit ( Changes
Verification
|
Replace all hardcoded `.claude` path references with a centralized `claudePaths` module that reads a configurable directory name. This allows users of custom CLI builds (e.g., `claude-internal`) that store data in `~/.claude-internal/` to configure the plugin accordingly. - Add `src/utils/claudePaths.ts` with get/set functions for the dir name - Convert static path constants in all 8 storage modules to dynamic functions - Update PluginManager, AgentManager, sdkSession, and path utils - Dynamize plan file path matching in StreamController and InlineExitPlanMode - Add settings UI (persisted to data.json to avoid bootstrap circularity) - Bootstrap dir name in main.ts before loading settings - Add i18n keys to all 10 locales - Add 15 unit tests for the new module Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded model list with runtime detection via persistentQuery.supportedModels() so claude-internal users see their actual available models (e.g. Claude-4.5-Sonnet, Opus 4.6, Opus 4.6 1M, Haiku 4.5) instead of the default haiku/sonnet/opus shortcuts. Priority: SDK models > env-var models > DEFAULT_CLAUDE_MODELS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: add entry point, key dependencies, path aliases, and single test file command - README.md: update Advanced Model Control to mention SDK runtime model detection - README_CN.md: add full Chinese translation of README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
onload() had no error handling — any failure in settings loading, storage migration, or manager initialization would prevent registerView/addRibbonIcon/addCommand from executing, causing the plugin to silently fail on Obsidian startup. - Restructure onload() into phased initialization with per-phase try-catch, ensuring critical registrations always execute - Make storage migration non-fatal (replace throw with graceful return + Notice) - Wrap runMigrations() in try-catch within initialize() - Extract conversation loading into separate method with try-catch - Add try-catch safety net to ClaudianView.onOpen() with fallback UI - Add Electron AbortSignal compatibility patch for SDK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…fix hardcoded path - Add isValidClaudeHomeDirName() validator and enforce it in setter to reject empty, '.', '..', non-dot-prefixed, and separator-containing names - Stop calling setClaudeHomeDirName() on every keystroke in settings UI; only persist to data.json so a restart is required for path changes - Replace hardcoded COMMANDS_PATH with getCommandsPath() in delete() and remove the deprecated constant - Add unit tests for validation logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
.claudepath references with a centralizedclaudePathsmodule that reads a configurable directory name. This allows users of custom CLI builds (e.g.,claude-internal) that store data in~/.claude-internal/to configure the plugin accordingly. Includes settings UI, i18n support for all 10 locales, and 15 unit tests.persistentQuery.supportedModels(), soclaude-internalusers see their actual available models. Priority: SDK models > env-var models > DEFAULT_CLAUDE_MODELS.Changes
src/utils/claudePaths.tswith get/set functions for the configurable dir nameClaudianService.getSupportedModels()to fetch models from SDKModelSelectorto prefer SDK-detected models at runtimedata.jsonto avoid bootstrap circularity)main.tsbefore loading settingsTest plan
.claudedirectory.claude-internaland verify storage paths update