@coderook/cli 0.46.9 → 0.46.11
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 +1 -1
- package/dist/cbx/src/core/download.js +2 -0
- package/dist/cbx/src/core/upload.js +7 -0
- package/dist/cli/src/api.js +71 -5
- package/dist/cli/src/cli.js +110 -10
- package/dist/cli/src/mods_command.js +44 -0
- package/dist/cli/src/pending_merges.js +62 -0
- package/dist/cli/src/project_commands.js +17 -0
- package/package.json +1 -1
|
@@ -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.46.
|
|
5
|
+
"version": "0.46.11",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ACCA Gaming Productions",
|
|
8
8
|
"url": "https://coderook.com"
|
|
@@ -981,6 +981,7 @@ class Downloader {
|
|
|
981
981
|
time and digest. A file it still matches is known without opening it.
|
|
982
982
|
*/
|
|
983
983
|
known) {
|
|
984
|
+
const reusedBefore = this.piecesReused;
|
|
984
985
|
const files = await this.files(repositoryId, versionId);
|
|
985
986
|
if (!files.length)
|
|
986
987
|
throw new Error("That version has no files");
|
|
@@ -1379,6 +1380,7 @@ class Downloader {
|
|
|
1379
1380
|
placedFiles: placedRecord,
|
|
1380
1381
|
removed: removedHere,
|
|
1381
1382
|
leftDeleted: deletedHere.size,
|
|
1383
|
+
piecesReused: this.piecesReused - reusedBefore,
|
|
1382
1384
|
};
|
|
1383
1385
|
}
|
|
1384
1386
|
catch (error) {
|
|
@@ -1219,6 +1219,8 @@ class Uploader {
|
|
|
1219
1219
|
...(request.allowSecrets ? { allowSecrets: true } : {}),
|
|
1220
1220
|
...(linesAdded === undefined ? {} : { linesAdded }),
|
|
1221
1221
|
...(linesRemoved === undefined ? {} : { linesRemoved }),
|
|
1222
|
+
/* A service before saved-from-v1 drops it: this body is not strict. */
|
|
1223
|
+
...(request.savedFrom ? { savedFrom: request.savedFrom } : {}),
|
|
1222
1224
|
/*
|
|
1223
1225
|
Names this attempt so a retry after a lost connection is answered
|
|
1224
1226
|
with the version already made, rather than making a second one.
|
|
@@ -1241,6 +1243,10 @@ class Uploader {
|
|
|
1241
1243
|
paths repeat their folders.
|
|
1242
1244
|
*/
|
|
1243
1245
|
const sendDeltaSave = async (plan) => {
|
|
1246
|
+
/* The header refuses fields it does not know, so this goes only to a service that lists it. */
|
|
1247
|
+
const savedFrom = request.savedFrom && (await this.serviceFeatures()).includes("saved-from-v1")
|
|
1248
|
+
? request.savedFrom
|
|
1249
|
+
: undefined;
|
|
1244
1250
|
const sentHere = new Set(plan.entries.map((entry) => entry.declaration.path));
|
|
1245
1251
|
const removed = [...prior.keys()].filter((held) => !named.has(held));
|
|
1246
1252
|
const executable = contents
|
|
@@ -1262,6 +1268,7 @@ class Uploader {
|
|
|
1262
1268
|
...(removed.length ? { removed } : {}),
|
|
1263
1269
|
...(executable.length ? { executable } : {}),
|
|
1264
1270
|
...(request.presence ? { presence: request.presence } : {}),
|
|
1271
|
+
...(savedFrom ? { savedFrom } : {}),
|
|
1265
1272
|
}));
|
|
1266
1273
|
const rest = new Uint8Array(4 + header.byteLength + plan.envelope.byteLength);
|
|
1267
1274
|
new DataView(rest.buffer).setUint32(0, header.byteLength, false);
|
package/dist/cli/src/api.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ServiceError = void 0;
|
|
7
|
+
exports.forgetFoundProjects = forgetFoundProjects;
|
|
4
8
|
exports.putObject = putObject;
|
|
5
9
|
exports.beginUpload = beginUpload;
|
|
6
10
|
exports.uploadPart = uploadPart;
|
|
@@ -74,7 +78,50 @@ exports.collisionCheck = collisionCheck;
|
|
|
74
78
|
/** The small part of the API the command-line tool needs directly. */
|
|
75
79
|
const network_js_1 = require("./network.js");
|
|
76
80
|
const identify_js_1 = require("../../cbx/src/core/identify.js");
|
|
81
|
+
const node_crypto_1 = require("node:crypto");
|
|
82
|
+
const promises_1 = require("node:fs/promises");
|
|
83
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
77
84
|
const config_js_1 = require("./config.js");
|
|
85
|
+
/*
|
|
86
|
+
The account's projects, remembered for a minute for finding one by name.
|
|
87
|
+
|
|
88
|
+
Every command naming a project listed them all first: one round trip, about
|
|
89
|
+
0.6 s from Australia, in every draft put an agent made (2026-11-11 exercise
|
|
90
|
+
2: puts took ~3 s, a fifth of it this). Only findProject reads it; cbx
|
|
91
|
+
projects and the other listings stay live. Keyed to the service and the
|
|
92
|
+
sign-in, so another account or a test bench never sees it, and dropped by
|
|
93
|
+
any request that creates, changes or deletes a project.
|
|
94
|
+
*/
|
|
95
|
+
const REMEMBER_PROJECTS_MS = 60_000;
|
|
96
|
+
const rememberedFile = () => node_path_1.default.join((0, config_js_1.configDirectory)(), "projects-found.json");
|
|
97
|
+
async function rememberedKey() {
|
|
98
|
+
return (0, node_crypto_1.createHash)("sha256").update(`${(0, config_js_1.apiOrigin)()} ${(await (0, config_js_1.loadToken)()) ?? ""}`).digest("hex").slice(0, 32);
|
|
99
|
+
}
|
|
100
|
+
async function rememberedProjects() {
|
|
101
|
+
try {
|
|
102
|
+
const saved = JSON.parse(await (0, promises_1.readFile)(rememberedFile(), "utf8"));
|
|
103
|
+
if (saved.key !== (await rememberedKey()) || !Array.isArray(saved.projects))
|
|
104
|
+
return [];
|
|
105
|
+
if (typeof saved.at !== "number" || saved.at > Date.now() || Date.now() - saved.at > REMEMBER_PROJECTS_MS)
|
|
106
|
+
return [];
|
|
107
|
+
return saved.projects;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function rememberProjects(list) {
|
|
114
|
+
try {
|
|
115
|
+
await (0, promises_1.mkdir)((0, config_js_1.configDirectory)(), { recursive: true });
|
|
116
|
+
await (0, promises_1.writeFile)(rememberedFile(), JSON.stringify({ key: await rememberedKey(), at: Date.now(), projects: list }));
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
/* Only a slower next lookup. */
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function forgetFoundProjects() {
|
|
123
|
+
await (0, promises_1.rm)(rememberedFile(), { force: true }).catch(() => undefined);
|
|
124
|
+
}
|
|
78
125
|
/**
|
|
79
126
|
* How long one request may go unanswered before it is treated as lost.
|
|
80
127
|
*
|
|
@@ -115,6 +162,9 @@ async function call(route, options = {}) {
|
|
|
115
162
|
throw new Error("Not signed in. Run: cbx sign-in");
|
|
116
163
|
}
|
|
117
164
|
const method = options.method ?? "GET";
|
|
165
|
+
/* Creating, changing or deleting a project makes the remembered list wrong (rememberedProjects). */
|
|
166
|
+
if (method !== "GET" && /^\/v1\/repositories(\/[^/?]+)?(\?|$)/.test(route))
|
|
167
|
+
await forgetFoundProjects();
|
|
118
168
|
/*
|
|
119
169
|
A read that failed before any answer is asked again, twice, with a pause.
|
|
120
170
|
Only reads: a write that may have landed is the caller's to retry, with
|
|
@@ -337,15 +387,24 @@ async function findProject(reference) {
|
|
|
337
387
|
missing sign-in is said as itself: swallowing it here turned a timeout
|
|
338
388
|
into "No project matching", which sent somebody looking for a typo.
|
|
339
389
|
*/
|
|
340
|
-
const all = await projects().catch((error) => {
|
|
341
|
-
if (error instanceof ServiceError)
|
|
342
|
-
return [];
|
|
343
|
-
throw error;
|
|
344
|
-
});
|
|
345
390
|
const ownersMatch = (project) => project.slug.toLowerCase() === bare ||
|
|
346
391
|
project.name.toLowerCase() === bare ||
|
|
347
392
|
/* By id too: a run is handed its project's id as CODEROOK_PROJECT. */
|
|
348
393
|
project.id.toLowerCase() === trimmed.toLowerCase();
|
|
394
|
+
/* The list this machine fetched in the last minute answers first; a miss asks again. */
|
|
395
|
+
if (!owner) {
|
|
396
|
+
const remembered = (await rememberedProjects()).find(ownersMatch);
|
|
397
|
+
if (remembered)
|
|
398
|
+
return remembered;
|
|
399
|
+
}
|
|
400
|
+
const all = await projects().then(async (fresh) => {
|
|
401
|
+
await rememberProjects(fresh);
|
|
402
|
+
return fresh;
|
|
403
|
+
}, (error) => {
|
|
404
|
+
if (error instanceof ServiceError)
|
|
405
|
+
return [];
|
|
406
|
+
throw error;
|
|
407
|
+
});
|
|
349
408
|
if (!owner) {
|
|
350
409
|
const mine = all.find(ownersMatch);
|
|
351
410
|
if (mine)
|
|
@@ -617,6 +676,13 @@ async function versions(repositoryId) {
|
|
|
617
676
|
: [],
|
|
618
677
|
removedAt: row.removedAt == null ? null : String(row.removedAt),
|
|
619
678
|
head: row.head === true,
|
|
679
|
+
savedFrom: (() => {
|
|
680
|
+
const from = row.savedFrom;
|
|
681
|
+
if (!from || typeof from !== "object")
|
|
682
|
+
return null;
|
|
683
|
+
const text = (value) => (typeof value === "string" && value ? value : undefined);
|
|
684
|
+
return { client: text(from.client), machine: text(from.machine), as: text(from.as), workspaceId: text(from.workspaceId) };
|
|
685
|
+
})(),
|
|
620
686
|
}));
|
|
621
687
|
}
|
|
622
688
|
/**
|
package/dist/cli/src/cli.js
CHANGED
|
@@ -58,6 +58,7 @@ const rules_js_1 = require("../../cbx/src/core/rules.js");
|
|
|
58
58
|
const upload_js_1 = require("../../cbx/src/core/upload.js");
|
|
59
59
|
const download_js_1 = require("../../cbx/src/core/download.js");
|
|
60
60
|
const machine_js_1 = require("./machine.js");
|
|
61
|
+
const pending_merges_js_1 = require("./pending_merges.js");
|
|
61
62
|
const workspace_machine_js_1 = require("./workspace_machine.js");
|
|
62
63
|
const safe_path_js_1 = require("../../cbx/src/shared/safe_path.js");
|
|
63
64
|
const faults_js_1 = require("../../cbx/src/core/faults.js");
|
|
@@ -561,6 +562,37 @@ function announcing(run, saved) {
|
|
|
561
562
|
return code;
|
|
562
563
|
};
|
|
563
564
|
}
|
|
565
|
+
/*
|
|
566
|
+
Changes here that a save of this machine already kept as a merge, still
|
|
567
|
+
waiting for a decision. Asked of the service only when one was noted, so a
|
|
568
|
+
plain status costs nothing more; applied or cancelled ones are forgotten.
|
|
569
|
+
*/
|
|
570
|
+
async function mergesWaiting(repositoryId, changed) {
|
|
571
|
+
if (!repositoryId)
|
|
572
|
+
return;
|
|
573
|
+
const noted = await (0, pending_merges_js_1.pendingMerges)(repositoryId);
|
|
574
|
+
if (!noted.length)
|
|
575
|
+
return;
|
|
576
|
+
const here = new Set(changed);
|
|
577
|
+
const settled = new Set();
|
|
578
|
+
for (const merge of noted.slice(-5)) {
|
|
579
|
+
const state = await (0, api_js_1.mergeTrack)(merge.id).then((detail) => detail.mergeTrack.state, () => null);
|
|
580
|
+
if (state === null)
|
|
581
|
+
continue;
|
|
582
|
+
if (state !== "open") {
|
|
583
|
+
settled.add(merge.id);
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
const overlap = merge.paths.filter((one) => here.has(one));
|
|
587
|
+
if (!overlap.length)
|
|
588
|
+
continue;
|
|
589
|
+
console.log(dim(`\n${overlap.length === 1 ? overlap[0] : `${overlap.length} of these`} ${overlap.length === 1 ? "is" : "are"} already kept as `) +
|
|
590
|
+
accent(merge.reference) +
|
|
591
|
+
dim(", waiting for a decision: ") + accent(`cbx merge ${merge.reference}`) +
|
|
592
|
+
dim(". Saving again keeps another copy beside it."));
|
|
593
|
+
}
|
|
594
|
+
await (0, pending_merges_js_1.forgetMerges)(repositoryId, settled).catch(() => undefined);
|
|
595
|
+
}
|
|
564
596
|
async function commandStatus(parsed) {
|
|
565
597
|
const folder = folderFor(parsed);
|
|
566
598
|
let link;
|
|
@@ -659,16 +691,44 @@ async function commandStatus(parsed) {
|
|
|
659
691
|
dropped it from this folder's record. Told plainly, since the one advice
|
|
660
692
|
above would bring back a file the person meant to be rid of.
|
|
661
693
|
*/
|
|
694
|
+
/*
|
|
695
|
+
Told apart by this folder's own record: a file it never held is somebody
|
|
696
|
+
else's new file, which cbx get brings; one it held and no longer has was
|
|
697
|
+
deleted here. Both were told "if you deleted it yourself…", so a
|
|
698
|
+
teammate's new file read as a deletion (2026-11-11 exercise 2).
|
|
699
|
+
*/
|
|
662
700
|
const absent = stale.filter(([file]) => !(0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))));
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
701
|
+
const newThere = absent.filter(([file]) => link.local[file] === undefined);
|
|
702
|
+
const goneHere = absent.filter(([file]) => link.local[file] !== undefined);
|
|
703
|
+
if (newThere.length) {
|
|
704
|
+
const one = newThere.length === 1;
|
|
705
|
+
console.log(dim(`${newThere.length} of them ${one ? "is a new file" : "are new files"} from the saved version, not here yet; `) +
|
|
706
|
+
accent("cbx get") + dim(` brings ${one ? "it" : "them"}.`));
|
|
707
|
+
}
|
|
708
|
+
if (goneHere.length) {
|
|
709
|
+
const one = goneHere.length === 1;
|
|
710
|
+
console.log(dim(`${goneHere.length} of them ${one ? "was" : "were"} deleted here and changed in the saved version since. ` +
|
|
711
|
+
`cbx get leaves ${one ? "it" : "them"} deleted; `) +
|
|
712
|
+
accent("cbx submit --sync") + dim(" saves the deletion, ") + accent("cbx get --replace") + dim(` brings ${one ? "it" : "them"} back.`));
|
|
670
713
|
}
|
|
671
714
|
}
|
|
715
|
+
/*
|
|
716
|
+
The other way round: files this folder holds that the saved version no
|
|
717
|
+
longer has, because somebody removed them. Status never said, and the next
|
|
718
|
+
cbx get removed eleven files nobody here had been told about (2026-11-11
|
|
719
|
+
exercise 2). Only files this folder wrote count; get leaves a file you
|
|
720
|
+
changed since alone.
|
|
721
|
+
*/
|
|
722
|
+
const removedThere = link?.local
|
|
723
|
+
? Object.keys(link.local).filter((file) => link.manifest[file] === undefined && (0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))))
|
|
724
|
+
: [];
|
|
725
|
+
if (removedThere.length) {
|
|
726
|
+
const one = removedThere.length === 1;
|
|
727
|
+
console.log(dim(`${removedThere.length} file${one ? "" : "s"} here ${one ? "was" : "were"} removed in the saved version; `) +
|
|
728
|
+
accent("cbx get") + dim(` removes ${one ? "it" : "them"} here too.`));
|
|
729
|
+
for (const file of removedThere.slice(0, 10))
|
|
730
|
+
console.log(dim(` removed ${file}`));
|
|
731
|
+
}
|
|
672
732
|
/** The deletions, and what a plain save will do about them. */
|
|
673
733
|
/*
|
|
674
734
|
What this folder is, and what its own rules never heard about.
|
|
@@ -748,6 +808,7 @@ async function commandStatus(parsed) {
|
|
|
748
808
|
}
|
|
749
809
|
if (files.length > 50)
|
|
750
810
|
console.log(dim(` …and ${files.length - 50} more`));
|
|
811
|
+
await mergesWaiting(link?.repositoryId, files.map((file) => file.path));
|
|
751
812
|
deletions();
|
|
752
813
|
await engine();
|
|
753
814
|
return 0;
|
|
@@ -1360,6 +1421,22 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1360
1421
|
presence: await (0, machine_js_1.checkInBody)({ kind: "folder", folder, track: link.track ?? null, changedFiles: 0 }),
|
|
1361
1422
|
});
|
|
1362
1423
|
}
|
|
1424
|
+
/*
|
|
1425
|
+
Where the save comes from, kept with the version for the project's people
|
|
1426
|
+
(cbx versions): this machine, unless check-ins are off, and the name an
|
|
1427
|
+
assistant or script gave itself. Eight assistants on one account could not
|
|
1428
|
+
be told apart in History (2026-11-11 agent exercise).
|
|
1429
|
+
*/
|
|
1430
|
+
{
|
|
1431
|
+
const named = flagText(parsed, "as") ?? (node_process_1.default.env.CBX_NAME || undefined);
|
|
1432
|
+
const me = node_process_1.default.env.CODEROOK_NO_PRESENCE ? null : await (0, machine_js_1.machineIdentity)();
|
|
1433
|
+
const savedFrom = {
|
|
1434
|
+
...(me ? { machineId: me.id, machine: me.name } : {}),
|
|
1435
|
+
...(named?.trim() ? { as: named.trim().slice(0, 80) } : {}),
|
|
1436
|
+
};
|
|
1437
|
+
if (Object.keys(savedFrom).length)
|
|
1438
|
+
Object.assign(uploadRequest, { savedFrom });
|
|
1439
|
+
}
|
|
1363
1440
|
/*
|
|
1364
1441
|
Whether this is walking into a merge, asked before anything is sent.
|
|
1365
1442
|
|
|
@@ -1575,6 +1652,13 @@ The connection failed: ${text}`));
|
|
|
1575
1652
|
}
|
|
1576
1653
|
console.log(`\nRun ${accent(`cbx merge ${result.mergeTrack.reference}`)} to decide,` +
|
|
1577
1654
|
` or ${accent("cbx merges")} to see everything waiting.`);
|
|
1655
|
+
/* So cbx status can say this change is already waiting, rather than invite saving it twice. */
|
|
1656
|
+
await (0, pending_merges_js_1.rememberMerge)(result.repositoryId, {
|
|
1657
|
+
id: result.mergeTrack.id,
|
|
1658
|
+
reference: result.mergeTrack.reference,
|
|
1659
|
+
paths: result.mergeTrack.conflicts.map((conflict) => conflict.path),
|
|
1660
|
+
at: new Date().toISOString(),
|
|
1661
|
+
}).catch(() => undefined);
|
|
1578
1662
|
/*
|
|
1579
1663
|
3, not 0: the work is kept, but the line did not move. Scripts and agents
|
|
1580
1664
|
read 0 as saved and carried on (2026-11-11 agent exercise).
|
|
@@ -2097,6 +2181,14 @@ trackName) {
|
|
|
2097
2181
|
else {
|
|
2098
2182
|
console.log(`${accent(`v${latest.sequence}`)} · ${fileCount(result.files)} · ${bytes(result.bytes)} into ${destination}`);
|
|
2099
2183
|
}
|
|
2184
|
+
/*
|
|
2185
|
+
A big file brought up to date by its changed pieces only. Without this, a
|
|
2186
|
+
40 MiB file's update read like a 40 MiB download (2026-11-11 exercise 2).
|
|
2187
|
+
*/
|
|
2188
|
+
const reused = result.piecesReused ?? 0;
|
|
2189
|
+
if (reused) {
|
|
2190
|
+
console.log(dim(`${reused.toLocaleString("en-US")} unchanged piece${reused === 1 ? "" : "s"} of large files came from the copies here; only the changed pieces were fetched.`));
|
|
2191
|
+
}
|
|
2100
2192
|
const leftDeleted = result.leftDeleted ?? 0;
|
|
2101
2193
|
if (leftDeleted) {
|
|
2102
2194
|
console.log(dim(`${fileCount(leftDeleted)} you deleted here and have not saved ${leftDeleted === 1 ? "was" : "were"} left deleted; ` +
|
|
@@ -2385,6 +2477,8 @@ async function findMerge(folder, reference) {
|
|
|
2385
2477
|
* Deciding happens here rather than in a command of its own because the
|
|
2386
2478
|
* decision only means anything next to the thing it is about.
|
|
2387
2479
|
*/
|
|
2480
|
+
/* A decision in the words the flags use; the service's own names (take_candidate) read as internals (exercise 2). */
|
|
2481
|
+
const resolutionWords = (resolution) => ({ take_candidate: "yours", take_target: "theirs", keep_both: "both", delete: "removed" }[resolution] ?? resolution);
|
|
2388
2482
|
async function commandMerge(parsed) {
|
|
2389
2483
|
const reference = parsed.positional[0];
|
|
2390
2484
|
if (!reference) {
|
|
@@ -2478,7 +2572,7 @@ ${accent(now.mergeTrack.reference)} · ` +
|
|
|
2478
2572
|
: `${now.provisional.unresolvedPaths.length} still to decide`));
|
|
2479
2573
|
for (const conflict of now.conflicts) {
|
|
2480
2574
|
console.log(` ${conflict.resolvedAt ? accent("decided") : red("waiting")} ${conflict.path}` +
|
|
2481
|
-
` ${dim(conflictWords(conflict.kind))}${conflict.resolution ? dim(` (${conflict.resolution})`) : ""}`);
|
|
2575
|
+
` ${dim(conflictWords(conflict.kind))}${conflict.resolution ? dim(` (${resolutionWords(conflict.resolution)})`) : ""}`);
|
|
2482
2576
|
}
|
|
2483
2577
|
if (hasFlag(parsed, "apply")) {
|
|
2484
2578
|
if (!now.provisional.ready) {
|
|
@@ -2724,6 +2818,10 @@ const SPECS = [
|
|
|
2724
2818
|
flags: "--no-licence",
|
|
2725
2819
|
description: "do not add a licence to a new project; nobody may reuse it",
|
|
2726
2820
|
},
|
|
2821
|
+
{
|
|
2822
|
+
flags: "--as <name>",
|
|
2823
|
+
description: "the name an assistant or script saves under (or set CBX_NAME); the project's people see it in cbx versions",
|
|
2824
|
+
},
|
|
2727
2825
|
],
|
|
2728
2826
|
examples: [
|
|
2729
2827
|
'cbx submit -m "Fix the export dialog"',
|
|
@@ -3114,7 +3212,7 @@ const SPECS = [
|
|
|
3114
3212
|
name: "workspace",
|
|
3115
3213
|
group: "Workspaces",
|
|
3116
3214
|
summary: "edit, save and run a private project remotely without a checkout",
|
|
3117
|
-
usage: "workspace | workspace <usage|open|list|show|read|files|search|diff|patch|put|starter|review|reviewers|save|run|logs|cancel|deploy|preview|handoff|close|reopen|recipe|assign|assignments|unassign|checkout|say|thread|mute|unmute> <project> [workspace] [job] | workspace put <project> <workspace> <path…> | workspace push [folder] | workspace watch [project] [workspace]",
|
|
3215
|
+
usage: "workspace | workspace <usage|open|list|show|read|files|search|diff|patch|put|starter|review|reviewers|save|run|runs|logs|cancel|deploy|preview|handoff|close|reopen|recipe|assign|assignments|unassign|checkout|say|thread|mute|unmute> <project> [workspace] [job] | workspace put <project> <workspace> <path…> | workspace push [folder] | workspace watch [project] [workspace]",
|
|
3118
3216
|
brief: "workspace <action> <project>",
|
|
3119
3217
|
detail: "Works on CodeRook's durable remote draft, never the current local folder. Use --data-file for structured edits or recipe configuration. Mutations need the reviewed --revision and a unique --key; reuse the same key and request when retrying. Recipes reference existing project workflows. Usage reads the shared workspace credits and separate PR allowance without a draft ID. put copies files from this folder into a draft: text as text, images, fonts and other binary files as bytes (up to 1 MiB each), a file that is gone here is removed there, and each file must still be the version the draft holds, so a teammate's edit is never overwritten. starter reads this folder (package.json scripts, Cargo.toml, go.mod, Python) and suggests one check recipe per package so drafts have something to run; --apply adds them, never replacing a recipe that exists. review shows who must OK a draft before it is saved or deployed; --ok or --changes -m gives your verdict on the current revision, and counts only from the reviewer's own sign-in or token, never a name given with --as. reviewers lists the project's rules, and an administrator sets them with --data-file. Saving and deploying are separate operations. close refuses a draft with edits that were never saved unless --unsaved is given (the edits are kept, not thrown away); reopen opens a closed draft again, edits and all. Run on its own at a terminal, it lists your open workspaces with their unread messages: choose one to see its changes and what is being discussed, and reply, save, run checks, hand it over or close it with one key. say and thread post to and read a workspace's discussion as JSON; a machine signed in to your account can name itself with --as (or CBX_NAME) so its messages and unread count are its own. watch prints each new message, each message addressed to you (@your name, or the name given with --as) and each new saved version as it happens, until stopped; --json gives one JSON object per line for a program.",
|
|
3120
3218
|
options: [
|
|
@@ -3448,7 +3546,7 @@ const SPECS = [
|
|
|
3448
3546
|
name: "mods",
|
|
3449
3547
|
group: "Mods and bundles",
|
|
3450
3548
|
summary: "mod repositories for games: set one up, publish to one",
|
|
3451
|
-
usage: "mods <create|repos|info|settings|builds|list|publish|remove|block|reports|delete> …",
|
|
3549
|
+
usage: "mods <create|repos|info|settings|builds|list|publish|remove|recheck|block|reports|delete> …",
|
|
3452
3550
|
brief: "mods <action> …",
|
|
3453
3551
|
detail: "A mod repository is where a game's players get mods from. Its owner\n" +
|
|
3454
3552
|
"sets the rules — which file types a mod may hold, archives opened and\n" +
|
|
@@ -3466,6 +3564,8 @@ const SPECS = [
|
|
|
3466
3564
|
" publish <folder|zip> --repo <repo> upload a mod; waits for its checks\n" +
|
|
3467
3565
|
" list <repo> [--all] your mods and how their checks went\n" +
|
|
3468
3566
|
" remove <mod> --repo <repo> take a mod down\n" +
|
|
3567
|
+
" recheck <mod> --repo <repo> check again: a part in error (an upload the scanner never\n" +
|
|
3568
|
+
" got to), or a live part with --part\n" +
|
|
3469
3569
|
" block <username> --repo <repo> stop an uploader (owner)\n" +
|
|
3470
3570
|
" reports <repo> what players reported (owner)\n" +
|
|
3471
3571
|
" delete <repo> delete a repository and everything in it",
|
|
@@ -448,6 +448,49 @@ async function remove(parsed) {
|
|
|
448
448
|
console.log((0, colour_js_1.green)(`Removed ${id}.`));
|
|
449
449
|
return 0;
|
|
450
450
|
}
|
|
451
|
+
/*
|
|
452
|
+
Check a part again: what is live, or an upload the scanner never managed to
|
|
453
|
+
look at ("The upload is retained; …check it again"). Nothing could do the
|
|
454
|
+
second until 2026-11-11, so four uploads sat in "error". Without --part,
|
|
455
|
+
every part of the mod that is in error.
|
|
456
|
+
*/
|
|
457
|
+
async function recheck(parsed) {
|
|
458
|
+
const id = parsed.positional[1];
|
|
459
|
+
const slug = flag(parsed, "repo");
|
|
460
|
+
if (!id || !slug) {
|
|
461
|
+
console.error((0, colour_js_1.red)("Usage: cbx mods recheck <mod> --repo <repo> [--part <id>] [--as-owner]"));
|
|
462
|
+
return 1;
|
|
463
|
+
}
|
|
464
|
+
const scope = has(parsed, "as-owner") ? "admin" : "my";
|
|
465
|
+
const base = `${ROOT}/${encodeURIComponent(slug)}/${scope}/mods/${encodeURIComponent(id)}`;
|
|
466
|
+
let parts;
|
|
467
|
+
const named = flag(parsed, "part");
|
|
468
|
+
if (named)
|
|
469
|
+
parts = [named];
|
|
470
|
+
else {
|
|
471
|
+
const view = await call(base);
|
|
472
|
+
if (view.status !== 200)
|
|
473
|
+
return fail(view, `Reading ${id}`);
|
|
474
|
+
parts = view.body.parts.filter((part) => part.check.state === "error").map((part) => part.part);
|
|
475
|
+
if (!parts.length) {
|
|
476
|
+
console.log((0, colour_js_1.dim)(`No part of ${id} is in error. Name one with --part to check a live part again.`));
|
|
477
|
+
return 0;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
let failed = 0;
|
|
481
|
+
for (const part of parts) {
|
|
482
|
+
const answer = await call(`${base}/parts/${encodeURIComponent(part)}/recheck`, "POST", {});
|
|
483
|
+
if (answer.status !== 200 && answer.status !== 202) {
|
|
484
|
+
failed += 1;
|
|
485
|
+
fail(answer, `Checking ${id}/${part} again`);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
console.log(`${(0, colour_js_1.accent)(part)} ${(0, colour_js_1.dim)(answer.body.check === "checking" ? "being checked" : answer.body.check === "queued" ? "queued for the scanner" : answer.body.check)}`);
|
|
489
|
+
}
|
|
490
|
+
if (parts.length > failed)
|
|
491
|
+
console.log((0, colour_js_1.dim)(`\nFollow it with cbx mods list ${slug}.`));
|
|
492
|
+
return failed ? 1 : 0;
|
|
493
|
+
}
|
|
451
494
|
async function block(parsed) {
|
|
452
495
|
const account = parsed.positional[1];
|
|
453
496
|
const slug = flag(parsed, "repo");
|
|
@@ -508,6 +551,7 @@ async function commandMods(parsed) {
|
|
|
508
551
|
case "list": return mine(parsed);
|
|
509
552
|
case "publish": return publish(parsed);
|
|
510
553
|
case "remove": return remove(parsed);
|
|
554
|
+
case "recheck": return recheck(parsed);
|
|
511
555
|
case "block": return block(parsed);
|
|
512
556
|
case "reports": return reports(parsed);
|
|
513
557
|
case "delete": return deleteRepo(parsed);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pendingMerges = pendingMerges;
|
|
7
|
+
exports.rememberMerge = rememberMerge;
|
|
8
|
+
exports.forgetMerges = forgetMerges;
|
|
9
|
+
/**
|
|
10
|
+
* Merges this machine's saves were kept as, per project.
|
|
11
|
+
*
|
|
12
|
+
* A save kept as a merge leaves the folder exactly as it was, so cbx status
|
|
13
|
+
* went on saying "1 file to submit" and nothing else, and the obvious next
|
|
14
|
+
* step was to save the same change again, keeping a second copy beside the
|
|
15
|
+
* first (2026-11-11 exercise 2). cbx submit notes each merge here; cbx status
|
|
16
|
+
* asks the service about the noted ones, says which are still waiting, and
|
|
17
|
+
* forgets the ones that were applied or cancelled.
|
|
18
|
+
*
|
|
19
|
+
* A note, not a record anybody depends on: a missing or unreadable file only
|
|
20
|
+
* means status says less.
|
|
21
|
+
*/
|
|
22
|
+
const promises_1 = require("node:fs/promises");
|
|
23
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
24
|
+
const config_js_1 = require("./config.js");
|
|
25
|
+
const KEPT = 20;
|
|
26
|
+
function noteFile(repositoryId) {
|
|
27
|
+
/* Only an id the service gave names a file. */
|
|
28
|
+
return /^[0-9a-f-]{36}$/i.test(repositoryId)
|
|
29
|
+
? node_path_1.default.join((0, config_js_1.configDirectory)(), "pending-merges", `${repositoryId.toLowerCase()}.json`)
|
|
30
|
+
: null;
|
|
31
|
+
}
|
|
32
|
+
async function pendingMerges(repositoryId) {
|
|
33
|
+
const file = noteFile(repositoryId);
|
|
34
|
+
if (!file)
|
|
35
|
+
return [];
|
|
36
|
+
try {
|
|
37
|
+
const parsed = JSON.parse(await (0, promises_1.readFile)(file, "utf8"));
|
|
38
|
+
return Array.isArray(parsed)
|
|
39
|
+
? parsed.filter((one) => typeof one?.id === "string" && typeof one?.reference === "string" && Array.isArray(one?.paths))
|
|
40
|
+
: [];
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function write(repositoryId, merges) {
|
|
47
|
+
const file = noteFile(repositoryId);
|
|
48
|
+
if (!file)
|
|
49
|
+
return;
|
|
50
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(file), { recursive: true });
|
|
51
|
+
await (0, promises_1.writeFile)(file, JSON.stringify(merges.slice(-KEPT), null, 2) + "\n");
|
|
52
|
+
}
|
|
53
|
+
async function rememberMerge(repositoryId, merge) {
|
|
54
|
+
const kept = (await pendingMerges(repositoryId)).filter((one) => one.id !== merge.id);
|
|
55
|
+
await write(repositoryId, [...kept, merge]);
|
|
56
|
+
}
|
|
57
|
+
async function forgetMerges(repositoryId, ids) {
|
|
58
|
+
if (!ids.size)
|
|
59
|
+
return;
|
|
60
|
+
const kept = await pendingMerges(repositoryId);
|
|
61
|
+
await write(repositoryId, kept.filter((one) => !ids.has(one.id)));
|
|
62
|
+
}
|
|
@@ -401,6 +401,23 @@ async function commandVersions(parsed) {
|
|
|
401
401
|
(marks.length ? ` ${marks.join(" ")}` : ""));
|
|
402
402
|
if (version.message)
|
|
403
403
|
console.log(` ${(0, colour_js_1.dim)(version.message)}`);
|
|
404
|
+
/*
|
|
405
|
+
Where it came from, when the save said: "saved as Codex-2 on ALEX-PC from
|
|
406
|
+
draft 6f1c1a52 with cli/0.46.10". Eight assistants on one account read as
|
|
407
|
+
one author before this (2026-11-11 agent exercise). Only the project's
|
|
408
|
+
people are sent it, so a visitor's list has no such line.
|
|
409
|
+
*/
|
|
410
|
+
const from = version.savedFrom;
|
|
411
|
+
const where = from
|
|
412
|
+
? [
|
|
413
|
+
from.as ? `as ${from.as}` : "",
|
|
414
|
+
from.machine ? `on ${from.machine}` : "",
|
|
415
|
+
from.workspaceId ? `from draft ${from.workspaceId.slice(0, 8)}` : "",
|
|
416
|
+
from.client ? `with ${from.client}` : "",
|
|
417
|
+
].filter(Boolean)
|
|
418
|
+
: [];
|
|
419
|
+
if (where.length)
|
|
420
|
+
console.log(` ${(0, colour_js_1.dim)(`saved ${where.join(" ")}`)}`);
|
|
404
421
|
/*
|
|
405
422
|
Indented under the save it belongs to rather than printed flat, so a
|
|
406
423
|
note of several paragraphs still reads as part of one row.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderook/cli",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.11",
|
|
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",
|