refactor: 集中管理 ~/.nimo 路径,统一通过 NIMO_HOME 环境变量覆盖#31
Merged
Conversation
将所有硬编码的 Path.home() / ".nimo" 统一指向 agentpal/paths.py 的 get_nimo_home(),支持 NIMO_HOME 环境变量覆盖默认路径。 - config.py: workspace_dir/skills_dir 默认值改用 get_workspace_dir()/get_skills_dir() - config_file.py: 使用 get_nimo_dir (get_nimo_home 的别名) - providers/manager.py: 使用 get_nimo_dir 代替硬编码路径 - workspace/context_builder.py: system prompt 中动态获取 workspace 路径 - workspace/manager.py: DEFAULT_DIR 改用 get_workspace_dir() - cli/process.py: PidManager 使用 get_run_dir() - cli/utils.py: 委托给 agentpal.paths.get_workspace_dir - cli/commands/init_cmd.py: 使用 agentpal.paths.get_workspace_dir Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Path.home() / ".nimo"统一收敛到agentpal/paths.py的get_nimo_home(),全局仅保留一处默认值config.py、config_file.py、providers/manager.py、context_builder.py、manager.py、CLI 模块等全部改为通过agentpal.paths获取路径NIMO_HOME环境变量覆盖默认的~/.nimo基础目录改动文件
paths.pyget_nimo_dir别名(向后兼容get_nimo_home)config.pyworkspace_dir/skills_dir默认值改用 paths 函数config_file.pyConfigFileManager使用get_nimo_dir()providers/manager.pyProviderManager使用get_nimo_dir()workspace/context_builder.pyworkspace/manager.pyDEFAULT_DIR改用get_workspace_dir()cli/process.pyPidManager使用get_run_dir()cli/utils.pyagentpal.paths.get_workspace_dircli/commands/init_cmd.pyagentpal.paths.get_workspace_dirTest plan
~/.nimo)NIMO_HOME=/tmp/test-nimo验证所有路径正确指向新目录pytest tests/unit/ tests/integration/确认无回归🤖 Generated with Claude Code