@coderook/cli 0.46.5 → 0.46.6
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/.claude-plugin/plugin.json +19 -19
- package/dist/cbx/src/core/download.js +73 -6
- package/dist/cli/src/cli.js +35 -2
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "coderook",
|
|
3
|
-
"displayName": "CodeRook",
|
|
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.46.
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "ACCA Gaming Productions",
|
|
8
|
-
"url": "https://coderook.com"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://coderook.com/docs#assistants",
|
|
11
|
-
"license": "Apache-2.0",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"coderook",
|
|
14
|
-
"versioning",
|
|
15
|
-
"snapshots",
|
|
16
|
-
"backup",
|
|
17
|
-
"git"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "coderook",
|
|
3
|
+
"displayName": "CodeRook",
|
|
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.46.6",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "ACCA Gaming Productions",
|
|
8
|
+
"url": "https://coderook.com"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://coderook.com/docs#assistants",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"coderook",
|
|
14
|
+
"versioning",
|
|
15
|
+
"snapshots",
|
|
16
|
+
"backup",
|
|
17
|
+
"git"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -285,7 +285,10 @@ class Downloader {
|
|
|
285
285
|
async bytes(route, what, halt) {
|
|
286
286
|
return this.repeat(async () => {
|
|
287
287
|
const reply = await this.attempt(route, REQUEST_DEADLINE_MS, halt);
|
|
288
|
-
|
|
288
|
+
const raw = Buffer.from(await reply.arrayBuffer());
|
|
289
|
+
/* Sent as stored (see attempt): unpacked here instead of in the service. */
|
|
290
|
+
const body = reply.headers.get("x-coderook-encoding") === "gzip" ? (0, node_zlib_1.gunzipSync)(raw) : raw;
|
|
291
|
+
return { body, headers: reply.headers };
|
|
289
292
|
}, { what, halt });
|
|
290
293
|
}
|
|
291
294
|
async attempt(route,
|
|
@@ -310,6 +313,11 @@ class Downloader {
|
|
|
310
313
|
authorization: `Bearer ${token}`,
|
|
311
314
|
"user-agent": "CodeRook/0.1",
|
|
312
315
|
...(0, identify_js_1.clientHeaders)(),
|
|
316
|
+
/*
|
|
317
|
+
An object kept compressed may be sent exactly as stored, and is
|
|
318
|
+
unpacked here. A service that predates this ignores the header.
|
|
319
|
+
*/
|
|
320
|
+
...(route.includes("/objects/") ? { "x-coderook-accept-stored": "gzip" } : {}),
|
|
313
321
|
...extra,
|
|
314
322
|
},
|
|
315
323
|
/*
|
|
@@ -689,11 +697,31 @@ class Downloader {
|
|
|
689
697
|
through a large file costs the piece that was arriving and no more: the
|
|
690
698
|
ones already written stay written, and the file carries on from there.
|
|
691
699
|
*/
|
|
700
|
+
/*
|
|
701
|
+
A few pieces are asked for ahead of the one being written, and written
|
|
702
|
+
strictly in order. One at a time, a single large file ran at one
|
|
703
|
+
request's speed whatever the line could carry: the last 360 MB file of
|
|
704
|
+
a 1.25 GB restore came down at 2.6 MB/s (2026-11-11).
|
|
705
|
+
*/
|
|
706
|
+
const AHEAD = 4;
|
|
692
707
|
const source = (async function* () {
|
|
708
|
+
const asked = [];
|
|
709
|
+
const ask = (at) => {
|
|
710
|
+
const piece = pieces[at];
|
|
711
|
+
const reply = fetchPiece(`/v1/repositories/${repositoryId}/objects/${piece.objectId}`, `${file.path} (piece ${at + 1} of ${pieces.length})`);
|
|
712
|
+
/* Awaited in turn below; this only stops an early stop leaving it unhandled. */
|
|
713
|
+
reply.catch(() => undefined);
|
|
714
|
+
asked[at] = reply;
|
|
715
|
+
};
|
|
693
716
|
for (let at = 0; at < pieces.length; at += 1) {
|
|
694
717
|
check();
|
|
718
|
+
for (let ahead = at; ahead < Math.min(pieces.length, at + AHEAD); ahead += 1) {
|
|
719
|
+
if (!asked[ahead])
|
|
720
|
+
ask(ahead);
|
|
721
|
+
}
|
|
695
722
|
const piece = pieces[at];
|
|
696
|
-
const reply = await
|
|
723
|
+
const reply = await asked[at];
|
|
724
|
+
delete asked[at];
|
|
697
725
|
let body = reply.body;
|
|
698
726
|
/*
|
|
699
727
|
Checked against what the upload recorded for this piece, before
|
|
@@ -781,7 +809,8 @@ class Downloader {
|
|
|
781
809
|
});
|
|
782
810
|
}
|
|
783
811
|
else {
|
|
784
|
-
|
|
812
|
+
const source = node_stream_1.Readable.fromWeb(reply.body);
|
|
813
|
+
const hashing = new node_stream_1.Transform({
|
|
785
814
|
transform(block, _encoding, done) {
|
|
786
815
|
try {
|
|
787
816
|
check();
|
|
@@ -794,7 +823,14 @@ class Downloader {
|
|
|
794
823
|
hash.update(buffer);
|
|
795
824
|
done(null, buffer);
|
|
796
825
|
},
|
|
797
|
-
})
|
|
826
|
+
});
|
|
827
|
+
/* Sent as stored (see attempt): unpacked on the way to the disk. */
|
|
828
|
+
if (reply.headers.get("x-coderook-encoding") === "gzip") {
|
|
829
|
+
await (0, promises_2.pipeline)(source, (0, node_zlib_1.createGunzip)(), hashing, sink);
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
await (0, promises_2.pipeline)(source, hashing, sink);
|
|
833
|
+
}
|
|
798
834
|
}
|
|
799
835
|
return hash.digest("hex");
|
|
800
836
|
}, {
|
|
@@ -850,6 +886,27 @@ class Downloader {
|
|
|
850
886
|
try {
|
|
851
887
|
let written = 0;
|
|
852
888
|
let bytes = 0;
|
|
889
|
+
/*
|
|
890
|
+
Not fetched at all: a file the incoming version did not change, still
|
|
891
|
+
here. Reconciling never writes one of these (see the placing loop
|
|
892
|
+
below), so downloading it only to throw it away made every catch-up
|
|
893
|
+
cost a full restore — a folder already on the newest version fetched
|
|
894
|
+
the whole project again (2026-11-11 soak: eight current folders of
|
|
895
|
+
14,125 files each spent twenty minutes re-downloading 306 MB apiece).
|
|
896
|
+
*/
|
|
897
|
+
const kept = new Set();
|
|
898
|
+
if (mode === "reconcile" && held) {
|
|
899
|
+
for (const file of files) {
|
|
900
|
+
if (!file.sha256 || held[file.path] !== file.sha256)
|
|
901
|
+
continue;
|
|
902
|
+
if (!(await exists((0, safe_path_js_1.inside)(destination, file.path))))
|
|
903
|
+
continue;
|
|
904
|
+
kept.add(file.path);
|
|
905
|
+
manifest[file.path] = file.sha256;
|
|
906
|
+
written += 1;
|
|
907
|
+
bytes += file.sourceSize;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
853
910
|
const packed = new Map();
|
|
854
911
|
for (const file of files) {
|
|
855
912
|
/* Sealed members never come out of the pack — see `sealed` above. */
|
|
@@ -883,9 +940,12 @@ class Downloader {
|
|
|
883
940
|
if (restoredPacks.has(id))
|
|
884
941
|
continue;
|
|
885
942
|
restoredPacks.add(id);
|
|
943
|
+
/* A pack is fetched only when something in it is needed. */
|
|
944
|
+
if ((packed.get(id) ?? []).every((member) => kept.has(member.path)))
|
|
945
|
+
continue;
|
|
886
946
|
jobs.push({ kind: "pack", id });
|
|
887
947
|
}
|
|
888
|
-
else {
|
|
948
|
+
else if (!kept.has(file.path)) {
|
|
889
949
|
jobs.push({ kind: "file", file });
|
|
890
950
|
}
|
|
891
951
|
}
|
|
@@ -935,6 +995,9 @@ class Downloader {
|
|
|
935
995
|
}
|
|
936
996
|
for (const member of packed.get(packId) ?? []) {
|
|
937
997
|
this.check();
|
|
998
|
+
/* Already here and unchanged: counted and recorded when the work was planned. */
|
|
999
|
+
if (kept.has(member.path))
|
|
1000
|
+
continue;
|
|
938
1001
|
const offset = member.pack.offset;
|
|
939
1002
|
const length = member.pack.length;
|
|
940
1003
|
if (offset < 0 || length < 0 || offset + length > body.byteLength) {
|
|
@@ -1079,6 +1142,9 @@ class Downloader {
|
|
|
1079
1142
|
let placed = 0;
|
|
1080
1143
|
for (const file of files) {
|
|
1081
1144
|
const target = (0, safe_path_js_1.inside)(destination, file.path);
|
|
1145
|
+
/* Never fetched, because the folder already holds it unchanged. */
|
|
1146
|
+
if (kept.has(file.path))
|
|
1147
|
+
continue;
|
|
1082
1148
|
/*
|
|
1083
1149
|
Reconciling leaves alone whatever the incoming version did not
|
|
1084
1150
|
change. Writing it anyway would replace an edit in progress with a
|
|
@@ -1134,7 +1200,8 @@ class Downloader {
|
|
|
1134
1200
|
path: "Done",
|
|
1135
1201
|
percent: 100,
|
|
1136
1202
|
});
|
|
1137
|
-
|
|
1203
|
+
/* How many were already here and left alone, so a caller can say nothing was fetched. */
|
|
1204
|
+
return { files: written, bytes, manifest, unchanged: kept.size };
|
|
1138
1205
|
}
|
|
1139
1206
|
catch (error) {
|
|
1140
1207
|
await (0, promises_1.rm)(staging, { recursive: true, force: true });
|
package/dist/cli/src/cli.js
CHANGED
|
@@ -1742,7 +1742,25 @@ async function commandGet(parsed) {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
if (link.local && !replacing) {
|
|
1744
1744
|
const rules = await (0, worktree_js_1.readRules)(folder);
|
|
1745
|
-
|
|
1745
|
+
/*
|
|
1746
|
+
The digests status and submit keep, so a file whose size and time are
|
|
1747
|
+
unchanged is not opened again. Without them every catch-up read and
|
|
1748
|
+
hashed the whole folder first: 14,125 files took 100–140 s on Windows
|
|
1749
|
+
before the first request, for a folder one version behind (2026-11-11).
|
|
1750
|
+
*/
|
|
1751
|
+
const knownDigests = link.repositoryId
|
|
1752
|
+
? await (0, config_js_1.readDigests)(link.repositoryId, folder)
|
|
1753
|
+
: new Map();
|
|
1754
|
+
let learned = 0;
|
|
1755
|
+
const remember = knownDigests.set.bind(knownDigests);
|
|
1756
|
+
knownDigests.set = (key, value) => {
|
|
1757
|
+
learned += 1;
|
|
1758
|
+
return remember(key, value);
|
|
1759
|
+
};
|
|
1760
|
+
const edited = await (0, worktree_js_1.changedFiles)(folder, rules, new Map(Object.entries(link.local)), "add-and-update", knownDigests);
|
|
1761
|
+
if (link.repositoryId && learned) {
|
|
1762
|
+
await (0, config_js_1.writeDigests)(link.repositoryId, knownDigests, folder);
|
|
1763
|
+
}
|
|
1746
1764
|
if (edited.length) {
|
|
1747
1765
|
const downloader = new download_js_1.Downloader(config_js_1.credentials);
|
|
1748
1766
|
const latest = (await downloader.versions(link.repositoryId))[0];
|
|
@@ -2012,7 +2030,22 @@ trackName) {
|
|
|
2012
2030
|
});
|
|
2013
2031
|
// The record is written; the run has not reported success yet.
|
|
2014
2032
|
(0, faults_js_1.maybeFail)("get:after-record");
|
|
2015
|
-
|
|
2033
|
+
/*
|
|
2034
|
+
Nothing fetched reads as nothing fetched. It used to print the whole
|
|
2035
|
+
project's size "into" the folder, which looked like a 1.25 GB download
|
|
2036
|
+
when not a byte had moved.
|
|
2037
|
+
*/
|
|
2038
|
+
const unchanged = result.unchanged ?? 0;
|
|
2039
|
+
if (unchanged > 0 && unchanged >= result.files) {
|
|
2040
|
+
console.log(`Already up to date · ${accent(`v${latest.sequence}`)} · ${fileCount(result.files)}`);
|
|
2041
|
+
}
|
|
2042
|
+
else if (unchanged > 0) {
|
|
2043
|
+
const fetched = result.files - unchanged;
|
|
2044
|
+
console.log(`${accent(`v${latest.sequence}`)} · ${fileCount(fetched)} updated, ${unchanged.toLocaleString("en-US")} already here · ${destination}`);
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
console.log(`${accent(`v${latest.sequence}`)} · ${fileCount(result.files)} · ${bytes(result.bytes)} into ${destination}`);
|
|
2048
|
+
}
|
|
2016
2049
|
return 0;
|
|
2017
2050
|
}
|
|
2018
2051
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderook/cli",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.6",
|
|
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",
|