github-router 0.3.24 → 0.3.25
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/main.js +14 -13
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -327,7 +327,7 @@ async function ensureSharedSymlink(name$1, sourceDir, mirrorDir) {
|
|
|
327
327
|
try {
|
|
328
328
|
await fs.mkdir(sourcePath, { recursive: true });
|
|
329
329
|
} catch (err) {
|
|
330
|
-
consola.
|
|
330
|
+
consola.warn(`ensureSharedSymlink(${name$1}): cannot mkdir source ${sourcePath}:`, err);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
let existing = null;
|
|
@@ -335,22 +335,22 @@ async function ensureSharedSymlink(name$1, sourceDir, mirrorDir) {
|
|
|
335
335
|
existing = await fs.lstat(mirrorPath);
|
|
336
336
|
} catch (err) {
|
|
337
337
|
if (err.code !== "ENOENT") {
|
|
338
|
-
consola.
|
|
338
|
+
consola.warn(`ensureSharedSymlink(${name$1}): cannot lstat ${mirrorPath}:`, err);
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
if (existing?.isSymbolicLink()) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
consola.debug(`ensureSharedSymlink(${name$1}): cannot readlink ${mirrorPath}:`, err);
|
|
343
|
+
const sourceReal = await fs.realpath(sourcePath).catch(() => null);
|
|
344
|
+
if (sourceReal === null) {
|
|
345
|
+
consola.warn(`ensureSharedSymlink(${name$1}): cannot resolve source ${sourcePath} — skipping junction creation to avoid silent every-startup churn. Inspect the source dir's permissions / OneDrive sync state and re-launch.`);
|
|
346
|
+
return;
|
|
348
347
|
}
|
|
349
|
-
|
|
348
|
+
const currentReal = await fs.realpath(mirrorPath).catch(() => null);
|
|
349
|
+
if (currentReal !== null && currentReal === sourceReal) return;
|
|
350
350
|
} else if (existing?.isDirectory()) try {
|
|
351
351
|
await fs.rmdir(mirrorPath);
|
|
352
352
|
} catch (err) {
|
|
353
|
-
consola.warn(`ensureClaudeConfigMirror: ${mirrorPath} is a non-empty real directory from an older github-router version; refusing to clobber. If you want chat-history continuity for "${name$1}", move its contents into ${sourcePath}/ then delete ${mirrorPath}; the mirror will create a symlink on next launch. (rmdir error: ${err.code ?? "unknown"})`);
|
|
353
|
+
consola.warn(`ensureClaudeConfigMirror: ${mirrorPath} is a non-empty real directory from an older github-router version; refusing to clobber. If you want chat-history continuity for "${name$1}", move its contents into ${sourcePath}/ then delete ${mirrorPath}; the mirror will create a symlink (junction on Windows) on next launch. (rmdir error: ${err.code ?? "unknown"})`);
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
356
|
else if (existing) {
|
|
@@ -359,15 +359,16 @@ async function ensureSharedSymlink(name$1, sourceDir, mirrorDir) {
|
|
|
359
359
|
}
|
|
360
360
|
const tempPath = `${mirrorPath}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
361
361
|
try {
|
|
362
|
-
await fs.symlink(sourcePath, tempPath);
|
|
362
|
+
await fs.symlink(sourcePath, tempPath, process.platform === "win32" ? "junction" : "dir");
|
|
363
363
|
} catch (err) {
|
|
364
|
-
consola.
|
|
364
|
+
consola.warn(`ensureSharedSymlink(${name$1}): symlink ${tempPath} failed:`, err);
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
+
if (process.platform === "win32" && existing?.isSymbolicLink()) await fs.unlink(mirrorPath).catch(() => {});
|
|
367
368
|
try {
|
|
368
369
|
await fs.rename(tempPath, mirrorPath);
|
|
369
370
|
} catch (err) {
|
|
370
|
-
consola.
|
|
371
|
+
consola.warn(`ensureSharedSymlink(${name$1}): rename ${tempPath} → ${mirrorPath} failed:`, err);
|
|
371
372
|
await fs.unlink(tempPath).catch(() => {});
|
|
372
373
|
}
|
|
373
374
|
}
|
|
@@ -2654,7 +2655,7 @@ function initProxyFromEnv() {
|
|
|
2654
2655
|
//#endregion
|
|
2655
2656
|
//#region package.json
|
|
2656
2657
|
var name = "github-router";
|
|
2657
|
-
var version = "0.3.
|
|
2658
|
+
var version = "0.3.25";
|
|
2658
2659
|
|
|
2659
2660
|
//#endregion
|
|
2660
2661
|
//#region src/lib/approval.ts
|