MCPcopy Create free account
hub / github.com/Louisym/MiniCC / discover

Method discover

tutorials/09_config_system.py:99–120  ·  view source on GitHub ↗

发现所有可能的配置文件路径。 注意:返回的是所有"可能"的路径,不管文件是否存在。 实际加载时会跳过不存在的文件。 对应源码: config.rs:185-212

(self)

Source from the content-addressed store, hash-verified

97 return cls(cwd, config_home)
98
99 def discover(self) -> list[ConfigEntry]:
100 """
101 发现所有可能的配置文件路径。
102
103 注意:返回的是所有"可能"的路径,不管文件是否存在。
104 实际加载时会跳过不存在的文件。
105
106 对应源码: config.rs:185-212
107 """
108 # ~/.claude.json(旧版路径,向后兼容)
109 user_legacy = os.path.join(os.path.dirname(self.config_home), ".claude.json")
110
111 return [
112 # 用户全局配置(两个位置)
113 ConfigEntry(ConfigSource.USER, user_legacy),
114 ConfigEntry(ConfigSource.USER, os.path.join(self.config_home, "settings.json")),
115 # 项目配置(两个位置)
116 ConfigEntry(ConfigSource.PROJECT, os.path.join(self.cwd, ".claude.json")),
117 ConfigEntry(ConfigSource.PROJECT, os.path.join(self.cwd, ".claude", "settings.json")),
118 # 本地配置(一个位置)
119 ConfigEntry(ConfigSource.LOCAL, os.path.join(self.cwd, ".claude", "settings.local.json")),
120 ]
121
122 def load(self) -> "RuntimeConfig":
123 """

Callers 2

loadMethod · 0.95
mainFunction · 0.95

Calls 1

ConfigEntryClass · 0.70

Tested by

no test coverage detected