@coderook/cli 0.46.10 → 0.46.12

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.46.10",
5
+ "version": "0.46.12",
6
6
  "author": {
7
7
  "name": "ACCA Gaming Productions",
8
8
  "url": "https://coderook.com"
@@ -653,7 +653,8 @@ async function commandStatus(parsed) {
653
653
  });
654
654
  console.log(bold(node_path_1.default.basename(folder)) + dim(` ${folder}`));
655
655
  console.log(link
656
- ? `Account holds ${accent(`v${link.sequence}`)} · ${Object.keys(link.manifest).length} ${Object.keys(link.manifest).length === 1 ? "file" : "files"} ${dim(`(${link.slug})`)}`
656
+ /* "Account holds" read as the project's latest; it is what this folder is on (exercise 2). */
657
+ ? `This folder is on ${accent(`v${link.sequence}`)} · ${Object.keys(link.manifest).length} ${Object.keys(link.manifest).length === 1 ? "file" : "files"} ${dim(`(${link.slug})`)}`
657
658
  : dim("This folder is not linked to a project."));
658
659
  if (!link) {
659
660
  const likes = (0, folder_match_js_1.similarProjects)(await (0, api_js_2.projects)().catch(() => []), node_path_1.default.basename(folder));
@@ -1547,7 +1548,8 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
1547
1548
  if (plan.repositoryCreated)
1548
1549
  createdRepositoryId = plan.repositoryId;
1549
1550
  console.log(plan.estimated
1550
- ? `${accent("Upload plan")} ${bytes(plan.sourceBytes)} selected; ${bytes(plan.chargeableBytes)} of changes to send.`
1551
+ /* Before compression: the summary's "sent" is after it, and the two read as a contradiction (exercise 2). */
1552
+ ? `${accent("Upload plan")} ${bytes(plan.sourceBytes)} selected; ${bytes(plan.chargeableBytes)} of changes, compressed before sending.`
1551
1553
  : `${accent("Upload plan")} ${bytes(plan.sourceBytes)} selected → ` +
1552
1554
  `${bytes(plan.compactedBytes)} compacted; ${bytes(plan.chargeableBytes)} new storage.`);
1553
1555
  console.log(plan.estimated
@@ -1725,8 +1727,9 @@ The connection failed: ${text}`));
1725
1727
  */
1726
1728
  const repacked = Math.min(result.repackedFiles ?? 0, result.sentFiles);
1727
1729
  const changedSent = result.sentFiles - repacked;
1728
- console.log(`Saved ${accent(`v${result.sequence}`)} · sent ${bytes(result.sentBytes)} in ` +
1729
- `${changedSent} file${changedSent === 1 ? "" : "s"}` +
1730
+ console.log(`Saved ${accent(`v${result.sequence}`)} · sent ${bytes(result.sentBytes)} ` +
1731
+ /* "sent 565 B in 0 files, 11 removed" read as a failure; nothing but the list of changes went (exercise 2). */
1732
+ (changedSent ? `in ${changedSent} file${changedSent === 1 ? "" : "s"}` : "(the list of changes, no file contents)") +
1730
1733
  (repacked ? ` (and re-packed ${repacked} unchanged small file${repacked === 1 ? "" : "s"} together)` : "") +
1731
1734
  /*
1732
1735
  Three different things, kept apart. Sent is what crossed the wire.
@@ -2090,8 +2093,9 @@ trackName) {
2090
2093
  let result;
2091
2094
  try {
2092
2095
  result = await downloader.run(repositoryId, latest.id, destination, (progress) => {
2093
- line(` ${track(progress.percent)} ${String(progress.percent).padStart(3)}% ` +
2094
- `${progress.files}/${progress.totalFiles} ` +
2096
+ /* The bar and percent count bytes, the fraction files: "11% 284/298" read as a contradiction (exercise 2). */
2097
+ line(` ${track(progress.percent)} ${String(progress.percent).padStart(3)}% of the bytes ` +
2098
+ `${progress.files}/${progress.totalFiles} files ` +
2095
2099
  dim(progress.path.slice(-40)));
2096
2100
  },
2097
2101
  // What this folder received last time, so a file the project has since
@@ -3208,6 +3212,23 @@ const SPECS = [
3208
3212
  ],
3209
3213
  run: project_commands_js_1.commandVersions,
3210
3214
  },
3215
+ {
3216
+ name: "files",
3217
+ aliases: ["ls"],
3218
+ group: "Versions and releases",
3219
+ summary: "what a saved version holds",
3220
+ usage: "files [project] [version]",
3221
+ detail: "Every file in a saved version, with its size. The current one unless you\n" +
3222
+ "name another (12 or v12). Run it inside a linked folder to leave the\n" +
3223
+ "project out; --path narrows it to one folder.",
3224
+ options: [
3225
+ { flags: "--path <prefix>", description: "only files under this path, e.g. src/" },
3226
+ { flags: "--version <n>", description: "which version (the second argument does the same)" },
3227
+ { flags: "--json", description: "the list as JSON" },
3228
+ ],
3229
+ examples: ["cbx files", "cbx files my-project 12 --path stress/"],
3230
+ run: project_commands_js_1.commandFiles,
3231
+ },
3211
3232
  {
3212
3233
  name: "workspace",
3213
3234
  group: "Workspaces",
@@ -3546,7 +3567,7 @@ const SPECS = [
3546
3567
  name: "mods",
3547
3568
  group: "Mods and bundles",
3548
3569
  summary: "mod repositories for games: set one up, publish to one",
3549
- usage: "mods <create|repos|info|settings|builds|list|publish|remove|block|reports|delete> …",
3570
+ usage: "mods <create|repos|info|settings|builds|list|publish|remove|recheck|block|reports|delete> …",
3550
3571
  brief: "mods <action> …",
3551
3572
  detail: "A mod repository is where a game's players get mods from. Its owner\n" +
3552
3573
  "sets the rules — which file types a mod may hold, archives opened and\n" +
@@ -3564,6 +3585,8 @@ const SPECS = [
3564
3585
  " publish <folder|zip> --repo <repo> upload a mod; waits for its checks\n" +
3565
3586
  " list <repo> [--all] your mods and how their checks went\n" +
3566
3587
  " remove <mod> --repo <repo> take a mod down\n" +
3588
+ " recheck <mod> --repo <repo> check again: a part in error (an upload the scanner never\n" +
3589
+ " got to), or a live part with --part\n" +
3567
3590
  " block <username> --repo <repo> stop an uploader (owner)\n" +
3568
3591
  " reports <repo> what players reported (owner)\n" +
3569
3592
  " 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);
@@ -20,6 +20,7 @@ exports.splitVisibility = splitVisibility;
20
20
  exports.offeredPublicly = offeredPublicly;
21
21
  exports.agreed = agreed;
22
22
  exports.commandVisibility = commandVisibility;
23
+ exports.commandFiles = commandFiles;
23
24
  exports.commandVersions = commandVersions;
24
25
  const node_process_1 = __importDefault(require("node:process"));
25
26
  const promises_1 = require("node:readline/promises");
@@ -325,6 +326,47 @@ async function commandVisibility(parsed) {
325
326
  return 0;
326
327
  }
327
328
  /** Every saved version of a project, newest first. */
329
+ /*
330
+ What a saved version holds: its files, with sizes.
331
+
332
+ There was no way to ask from the terminal. An agent checking that a rename
333
+ had been saved tried "cbx files", was told "Did you mean cbx rules?", and
334
+ had to piece it together from a diff (2026-11-11 exercise 2).
335
+ */
336
+ async function commandFiles(parsed) {
337
+ const project = await resolveProject(parsed.positional[0]);
338
+ if (!project)
339
+ return 1;
340
+ const saved = await (0, api_js_1.versions)(project.id);
341
+ if (!saved.length) {
342
+ console.log((0, colour_js_1.dim)("Nothing has been saved to this project yet."));
343
+ return 0;
344
+ }
345
+ const asked = parsed.positional[1] ?? (typeof parsed.flags.get("version") === "string" ? String(parsed.flags.get("version")) : undefined);
346
+ const sequence = asked ? Number(asked.replace(/^v/i, "")) : null;
347
+ const version = sequence !== null
348
+ ? saved.find((one) => one.sequence === sequence)
349
+ : saved.find((one) => one.head) ?? saved[0];
350
+ if (!version) {
351
+ console.error((0, colour_js_1.red)(`${project.name} has no v${asked?.replace(/^v/i, "")}. cbx versions lists them.`));
352
+ return 1;
353
+ }
354
+ const prefix = typeof parsed.flags.get("path") === "string" ? String(parsed.flags.get("path")) : "";
355
+ const listed = await (0, api_js_1.callApi)(`/v1/repositories/${encodeURIComponent(project.id)}/versions/${encodeURIComponent(version.id)}/files`);
356
+ const files = (listed.files ?? [])
357
+ .map((one) => ({ path: String(one.path ?? ""), size: Number(one.sourceSize ?? 0) }))
358
+ .filter((one) => one.path.startsWith(prefix))
359
+ .sort((a, b) => a.path.localeCompare(b.path));
360
+ if (parsed.flags.get("json") === true) {
361
+ console.log(JSON.stringify({ version: version.sequence, files }, null, 2));
362
+ return 0;
363
+ }
364
+ console.log(`${(0, colour_js_1.bold)(project.name)} ${(0, colour_js_1.accent)(`v${version.sequence}`)} ` +
365
+ (0, colour_js_1.dim)(`${files.length.toLocaleString("en-US")} file${files.length === 1 ? "" : "s"}${prefix ? ` under ${prefix}` : ""}`));
366
+ for (const one of files)
367
+ console.log(` ${bytes(one.size).padStart(9)} ${one.path}`);
368
+ return 0;
369
+ }
328
370
  async function commandVersions(parsed) {
329
371
  const project = await resolveProject(parsed.positional[0]);
330
372
  if (!project)
@@ -41,7 +41,7 @@ exports.LISTING_ORDER = [
41
41
  "status", "submit", "diff", "get", "track", "ignore", "licence",
42
42
  "init", "save", "log", "restore", "switch", "push", "pull",
43
43
  "tracks", "line-rules", "merges", "merge", "propose", "proposals", "pr",
44
- "versions", "mark", "notes", "labels", "promote", "release", "releases", "attach", "held", "review", "undo",
44
+ "versions", "files", "mark", "notes", "labels", "promote", "release", "releases", "attach", "held", "review", "undo",
45
45
  "take-down", "verify", "deps",
46
46
  "about", "features", "visibility", "ai", "private", "upload-rules", "people", "watch", "hooks", "secret", "assistant",
47
47
  "security", "pages", "fork", "hand-over", "delete",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderook/cli",
3
- "version": "0.46.10",
3
+ "version": "0.46.12",
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",