codexuse-cli 5.6.0 → 5.6.1

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.js CHANGED
@@ -43855,7 +43855,7 @@ var ProfileManager = class {
43855
43855
  let changed = false;
43856
43856
  const nextMap = {};
43857
43857
  for (const [profileName, raw] of Object.entries(source)) {
43858
- const record3 = this.fromStateRecord(profileName, raw);
43858
+ let record3 = this.fromStateRecord(profileName, raw);
43859
43859
  if (!record3) {
43860
43860
  nextMap[profileName] = raw;
43861
43861
  continue;
@@ -43878,21 +43878,45 @@ var ProfileManager = class {
43878
43878
  sourceExists = false;
43879
43879
  }
43880
43880
  if (sourceExists) {
43881
+ let targetExists = true;
43881
43882
  try {
43882
43883
  await import_fs.promises.access(targetHome);
43883
- throw new Error(
43884
- `Profile '${profileName}' cannot migrate its private auth store because the target already exists.`
43885
- );
43886
43884
  } catch (error) {
43887
43885
  if (!this.isNotFoundError(error)) {
43888
43886
  throw error;
43889
43887
  }
43888
+ targetExists = false;
43890
43889
  }
43891
- const releaseGuard = await this.acquireProfileHomeMutationGuard(record3);
43892
- try {
43893
- await import_fs.promises.rename(sourceHome, targetHome);
43894
- } finally {
43895
- await releaseGuard();
43890
+ if (targetExists) {
43891
+ const sourceHydration = await this.hydrateProfileRecordWithStatus(record3);
43892
+ let targetAuth = null;
43893
+ try {
43894
+ const targetRaw = await this.withProfileAuthFileLock(
43895
+ (0, import_path2.join)(targetHome, "auth.json"),
43896
+ async (currentRaw) => currentRaw
43897
+ );
43898
+ targetAuth = targetRaw ? JSON.parse(targetRaw) : null;
43899
+ } catch (error) {
43900
+ logWarn(
43901
+ `Deferred private auth migration for '${profileName}' because the existing target could not be verified:`,
43902
+ error
43903
+ );
43904
+ }
43905
+ if (!sourceHydration.cacheable || !targetAuth || !this.activeAuthMatchesRecord(targetAuth, sourceHydration.record)) {
43906
+ logWarn(
43907
+ `Deferred private auth migration for '${profileName}' because the existing target belongs to unverified credentials.`
43908
+ );
43909
+ nextMap[profileName] = raw;
43910
+ continue;
43911
+ }
43912
+ record3 = sourceHydration.record;
43913
+ } else {
43914
+ const releaseGuard = await this.acquireProfileHomeMutationGuard(record3);
43915
+ try {
43916
+ await import_fs.promises.rename(sourceHome, targetHome);
43917
+ } finally {
43918
+ await releaseGuard();
43919
+ }
43896
43920
  }
43897
43921
  }
43898
43922
  }
@@ -51673,7 +51697,7 @@ async function ensureCliStorageReady() {
51673
51697
  }
51674
51698
 
51675
51699
  // src/app/main.ts
51676
- var VERSION = true ? "5.6.0" : "0.0.0";
51700
+ var VERSION = true ? "5.6.1" : "0.0.0";
51677
51701
  async function runCli() {
51678
51702
  const args2 = process.argv.slice(2);
51679
51703
  if (args2.length === 0) {