@levelcode/sdk 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -38652,11 +38652,29 @@ var userFromJson = (json) => {
38652
38652
  return null;
38653
38653
  }
38654
38654
  };
38655
+ var getLegacyConfigDir = (clientEnv = env) => {
38656
+ const envSuffix = clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT && clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT !== "prod" ? `-${clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT}` : "";
38657
+ return import_node_path.default.join(import_os.default.homedir(), ".config", `manicode${envSuffix}`);
38658
+ };
38655
38659
  var getConfigDir = (clientEnv = env) => {
38656
38660
  const envSuffix = clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT && clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT !== "prod" ? `-${clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT}` : "";
38657
38661
  return import_node_path.default.join(import_os.default.homedir(), ".config", `levelcode${envSuffix}`);
38658
38662
  };
38663
+ var migrateFromLegacyConfigDir = (clientEnv = env) => {
38664
+ const newDir = getConfigDir(clientEnv);
38665
+ const newCredsPath = import_node_path.default.join(newDir, "credentials.json");
38666
+ if (import_fs.default.existsSync(newCredsPath))
38667
+ return;
38668
+ const legacyCredsPath = import_node_path.default.join(getLegacyConfigDir(clientEnv), "credentials.json");
38669
+ if (!import_fs.default.existsSync(legacyCredsPath))
38670
+ return;
38671
+ try {
38672
+ ensureDirectoryExistsSync(newDir);
38673
+ import_fs.default.copyFileSync(legacyCredsPath, newCredsPath);
38674
+ } catch {}
38675
+ };
38659
38676
  var getCredentialsPath = (clientEnv = env) => {
38677
+ migrateFromLegacyConfigDir(clientEnv);
38660
38678
  return import_node_path.default.join(getConfigDir(clientEnv), "credentials.json");
38661
38679
  };
38662
38680
  var getUserCredentials = (clientEnv = env) => {
@@ -42476,5 +42494,5 @@ function loadMCPConfigSync(options) {
42476
42494
  return mergedConfig;
42477
42495
  }
42478
42496
 
42479
- //# debugId=099CD01FFE2E727364756E2164756E21
42497
+ //# debugId=16B068004CDA38AF64756E2164756E21
42480
42498
  //# sourceMappingURL=index.cjs.map