osborn 0.9.19 → 0.9.21
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 +16 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -397,9 +397,18 @@ function startApiServer(workingDir, port) {
|
|
|
397
397
|
const destSlug = join(projectsDir, effectiveSlug);
|
|
398
398
|
mkdirSync(destSlug, { recursive: true });
|
|
399
399
|
const sourceSlugPath = join(effectiveSource, sourceSlug);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
// NO content mutation. Earlier versions rewrote the embedded `"cwd":"..."`
|
|
401
|
+
// field inside JSONL entries to match the destination workspace. That was
|
|
402
|
+
// wrong on two counts:
|
|
403
|
+
// 1. The cwd field is documentary metadata, not how Claude Code resolves
|
|
404
|
+
// a session at resume time — resume uses the slug directory name.
|
|
405
|
+
// 2. Mutating contents breaks roundtripability (laptop → cloud → laptop
|
|
406
|
+
// ends up with /workspace cwd on laptop), corrupting historical data
|
|
407
|
+
// across environment hops.
|
|
408
|
+
// What's actually needed is just the slug rename (handled by `effectiveSlug`
|
|
409
|
+
// below). File contents stay byte-exact across every transfer direction.
|
|
410
|
+
void sourceSlugPath;
|
|
411
|
+
void targetWorkDir;
|
|
403
412
|
// Walk the source slug directory and copy files individually so we can:
|
|
404
413
|
// (a) skip AppleDouble per-file too (in case nested)
|
|
405
414
|
// (b) rewrite cwd inside .jsonl files when remapping across workspaces
|
|
@@ -431,18 +440,10 @@ function startApiServer(workingDir, port) {
|
|
|
431
440
|
catch { /* dst doesn't exist — write it */ }
|
|
432
441
|
if (!shouldWrite)
|
|
433
442
|
continue;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const find = `"cwd":"${sourceCwd}"`;
|
|
439
|
-
const replace = `"cwd":"${destCwd}"`;
|
|
440
|
-
const rewritten = content.split(find).join(replace);
|
|
441
|
-
writeFileSync(dp, rewritten);
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
cpSync(sp, dp, { force: true });
|
|
445
|
-
}
|
|
443
|
+
// Copy byte-exact — no content mutation. The slug rename above is
|
|
444
|
+
// the only structural change; file contents are immutable historical
|
|
445
|
+
// record and must roundtrip cleanly between environments.
|
|
446
|
+
cpSync(sp, dp, { force: true });
|
|
446
447
|
filesWritten++;
|
|
447
448
|
}
|
|
448
449
|
// skip symlinks, sockets, etc.
|