@@ -46,7 +46,6 @@ struct GlobalConfig {
4646 // From config.toml [xlings]
4747 std::string xlingsBinaryMode; // "bundled" | "system" | absolute path
4848 std::filesystem::path xlingsHomeOverride; // empty = use registryDir
49- std::string xlingsMirror = " CN" ; // "CN" | "GLOBAL" | empty = xlings default
5049
5150 // From config.toml [index]
5251 std::string defaultIndex; // "mcpplibs"
@@ -175,30 +174,6 @@ void write_file(const std::filesystem::path& p, std::string_view content) {
175174 os << content;
176175}
177176
178- std::string normalize_xlings_mirror (std::string mirror) {
179- for (char & ch : mirror) {
180- if (ch >= ' a' && ch <= ' z' ) ch = static_cast <char >(ch - ' a' + ' A' );
181- }
182- return mirror;
183- }
184-
185- std::optional<std::string> read_xlings_json_mirror (const std::filesystem::path& path) {
186- std::ifstream is (path);
187- if (!is) return std::nullopt ;
188- std::stringstream ss;
189- ss << is.rdbuf ();
190- auto content = ss.str ();
191- auto key = content.find (" \" mirror\" " );
192- if (key == std::string::npos) return std::nullopt ;
193- auto colon = content.find (' :' , key);
194- if (colon == std::string::npos) return std::nullopt ;
195- auto first = content.find (' "' , colon + 1 );
196- if (first == std::string::npos) return std::nullopt ;
197- auto second = content.find (' "' , first + 1 );
198- if (second == std::string::npos) return std::nullopt ;
199- return content.substr (first + 1 , second - first - 1 );
200- }
201-
202177bool write_default_config_toml (const std::filesystem::path& path) {
203178 constexpr auto tmpl = R"( # mcpp global config — auto-generated; safe to edit.
204179
@@ -207,8 +182,6 @@ bool write_default_config_toml(const std::filesystem::path& path) {
207182binary = "bundled"
208183# home: empty = use $MCPP_HOME/registry; can override
209184home = ""
210- # mirror: "CN" | "GLOBAL" | "" (defer to xlings)
211- mirror = "CN"
212185
213186[index]
214187default = "mcpplibs"
@@ -229,8 +202,7 @@ default_backend = "ninja"
229202}
230203
231204bool write_default_xlings_json (const std::filesystem::path& path,
232- const std::vector<IndexRepo>& repos,
233- std::string_view mirror)
205+ const std::vector<IndexRepo>& repos)
234206{
235207 // Delegate to xlings module. Convert IndexRepo vec to pair span.
236208 std::vector<std::pair<std::string,std::string>> pairs;
@@ -240,7 +212,7 @@ bool write_default_xlings_json(const std::filesystem::path& path,
240212 // construct a temporary Env with home = path.parent_path().
241213 mcpp::xlings::Env env;
242214 env.home = path.parent_path ();
243- mcpp::xlings::seed_xlings_json (env, pairs, mirror );
215+ mcpp::xlings::seed_xlings_json (env, pairs);
244216 return std::filesystem::exists (path);
245217}
246218
@@ -384,15 +356,6 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
384356 cfg.xlingsBinaryMode = doc->get_string (" xlings.binary" ).value_or (" bundled" );
385357 if (auto h = doc->get_string (" xlings.home" ); h && !h->empty ())
386358 cfg.xlingsHomeOverride = *h;
387- cfg.xlingsMirror = normalize_xlings_mirror (
388- doc->get_string (" xlings.mirror" ).value_or (" CN" ));
389- if (!cfg.xlingsMirror .empty () &&
390- cfg.xlingsMirror != " CN" &&
391- cfg.xlingsMirror != " GLOBAL" ) {
392- return std::unexpected (ConfigError{
393- std::format (" invalid xlings.mirror '{}': expected CN, GLOBAL, or empty" ,
394- cfg.xlingsMirror )});
395- }
396359 cfg.defaultIndex = doc->get_string (" index.default" ).value_or (" mcpplibs" );
397360 cfg.searchTtlSeconds = doc->get_int (" cache.search_ttl_seconds" ).value_or (3600 );
398361 cfg.defaultJobs = doc->get_int (" build.default_jobs" ).value_or (0 );
@@ -424,7 +387,7 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
424387 // 5. Seed registry/.xlings.json if missing
425388 auto xjson = cfg.xlingsHome () / " .xlings.json" ;
426389 if (!std::filesystem::exists (xjson)) {
427- write_default_xlings_json (xjson, cfg.indexRepos , cfg. xlingsMirror );
390+ write_default_xlings_json (xjson, cfg.indexRepos );
428391 }
429392
430393 // 6. Acquire xlings binary if needed
@@ -445,15 +408,6 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
445408 " configured xlings binary not found: {}" , cfg.xlingsBinary .string ())});
446409 }
447410
448- if (!cfg.xlingsMirror .empty () &&
449- read_xlings_json_mirror (xjson).value_or (" " ) != cfg.xlingsMirror ) {
450- auto rc = mcpp::xlings::set_mirror (make_xlings_env (cfg), cfg.xlingsMirror , true );
451- if (rc != 0 && !quiet) {
452- std::println (stderr,
453- " warning: failed to set xlings mirror to '{}'" , cfg.xlingsMirror );
454- }
455- }
456-
457411 // 7. Sandbox bootstrap (mcpp self-contained xlings environment).
458412 // Order matters:
459413 // a. Mirror xlings binary into sandbox so shim creation works.
@@ -475,8 +429,6 @@ void print_env(const GlobalConfig& cfg) {
475429 std::println (" MCPP_HOME = {}" , cfg.mcppHome .string ());
476430 std::println (" xlings binary = {}" , cfg.xlingsBinary .string ());
477431 std::println (" xlings home = {}" , cfg.xlingsHome ().string ());
478- std::println (" xlings mirror = {}" ,
479- cfg.xlingsMirror .empty () ? " (xlings default)" : cfg.xlingsMirror );
480432 std::println (" config = {}" , cfg.configFile .string ());
481433 std::println (" BMI cache = {}" , cfg.bmiCacheDir .string ());
482434 std::println (" meta cache = {}" , cfg.metaCacheDir .string ());
0 commit comments