@coderook/cli 0.42.5 → 0.42.7

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.
@@ -2,7 +2,7 @@
2
2
  "name": "coderook",
3
3
  "displayName": "CodeRook",
4
4
  "description": "Save, browse and restore whole-snapshot versions of a project on CodeRook, with cbx or plain git, from Claude Code.",
5
- "version": "0.42.5",
5
+ "version": "0.42.7",
6
6
  "author": {
7
7
  "name": "ACCA Gaming Productions",
8
8
  "url": "https://coderook.com"
@@ -1938,9 +1938,63 @@ class Uploader {
1938
1938
  return priorByDigest.get(declaration.sha256) ?? null;
1939
1939
  };
1940
1940
  const keptAsItWas = (declaration) => storedAs(declaration) !== null;
1941
- const declarations = hashed.declarations.filter((one) => !keptAsItWas(one));
1941
+ /*
1942
+ A copy left stale by somebody else's save is not an edit.
1943
+
1944
+ Both callers select everything, so a file nobody touched here is still
1945
+ "selected". When the version this save starts from holds a newer copy,
1946
+ merged in from somebody else, the untouched old bytes on this disk
1947
+ differ from it, and they were sent as though they were a change: the
1948
+ second unrelated save after a colleague's edit put their file back to
1949
+ what it was (state-matrix R1, reproduced 2026-11-06: v4 reverted v2).
1950
+
1951
+ What the file IS decides it, not where it sits: bytes identical to what
1952
+ this folder last received (request.known) are not this person's work.
1953
+ The version's own copy is kept, and the folder's record still says it
1954
+ received the old bytes, so the file shows as behind until fetched. A
1955
+ file the version no longer holds at all was removed by somebody else,
1956
+ and an untouched copy here does not bring it back.
1957
+ */
1958
+ const received = request.known ?? null;
1959
+ const staleHere = new Set();
1960
+ if (received && prior.size) {
1961
+ for (const one of hashed.declarations) {
1962
+ if (received[one.path] !== one.sha256)
1963
+ continue;
1964
+ const now = prior.get(one.path);
1965
+ if (now && now.sha256 === one.sha256)
1966
+ continue;
1967
+ staleHere.add(one.path);
1968
+ }
1969
+ }
1970
+ const declarations = hashed.declarations.filter((one) => !staleHere.has(one.path) && !keptAsItWas(one));
1942
1971
  let totalBytes = hashed.totalBytes;
1943
1972
  for (const one of hashed.declarations) {
1973
+ if (!staleHere.has(one.path))
1974
+ continue;
1975
+ totalBytes -= one.size;
1976
+ const now = prior.get(one.path);
1977
+ if (!now) {
1978
+ ticked.delete(one.path);
1979
+ continue;
1980
+ }
1981
+ reused.push({
1982
+ path: one.path,
1983
+ sourceSize: now.sourceSize,
1984
+ storedSize: now.storedSize,
1985
+ mediaType: now.mediaType,
1986
+ added: 0,
1987
+ removed: 0,
1988
+ included: true,
1989
+ deleted: false,
1990
+ binary: false,
1991
+ lines: 0,
1992
+ });
1993
+ }
1994
+ (0, profile_js_1.counted)("stale copies kept as the version has them", staleHere.size);
1995
+ for (const one of hashed.declarations) {
1996
+ if (staleHere.has(one.path))
1997
+ continue;
1944
1998
  const held = storedAs(one);
1945
1999
  if (!held)
1946
2000
  continue;
@@ -1541,12 +1541,26 @@ async function commandGet(parsed) {
1541
1541
  would bury the only copy.
1542
1542
  */
1543
1543
  if (resuming) {
1544
+ /*
1545
+ Only a file this fetch rewrites can be buried by finishing it: one
1546
+ whose incoming copy differs from what was placed here. An edit to a
1547
+ file the version left alone is kept, exactly as an ordinary fetch
1548
+ keeps it, so it is no reason to stop. It used to be: completing in
1549
+ "replace" mode rewrote every file, so any edit at all, anywhere,
1550
+ refused the resume (2026-11-06, two page edits blocked a catch-up).
1551
+ */
1544
1552
  const notYetArrived = await (0, worktree_js_1.changedFiles)(folder, rules, incoming);
1545
1553
  const changedInTheGap = notYetArrived.filter((file) => !file.deleted &&
1546
1554
  incoming.has(file.path) &&
1555
+ incoming.get(file.path) !== link.local[file.path] &&
1547
1556
  edited.some((one) => one.path === file.path));
1548
1557
  if (!changedInTheGap.length) {
1549
- return fetchInto(link.repositoryId, folder, link.slug, link.local ?? null, "replace", await (0, track_commands_js_1.trackFor)(folder));
1558
+ /*
1559
+ Reconciling finishes the job: every file the version changed is
1560
+ placed (the half the interrupted run already placed are placed
1561
+ again, harmlessly), and what it left alone stays as it is.
1562
+ */
1563
+ return fetchInto(link.repositoryId, folder, link.slug, link.local ?? null, "reconcile", await (0, track_commands_js_1.trackFor)(folder));
1550
1564
  }
1551
1565
  console.error(red(`${changedInTheGap.length} file${changedInTheGap.length === 1 ? "" : "s"} ` +
1552
1566
  `changed while the interrupted fetch was stopped:`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderook/cli",
3
- "version": "0.42.5",
3
+ "version": "0.42.7",
4
4
  "description": "The command line for CodeRook (coderook.com): version control and project hosting for projects of any size. Every save is a compressed snapshot, private or public, never used to train AI.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://coderook.com",