@coderook/cli 0.46.3 → 0.46.4
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/cbx/src/core/upload.js +38 -2
- package/dist/cbx/src/core/worktree.js +8 -2
- package/dist/cli/src/cli.js +159 -22
- package/dist/cli/src/help.js +119 -4
- package/dist/cli/src/machine.js +31 -14
- package/dist/cli/src/registry.js +1 -1
- package/package.json +2 -2
|
@@ -1218,6 +1218,7 @@ class Uploader {
|
|
|
1218
1218
|
...(this.trackedByGit.length ? { trackedByGit: this.trackedByGit } : {}),
|
|
1219
1219
|
...(removed.length ? { removed } : {}),
|
|
1220
1220
|
...(executable.length ? { executable } : {}),
|
|
1221
|
+
...(request.presence ? { presence: request.presence } : {}),
|
|
1221
1222
|
}));
|
|
1222
1223
|
const rest = new Uint8Array(4 + header.byteLength + plan.envelope.byteLength);
|
|
1223
1224
|
new DataView(rest.buffer).setUint32(0, header.byteLength, false);
|
|
@@ -1384,6 +1385,7 @@ class Uploader {
|
|
|
1384
1385
|
...(completed.version.state === "held" ? { held: true } : {}),
|
|
1385
1386
|
...(completed.mergeTrack ? { mergeTrack: completed.mergeTrack } : {}),
|
|
1386
1387
|
...(completed.repeated ? { repeated: true } : {}),
|
|
1388
|
+
...(completed.presence === true ? { presenceRecorded: true } : {}),
|
|
1387
1389
|
sourceBytes: completed.version.sourceSize ?? sourceBytes,
|
|
1388
1390
|
storedBytes: completed.version.storedSize ?? storedBytes,
|
|
1389
1391
|
sentBytes: progress.transferred,
|
|
@@ -2220,6 +2222,32 @@ class Uploader {
|
|
|
2220
2222
|
asks the service for the account's storage and allowance, with an empty
|
|
2221
2223
|
object list, so what a person is shown before saving stays true.
|
|
2222
2224
|
*/
|
|
2225
|
+
/*
|
|
2226
|
+
When the save is likely to go as one request, the storage check is
|
|
2227
|
+
asked while the patches are made (and their signatures fetched), not
|
|
2228
|
+
after: two round trips at once instead of one after the other. If it
|
|
2229
|
+
turns out not to, the ordinary path prices the save again as it always
|
|
2230
|
+
has, and this answer is simply not used.
|
|
2231
|
+
*/
|
|
2232
|
+
const quoting = this.planning &&
|
|
2233
|
+
!this.deltaSaveRefused &&
|
|
2234
|
+
typeof request.baseVersionId === "string" &&
|
|
2235
|
+
prior.size > 0 &&
|
|
2236
|
+
!request.allowSecrets &&
|
|
2237
|
+
declarations.length <= delta_js_1.DELTA_BATCH_MAX_FILES &&
|
|
2238
|
+
(await this.serviceFeatures()).includes("delta-save-v1")
|
|
2239
|
+
? this.call(`/v1/repositories/${repositoryId}/uploads/preflight`, {
|
|
2240
|
+
method: "POST",
|
|
2241
|
+
contentType: "application/json",
|
|
2242
|
+
body: JSON.stringify({
|
|
2243
|
+
sourceBytes: totalBytes,
|
|
2244
|
+
excludedBytes: 0,
|
|
2245
|
+
objects: [],
|
|
2246
|
+
track: request.track ?? "main",
|
|
2247
|
+
}),
|
|
2248
|
+
})
|
|
2249
|
+
: null;
|
|
2250
|
+
quoting?.catch(() => undefined);
|
|
2223
2251
|
const oneRequest = this.deltaSaveRefused
|
|
2224
2252
|
? null
|
|
2225
2253
|
: await this.deltaSavePlan(request, repositoryId, declarations, prior);
|
|
@@ -2234,7 +2262,7 @@ class Uploader {
|
|
|
2234
2262
|
percent: 96,
|
|
2235
2263
|
bytesPerSecond: 0,
|
|
2236
2264
|
});
|
|
2237
|
-
this.plannedQuote = await this.call(`/v1/repositories/${repositoryId}/uploads/preflight`, {
|
|
2265
|
+
this.plannedQuote = await (quoting ?? this.call(`/v1/repositories/${repositoryId}/uploads/preflight`, {
|
|
2238
2266
|
method: "POST",
|
|
2239
2267
|
contentType: "application/json",
|
|
2240
2268
|
body: JSON.stringify({
|
|
@@ -2243,7 +2271,7 @@ class Uploader {
|
|
|
2243
2271
|
objects: [],
|
|
2244
2272
|
track: request.track ?? "main",
|
|
2245
2273
|
}),
|
|
2246
|
-
});
|
|
2274
|
+
}));
|
|
2247
2275
|
return {
|
|
2248
2276
|
repositoryId,
|
|
2249
2277
|
versionId: "",
|
|
@@ -3613,6 +3641,14 @@ class Uploader {
|
|
|
3613
3641
|
this.chunkingSupported = (await this.serviceFeatures()).includes("chunked-files");
|
|
3614
3642
|
return this.chunkingSupported;
|
|
3615
3643
|
}
|
|
3644
|
+
/*
|
|
3645
|
+
Asks /health now, so the answer is in hand by the time a plan needs it.
|
|
3646
|
+
A save's planning used to stop for this round trip after the folder had
|
|
3647
|
+
been scanned; asked when the command starts, it overlaps the scan.
|
|
3648
|
+
*/
|
|
3649
|
+
prefetchCapabilities() {
|
|
3650
|
+
void this.serviceCapabilities();
|
|
3651
|
+
}
|
|
3616
3652
|
/** What /health says this deployment accepts. One request per uploader. */
|
|
3617
3653
|
async serviceCapabilities() {
|
|
3618
3654
|
if (this.capabilityRequest)
|
|
@@ -932,7 +932,13 @@ stats,
|
|
|
932
932
|
/** Filled with how much of the folder the cap allowed through. */
|
|
933
933
|
outcome,
|
|
934
934
|
/** False for a read-only report: the listing's sizes and times may stand in for a stat (see engineScan). */
|
|
935
|
-
exact = true
|
|
935
|
+
exact = true,
|
|
936
|
+
/*
|
|
937
|
+
Filled with every file the walk found that the rules would send, capped or
|
|
938
|
+
not. A caller asking which saved files are gone from the folder needs only
|
|
939
|
+
stat the ones missing from it, rather than every file the save holds.
|
|
940
|
+
*/
|
|
941
|
+
seen) {
|
|
936
942
|
/* What git already tracks goes up whatever a rule says; see gitTracked. */
|
|
937
943
|
const tracked = await gitTracked(root);
|
|
938
944
|
/*
|
|
@@ -943,7 +949,7 @@ exact = true) {
|
|
|
943
949
|
const native = await (0, native_engine_js_1.engineScan)(root, rules, tracked, baseline?.size ?? stats?.size, exact);
|
|
944
950
|
const layers = native ? [] : await collectLayers(root, rules);
|
|
945
951
|
const files = [];
|
|
946
|
-
const present = new Set();
|
|
952
|
+
const present = seen ?? new Set();
|
|
947
953
|
const pending = [root];
|
|
948
954
|
/** Everything the rules would send, including what the cap keeps out. */
|
|
949
955
|
const found = [];
|
package/dist/cli/src/cli.js
CHANGED
|
@@ -254,6 +254,23 @@ async function reconcile(folder, options = {}) {
|
|
|
254
254
|
return { link: null, baseline: null, behind: null, member: true };
|
|
255
255
|
}
|
|
256
256
|
let member = true;
|
|
257
|
+
/*
|
|
258
|
+
The project's versions and lines asked for at the same time as the list
|
|
259
|
+
that says the project is still this account's, rather than after it:
|
|
260
|
+
each is a round trip of a third to half a second from here, and the three
|
|
261
|
+
in a row were a second of every save. If the project has gone, these two
|
|
262
|
+
are refused and the error below says why.
|
|
263
|
+
*/
|
|
264
|
+
const knownId = link?.repositoryId ?? options.adopt?.id;
|
|
265
|
+
const downloader = new download_js_1.Downloader(config_js_1.credentials);
|
|
266
|
+
const early = knownId
|
|
267
|
+
? {
|
|
268
|
+
versions: downloader.versions(knownId),
|
|
269
|
+
lines: new tracks_js_1.Tracks(config_js_1.credentials).list(knownId),
|
|
270
|
+
}
|
|
271
|
+
: null;
|
|
272
|
+
early?.versions.catch(() => undefined);
|
|
273
|
+
early?.lines.catch(() => undefined);
|
|
257
274
|
let project = link
|
|
258
275
|
? (await (0, api_js_2.projects)()).find((candidate) => candidate.id === link.repositoryId)
|
|
259
276
|
: options.adopt;
|
|
@@ -291,8 +308,7 @@ async function reconcile(folder, options = {}) {
|
|
|
291
308
|
// Nothing saved on the account, so everything here is outstanding.
|
|
292
309
|
return { link: link ?? null, baseline: null, behind: null, member };
|
|
293
310
|
}
|
|
294
|
-
const
|
|
295
|
-
const all = await downloader.versions(project.id);
|
|
311
|
+
const all = await (early && project.id === knownId ? early.versions : downloader.versions(project.id));
|
|
296
312
|
/*
|
|
297
313
|
The head of this folder's line, not the newest version in the project.
|
|
298
314
|
|
|
@@ -302,7 +318,7 @@ async function reconcile(folder, options = {}) {
|
|
|
302
318
|
v42 is not on the line it was saving to. fetchInto learned the same thing.
|
|
303
319
|
*/
|
|
304
320
|
const lineName = link?.track ?? project.defaultBranch ?? "main";
|
|
305
|
-
const line = (await new tracks_js_1.Tracks(config_js_1.credentials).list(project.id)).find((candidate) => candidate.kind === "line" && candidate.name === lineName);
|
|
321
|
+
const line = (await (early && project.id === knownId ? early.lines : new tracks_js_1.Tracks(config_js_1.credentials).list(project.id))).find((candidate) => candidate.kind === "line" && candidate.name === lineName);
|
|
306
322
|
const latest = (line?.headVersionId && all.find((version) => version.id === line.headVersionId)) ||
|
|
307
323
|
all[0];
|
|
308
324
|
if (!latest)
|
|
@@ -392,6 +408,42 @@ async function commandSignOut() {
|
|
|
392
408
|
console.log("Signed out on this machine.");
|
|
393
409
|
return 0;
|
|
394
410
|
}
|
|
411
|
+
/** How big a machine this account's runs get (backend/src/runner_power.ts), shown or changed. */
|
|
412
|
+
async function commandPower(parsed) {
|
|
413
|
+
const asked = parsed.positional[0]?.toLowerCase();
|
|
414
|
+
if (asked && !["standard", "fast", "max"].includes(asked)) {
|
|
415
|
+
console.error(red(`There is no runner power called "${parsed.positional[0]}". Choose standard, fast or max.`));
|
|
416
|
+
return 1;
|
|
417
|
+
}
|
|
418
|
+
const state = asked
|
|
419
|
+
? await (0, api_js_2.callApi)("/v1/account/runner-power", { method: "PUT", body: { power: asked } })
|
|
420
|
+
: await (0, api_js_2.callApi)("/v1/account/runner-power");
|
|
421
|
+
if (hasFlag(parsed, "json")) {
|
|
422
|
+
console.log(JSON.stringify(state));
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
const credits = (value) => String(Math.round(value * 10) / 10);
|
|
426
|
+
const current = state.levels.find((level) => level.id === state.effective) ?? state.levels[0];
|
|
427
|
+
if (current) {
|
|
428
|
+
console.log(`${asked ? "Runner power is now" : "Runner power:"} ${accent(current.label)} · ` +
|
|
429
|
+
`${current.vcpu} CPUs · ${current.memoryGiB} GB · ${credits(current.creditsPerMinute)} credits a minute`);
|
|
430
|
+
}
|
|
431
|
+
if (state.power !== state.effective) {
|
|
432
|
+
console.log(dim(`You chose ${state.power}; free and trial accounts run on Standard.`));
|
|
433
|
+
}
|
|
434
|
+
console.log("");
|
|
435
|
+
const width = Math.max(...state.levels.map((level) => level.id.length));
|
|
436
|
+
for (const level of state.levels) {
|
|
437
|
+
const mark = level.id === state.effective ? accent("●") : " ";
|
|
438
|
+
const machine = `${level.vcpu} CPUs · ${level.memoryGiB} GB`;
|
|
439
|
+
console.log(` ${mark} ${level.id.padEnd(width)} ${machine.padEnd(16)} ${credits(level.creditsPerMinute)} credits a minute`);
|
|
440
|
+
}
|
|
441
|
+
console.log("");
|
|
442
|
+
console.log(dim(state.available
|
|
443
|
+
? "Change it with cbx power standard|fast|max. A run already going keeps its machine."
|
|
444
|
+
: "More runner power comes with a paid plan; free and trial accounts run on Standard."));
|
|
445
|
+
return 0;
|
|
446
|
+
}
|
|
395
447
|
async function commandWhoami() {
|
|
396
448
|
const account = await (0, api_js_2.whoami)();
|
|
397
449
|
console.log(`${bold(account.displayName)} <${account.email}> · ${account.plan}`);
|
|
@@ -804,12 +856,15 @@ async function digestOfFile(full) {
|
|
|
804
856
|
* lives on in every save after it until somebody passes --sync. `status`
|
|
805
857
|
* already said this; `submit` did not, and from Linux a project turned out to
|
|
806
858
|
* carry a stale copy of a whole app at its root for weeks. Counted from the
|
|
807
|
-
* folder's record of what it holds
|
|
859
|
+
* folder's record of what it holds. Given what the scan found (`seen`), only
|
|
860
|
+
* the saved files the scan did not find are looked for on disk — one that an
|
|
861
|
+
* ignore rule now keeps out is still there, not deleted. Without it, a stat
|
|
862
|
+
* per recorded file: two seconds of every save of a 14,000-file project.
|
|
808
863
|
*/
|
|
809
|
-
function noteKeptDeletions(folder, baseline, syncing) {
|
|
864
|
+
function noteKeptDeletions(folder, baseline, syncing, seen) {
|
|
810
865
|
if (syncing || !baseline?.size)
|
|
811
866
|
return 0;
|
|
812
|
-
const gone = [...baseline.keys()].filter((file) => !(0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))));
|
|
867
|
+
const gone = [...baseline.keys()].filter((file) => !seen?.has(file) && !(0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))));
|
|
813
868
|
if (!gone.length)
|
|
814
869
|
return 0;
|
|
815
870
|
console.log(dim(`${gone.length} file${gone.length === 1 ? "" : "s"} deleted here ${gone.length === 1 ? "is" : "are"} still in the saved version` +
|
|
@@ -876,6 +931,9 @@ async function commandSubmit(parsed) {
|
|
|
876
931
|
else
|
|
877
932
|
parsed.flags.set("name", chosen.name);
|
|
878
933
|
}
|
|
934
|
+
/* Made before the scan so its capability check overlaps it (prefetchCapabilities). */
|
|
935
|
+
const firstUploader = new upload_js_1.Uploader(config_js_1.credentials);
|
|
936
|
+
firstUploader.prefetchCapabilities();
|
|
879
937
|
const { link, baseline, behind, member } = await reconcile(folder, {
|
|
880
938
|
...(adopt ? { adopt } : {}),
|
|
881
939
|
persist: !dryRun,
|
|
@@ -966,7 +1024,8 @@ async function commandSubmit(parsed) {
|
|
|
966
1024
|
const knownDigests = link?.repositoryId
|
|
967
1025
|
? await (0, config_js_1.readDigests)(link.repositoryId)
|
|
968
1026
|
: new Map();
|
|
969
|
-
const
|
|
1027
|
+
const seen = new Set();
|
|
1028
|
+
const files = await (0, worktree_js_1.changedFiles)(folder, rules, baseline, hasFlag(parsed, "sync") ? "synchronize" : "add-and-update", knownDigests, undefined, true, seen);
|
|
970
1029
|
/*
|
|
971
1030
|
An upgraded folder with no materialisation record and something that
|
|
972
1031
|
differs from its recorded version is ambiguous in the one way that
|
|
@@ -1002,10 +1061,10 @@ async function commandSubmit(parsed) {
|
|
|
1002
1061
|
deleting a folder from a copy of the Cheat Engine sources.
|
|
1003
1062
|
*/
|
|
1004
1063
|
if (!hasFlag(parsed, "sync")) {
|
|
1005
|
-
const kept = [...(baseline?.keys() ?? [])].some((file) => !(0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))));
|
|
1064
|
+
const kept = [...(baseline?.keys() ?? [])].some((file) => !seen.has(file) && !(0, node_fs_1.existsSync)(node_path_1.default.join(folder, ...file.split("/"))));
|
|
1006
1065
|
if (kept) {
|
|
1007
1066
|
console.log("Nothing new to submit.");
|
|
1008
|
-
noteKeptDeletions(folder, baseline, false);
|
|
1067
|
+
noteKeptDeletions(folder, baseline, false, seen);
|
|
1009
1068
|
return 0;
|
|
1010
1069
|
}
|
|
1011
1070
|
}
|
|
@@ -1142,7 +1201,7 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1142
1201
|
}
|
|
1143
1202
|
const line = progressLine();
|
|
1144
1203
|
const uploadDisplay = new upload_progress_js_1.UploadDisplay();
|
|
1145
|
-
let uploader =
|
|
1204
|
+
let uploader = firstUploader;
|
|
1146
1205
|
/*
|
|
1147
1206
|
Built by the shared description, so this and the git remote helper cannot
|
|
1148
1207
|
drift. They already had: the helper listed deletions in `deletions` alone
|
|
@@ -1201,6 +1260,12 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1201
1260
|
...(hasFlag(parsed, "allow-secrets") ? { allowSecrets: true } : {}),
|
|
1202
1261
|
...(link ? { known: link.local ?? link.manifest ?? {} } : {}),
|
|
1203
1262
|
});
|
|
1263
|
+
/* This machine's check-in, recorded with the save when the service can (machine.ts). */
|
|
1264
|
+
if (link?.repositoryId && !node_process_1.default.env.CODEROOK_NO_PRESENCE) {
|
|
1265
|
+
Object.assign(uploadRequest, {
|
|
1266
|
+
presence: await (0, machine_js_1.checkInBody)({ kind: "folder", folder, track: link.track ?? null, changedFiles: 0 }),
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1204
1269
|
/*
|
|
1205
1270
|
Whether this is walking into a merge, asked before anything is sent.
|
|
1206
1271
|
|
|
@@ -1211,9 +1276,26 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1211
1276
|
publish lands and the publish path decides for real, so this says what is
|
|
1212
1277
|
coming and gets out of the way.
|
|
1213
1278
|
*/
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1279
|
+
/*
|
|
1280
|
+
Asked while the upload is planned, not before: it is a round trip of its
|
|
1281
|
+
own, and nothing in the plan depends on it. Said before anything is sent.
|
|
1282
|
+
*/
|
|
1283
|
+
const aheadAnswer = link?.repositoryId && link.baseVersionId
|
|
1284
|
+
? (0, api_js_1.collisionCheck)(link.repositoryId, link.baseVersionId, files.filter((file) => !file.deleted).map((file) => file.path)).catch(() => null)
|
|
1285
|
+
: Promise.resolve(null);
|
|
1286
|
+
let aheadSaid = false;
|
|
1287
|
+
const sayAhead = async () => {
|
|
1288
|
+
if (aheadSaid)
|
|
1289
|
+
return;
|
|
1290
|
+
aheadSaid = true;
|
|
1291
|
+
const ahead = await aheadAnswer;
|
|
1292
|
+
/*
|
|
1293
|
+
Advice that cannot be fetched is not a reason to refuse a publish.
|
|
1294
|
+
The service checks properly at the point it matters.
|
|
1295
|
+
*/
|
|
1296
|
+
if (!ahead)
|
|
1297
|
+
return;
|
|
1298
|
+
{
|
|
1217
1299
|
if (ahead.collidingPaths.length) {
|
|
1218
1300
|
/*
|
|
1219
1301
|
"1 of your file is" — the plural was on the wrong noun. It is one
|
|
@@ -1248,13 +1330,7 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1248
1330
|
console.log("");
|
|
1249
1331
|
}
|
|
1250
1332
|
}
|
|
1251
|
-
|
|
1252
|
-
/*
|
|
1253
|
-
Advice that cannot be fetched is not a reason to refuse a publish.
|
|
1254
|
-
The service checks properly at the point it matters.
|
|
1255
|
-
*/
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1333
|
+
};
|
|
1258
1334
|
let result;
|
|
1259
1335
|
/*
|
|
1260
1336
|
How long to wait before picking a dropped upload up again by itself.
|
|
@@ -1294,6 +1370,7 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1294
1370
|
? dim("No monthly upload steps on this plan; the storage limit is the only one.")
|
|
1295
1371
|
: dim(`Monthly stage ${plan.allowance.stage}: ${plan.allowance.unlockedPercent}% unlocked, ` +
|
|
1296
1372
|
`${bytes(plan.allowance.remainingBytes)} remains after this reservation.`));
|
|
1373
|
+
await sayAhead();
|
|
1297
1374
|
if (dryRun) {
|
|
1298
1375
|
await uploader.cancelPlan(plan, true);
|
|
1299
1376
|
const going = files.filter((file) => !file.deleted);
|
|
@@ -1306,12 +1383,14 @@ Pass ${accent("--allow-secrets")} if these are not real keys.`);
|
|
|
1306
1383
|
for (const file of removing)
|
|
1307
1384
|
console.log(` ${red("deleted")} ${file.path}`);
|
|
1308
1385
|
}
|
|
1309
|
-
noteKeptDeletions(folder, baseline, hasFlag(parsed, "sync"));
|
|
1386
|
+
noteKeptDeletions(folder, baseline, hasFlag(parsed, "sync"), seen);
|
|
1310
1387
|
console.log("Nothing was uploaded and no Version was created.");
|
|
1311
1388
|
return 0;
|
|
1312
1389
|
}
|
|
1313
1390
|
result = await uploader.execute(uploadRequest, plan, (progress) => uploadDisplay.report(progress));
|
|
1314
1391
|
uploadDisplay.done();
|
|
1392
|
+
if (result.presenceRecorded)
|
|
1393
|
+
(0, machine_js_1.markCheckedIn)(result.repositoryId);
|
|
1315
1394
|
break;
|
|
1316
1395
|
}
|
|
1317
1396
|
catch (error) {
|
|
@@ -1460,7 +1539,7 @@ The connection failed: ${text}`));
|
|
|
1460
1539
|
command does not do.
|
|
1461
1540
|
*/
|
|
1462
1541
|
` · the save holds ${bytes(result.sourceBytes)}`);
|
|
1463
|
-
noteKeptDeletions(folder, baseline, hasFlag(parsed, "sync"));
|
|
1542
|
+
noteKeptDeletions(folder, baseline, hasFlag(parsed, "sync"), seen);
|
|
1464
1543
|
noteGitRoute(folder, link?.slug ?? adopt?.slug ?? (0, folder_match_js_1.slugFor)(flagText(parsed, "name") ?? node_path_1.default.basename(folder)));
|
|
1465
1544
|
/*
|
|
1466
1545
|
Where the time went, when asked for.
|
|
@@ -2363,6 +2442,7 @@ const SPECS = [
|
|
|
2363
2442
|
options: [
|
|
2364
2443
|
{ flags: "--token <value>", description: "supply it instead of being asked" },
|
|
2365
2444
|
],
|
|
2445
|
+
examples: ["cbx sign-in", "cbx sign-in --token \"$CODEROOK_TOKEN\""],
|
|
2366
2446
|
run: commandSignIn,
|
|
2367
2447
|
},
|
|
2368
2448
|
{
|
|
@@ -2370,6 +2450,8 @@ const SPECS = [
|
|
|
2370
2450
|
group: "Getting started",
|
|
2371
2451
|
summary: "who this machine is signed in as",
|
|
2372
2452
|
usage: "whoami",
|
|
2453
|
+
detail: "Prints the account this machine's token belongs to, its email and its plan. Worth a look before a save, to be sure which account it goes to.",
|
|
2454
|
+
examples: ["cbx whoami"],
|
|
2373
2455
|
run: () => commandWhoami(),
|
|
2374
2456
|
},
|
|
2375
2457
|
{
|
|
@@ -2378,6 +2460,8 @@ const SPECS = [
|
|
|
2378
2460
|
group: "Getting started",
|
|
2379
2461
|
summary: "forget the token on this machine",
|
|
2380
2462
|
usage: "sign-out",
|
|
2463
|
+
detail: "Removes the stored token from this machine. Folders stay linked to their projects. The token itself keeps working anywhere else it is used until you revoke it with cbx tokens --revoke.",
|
|
2464
|
+
examples: ["cbx sign-out"],
|
|
2381
2465
|
run: commandSignOut,
|
|
2382
2466
|
},
|
|
2383
2467
|
{
|
|
@@ -2389,6 +2473,7 @@ const SPECS = [
|
|
|
2389
2473
|
"changed. Says nothing about other people's work — use `merges` for that.\n\n" +
|
|
2390
2474
|
"In a folder with a history of its own (see `cbx init`), compares\n" +
|
|
2391
2475
|
"against the last local save instead.",
|
|
2476
|
+
examples: ["cbx status", "cbx status ../other-game"],
|
|
2392
2477
|
run: (0, local_commands_js_1.localFirst)(local_commands_js_1.localStatus, commandStatus, (parsed) => folderFor(parsed)),
|
|
2393
2478
|
},
|
|
2394
2479
|
{
|
|
@@ -2469,6 +2554,7 @@ const SPECS = [
|
|
|
2469
2554
|
{ flags: "--project <name>", description: "which project" },
|
|
2470
2555
|
],
|
|
2471
2556
|
examples: ["cbx diff", "cbx diff 12", "cbx diff 11 12 --name-only", "cbx diff main~1 main"],
|
|
2557
|
+
arguments: { "[from]": "a save to compare against: 12, v12, a line (main) or main~1; left out, the save this folder is on", "[to]": "a second save; given, the two saves are compared with each other instead of with this folder" },
|
|
2472
2558
|
run: (0, local_commands_js_1.localFirst)(local_commands_js_1.localDiff, diff_command_js_1.commandDiff),
|
|
2473
2559
|
},
|
|
2474
2560
|
{
|
|
@@ -2518,6 +2604,7 @@ const SPECS = [
|
|
|
2518
2604
|
{ flags: "--notes", description: "on CodeRook: print what each one says about itself" },
|
|
2519
2605
|
],
|
|
2520
2606
|
examples: ["cbx log", "cbx log feature --limit 5"],
|
|
2607
|
+
arguments: { "[from]": "a line or a save to start from; left out, the line this folder is on" },
|
|
2521
2608
|
run: (0, local_commands_js_1.localFirst)(local_commands_js_1.localLog, project_commands_js_1.commandVersions),
|
|
2522
2609
|
},
|
|
2523
2610
|
{
|
|
@@ -2681,6 +2768,7 @@ const SPECS = [
|
|
|
2681
2768
|
{ flags: "-n, --new", description: "start this line from where the project is now" },
|
|
2682
2769
|
],
|
|
2683
2770
|
examples: ["cbx track", "cbx track spike --new", "cbx track main"],
|
|
2771
|
+
arguments: { "[name]": "the line to save to from now on; left out, shows the one in use" },
|
|
2684
2772
|
run: track_commands_js_1.commandTrack,
|
|
2685
2773
|
},
|
|
2686
2774
|
{
|
|
@@ -2704,6 +2792,8 @@ const SPECS = [
|
|
|
2704
2792
|
options: [
|
|
2705
2793
|
{ flags: "--replace", description: "make it an exact copy, discarding local changes" },
|
|
2706
2794
|
],
|
|
2795
|
+
detail: "Fetches what has been saved to the project since this folder last saved or fetched. Files you changed here that nobody else changed are kept as they are. --replace makes the folder an exact copy of the saved version instead, throwing away changes made here.",
|
|
2796
|
+
examples: ["cbx get", "cbx get ../other-game", "cbx get --replace"],
|
|
2707
2797
|
run: announcing(commandGet, false),
|
|
2708
2798
|
},
|
|
2709
2799
|
{
|
|
@@ -2718,6 +2808,7 @@ const SPECS = [
|
|
|
2718
2808
|
},
|
|
2719
2809
|
],
|
|
2720
2810
|
examples: ["cbx clone my-project", "cbx clone my-project --track spike"],
|
|
2811
|
+
detail: "Makes a new folder, fetches the project's newest version into it and links the folder to the project, so status, submit and get work there straight away.",
|
|
2721
2812
|
run: commandClone,
|
|
2722
2813
|
},
|
|
2723
2814
|
{
|
|
@@ -2748,6 +2839,7 @@ const SPECS = [
|
|
|
2748
2839
|
},
|
|
2749
2840
|
],
|
|
2750
2841
|
examples: ["cbx licence", "cbx licence MIT", "cbx licence Apache-2.0"],
|
|
2842
|
+
arguments: { "[name]": "a licence as the list names it (MIT, Apache-2.0); left out, lists them" },
|
|
2751
2843
|
run: licence_commands_js_1.commandLicence,
|
|
2752
2844
|
},
|
|
2753
2845
|
{
|
|
@@ -2774,6 +2866,7 @@ const SPECS = [
|
|
|
2774
2866
|
description: "add a ready-made set of rules; `list` shows all 309 of them",
|
|
2775
2867
|
},
|
|
2776
2868
|
],
|
|
2869
|
+
examples: ["cbx ignore", "cbx ignore --init", "cbx ignore --suggest --apply", "cbx ignore --template list", "cbx ignore --template Unity"],
|
|
2777
2870
|
run: (parsed) =>
|
|
2778
2871
|
/*
|
|
2779
2872
|
Two commands under one name, because they are one question. Somebody
|
|
@@ -2790,6 +2883,8 @@ const SPECS = [
|
|
|
2790
2883
|
group: "Getting started",
|
|
2791
2884
|
summary: "every project on your account",
|
|
2792
2885
|
usage: "projects",
|
|
2886
|
+
detail: "One line per project on your account: its name, how many saves it has, how many files, how much it stores and who can see it.",
|
|
2887
|
+
examples: ["cbx projects"],
|
|
2793
2888
|
run: () => commandProjects(),
|
|
2794
2889
|
},
|
|
2795
2890
|
{
|
|
@@ -2852,6 +2947,7 @@ const SPECS = [
|
|
|
2852
2947
|
{ flags: "--interval <seconds>", description: "watch: how often to look (default 20, at least 5)" },
|
|
2853
2948
|
],
|
|
2854
2949
|
examples: ["cbx workspace open my-project --name \"Laptop work\" --key laptop-open-001", "cbx workspace list my-project", "cbx workspace assign my-project <draft> --name Laptop", "cbx workspace checkout my-project <draft>", "cbx workspace push --save -m \"Fix the export dialog\"", "cbx workspace", "cbx workspace say my-project <draft> -m \"Tests updated\" --as GrokBot", "cbx workspace thread my-project <draft> --unread", "cbx workspace watch my-project --as GrokBot --json", "cbx workspace put my-project <draft> website/app/page.tsx website/public/og.png", "cbx workspace starter my-project --apply", "cbx workspace review my-project <draft> --ok -m \"Matches the concept\""],
|
|
2950
|
+
arguments: { "[job]": "a job's name inside a run, for logs and cancel" },
|
|
2855
2951
|
run: workspace_command_js_1.commandWorkspace,
|
|
2856
2952
|
},
|
|
2857
2953
|
{
|
|
@@ -2910,6 +3006,7 @@ const SPECS = [
|
|
|
2910
3006
|
"cbx visibility unlisted my-project --yes",
|
|
2911
3007
|
"cbx visibility private my-project",
|
|
2912
3008
|
],
|
|
3009
|
+
arguments: { "[level]": "public, unlisted (link only) or private; left out, shows the current level" },
|
|
2913
3010
|
run: project_commands_js_1.commandVisibility,
|
|
2914
3011
|
},
|
|
2915
3012
|
{
|
|
@@ -3283,6 +3380,7 @@ const SPECS = [
|
|
|
3283
3380
|
'cbx issue rules add welcome -m "Thanks — we read every report."',
|
|
3284
3381
|
"cbx issue rules off 2",
|
|
3285
3382
|
],
|
|
3383
|
+
arguments: { "<number>": "the issue's number (12)", "<name>": "a label's name", "<kind>": "the kind of rule to add (auto-label, welcome)", "<n>": "the rule's number, as cbx issue rules lists it" },
|
|
3286
3384
|
run: issue_command_js_1.commandIssue,
|
|
3287
3385
|
},
|
|
3288
3386
|
{
|
|
@@ -3295,6 +3393,7 @@ const SPECS = [
|
|
|
3295
3393
|
"downloads), downloads public (the source stays private) or private.\n" +
|
|
3296
3394
|
"For a public project it also prints the addresses an app or a script\n" +
|
|
3297
3395
|
"reads them from, which need no account.",
|
|
3396
|
+
examples: ["cbx releases", "cbx releases my-game"],
|
|
3298
3397
|
run: service_commands_js_1.commandReleases,
|
|
3299
3398
|
},
|
|
3300
3399
|
{
|
|
@@ -3505,6 +3604,7 @@ const SPECS = [
|
|
|
3505
3604
|
"cbx labels add urgent #e0574a",
|
|
3506
3605
|
"cbx labels remove shipped",
|
|
3507
3606
|
],
|
|
3607
|
+
arguments: { "[name]": "the label's name (shipped)", "[colour]": "a colour, by name (green) or as hex (#e0574a)" },
|
|
3508
3608
|
run: version_commands_js_1.commandLabels,
|
|
3509
3609
|
},
|
|
3510
3610
|
{
|
|
@@ -3516,6 +3616,7 @@ const SPECS = [
|
|
|
3516
3616
|
detail: "A project can be set to hold pushes from anyone below admin until an\n" +
|
|
3517
3617
|
"admin accepts them. Those versions are real and stored — they are just\n" +
|
|
3518
3618
|
"not the current version, and not on the public page.",
|
|
3619
|
+
examples: ["cbx held", "cbx held my-game"],
|
|
3519
3620
|
run: version_commands_js_1.commandHeld,
|
|
3520
3621
|
},
|
|
3521
3622
|
{
|
|
@@ -3536,6 +3637,7 @@ const SPECS = [
|
|
|
3536
3637
|
"cbx review 41 --approve",
|
|
3537
3638
|
'cbx review 41 --decline --note "wrong branch"',
|
|
3538
3639
|
],
|
|
3640
|
+
detail: "A project can hold saves from people below admin until an admin decides; cbx held lists them. --approve makes the save the project's current version. --decline turns it down, and --note says why.",
|
|
3539
3641
|
run: version_commands_js_1.commandReview,
|
|
3540
3642
|
},
|
|
3541
3643
|
{
|
|
@@ -3555,6 +3657,7 @@ const SPECS = [
|
|
|
3555
3657
|
{ flags: "--yes", description: "confirm; without it nothing happens" },
|
|
3556
3658
|
{ flags: "--reason <text>", description: "recorded against the gap" },
|
|
3557
3659
|
],
|
|
3660
|
+
examples: ["cbx take-down 12 --yes --reason \"API key in config.json\""],
|
|
3558
3661
|
run: version_commands_js_1.commandTakeDown,
|
|
3559
3662
|
},
|
|
3560
3663
|
{
|
|
@@ -3596,6 +3699,7 @@ const SPECS = [
|
|
|
3596
3699
|
"cbx release 1.4.0 --downloads public",
|
|
3597
3700
|
"cbx release --downloads private --version 41",
|
|
3598
3701
|
],
|
|
3702
|
+
arguments: { "<name>": "the release's name (v1.0, 2.1.0-beta.1)" },
|
|
3599
3703
|
run: service_commands_js_1.commandRelease,
|
|
3600
3704
|
},
|
|
3601
3705
|
{
|
|
@@ -3652,6 +3756,7 @@ const SPECS = [
|
|
|
3652
3756
|
"cbx security policy",
|
|
3653
3757
|
"cbx security policy --on --text SECURITY.md",
|
|
3654
3758
|
],
|
|
3759
|
+
arguments: { "<owner/project>": "the project to report to, as owner/name", "<n>": "the report's number, after S- (S-3)" },
|
|
3655
3760
|
run: community_command_js_1.commandSecurity,
|
|
3656
3761
|
},
|
|
3657
3762
|
{
|
|
@@ -3864,6 +3969,7 @@ const SPECS = [
|
|
|
3864
3969
|
"service keeps deleted projects for 30 days before reclaiming the\n" +
|
|
3865
3970
|
"storage, so a mistake made today is recoverable this month.",
|
|
3866
3971
|
options: [{ flags: "--yes", description: "skip the confirmation" }],
|
|
3972
|
+
examples: ["cbx delete old-prototype"],
|
|
3867
3973
|
run: service_commands_js_1.commandDelete,
|
|
3868
3974
|
},
|
|
3869
3975
|
{
|
|
@@ -3905,6 +4011,8 @@ const SPECS = [
|
|
|
3905
4011
|
{ flags: "--email [off]", description: "include it in the daily email" },
|
|
3906
4012
|
{ flags: "--discussions <all|off>", description: "whether workspace messages reach your notifications" },
|
|
3907
4013
|
],
|
|
4014
|
+
detail: "With no options, shows what reaches you about the project. --level chooses which events notify you. --email adds them to the daily email; --email off takes them out again.",
|
|
4015
|
+
examples: ["cbx watch", "cbx watch my-game --level releases", "cbx watch my-game --email", "cbx watch my-game --email off"],
|
|
3908
4016
|
run: service_commands_js_1.commandWatch,
|
|
3909
4017
|
},
|
|
3910
4018
|
{
|
|
@@ -3916,6 +4024,7 @@ const SPECS = [
|
|
|
3916
4024
|
"how you find one that is no longer needed. Create new ones on the\n" +
|
|
3917
4025
|
"website; they are only shown once.",
|
|
3918
4026
|
options: [{ flags: "--revoke <id>", description: "stop one working now" }],
|
|
4027
|
+
examples: ["cbx tokens", "cbx tokens --revoke <id>"],
|
|
3919
4028
|
run: service_commands_js_1.commandTokens,
|
|
3920
4029
|
},
|
|
3921
4030
|
{
|
|
@@ -3934,6 +4043,7 @@ const SPECS = [
|
|
|
3934
4043
|
"Files both sides changed are combined line by line where they can be;\n" +
|
|
3935
4044
|
"the rest wait for a decision in cbx merge. \"Fixes #12\" in the title or\n" +
|
|
3936
4045
|
"body closes issue 12 when the proposal lands.",
|
|
4046
|
+
examples: ["cbx propose -m \"New pathfinding\"", "cbx propose -m \"Fixes #12: crash on load\" --body \"Guards the empty save case\"", "cbx propose -m \"Release prep\" --into release"],
|
|
3937
4047
|
run: commandPropose,
|
|
3938
4048
|
},
|
|
3939
4049
|
{
|
|
@@ -3942,6 +4052,8 @@ const SPECS = [
|
|
|
3942
4052
|
summary: "open proposals on this project",
|
|
3943
4053
|
usage: "proposals [--all] [folder]",
|
|
3944
4054
|
options: [{ flags: "--all", description: "include merged and cancelled ones" }],
|
|
4055
|
+
detail: "Lists the proposals on the project this folder is linked to: each one's reference, the line it comes from and goes to, its title, and how many files still need a decision. Run cbx merge <reference> to look at one.",
|
|
4056
|
+
examples: ["cbx proposals", "cbx proposals --all"],
|
|
3945
4057
|
run: commandProposals,
|
|
3946
4058
|
},
|
|
3947
4059
|
{
|
|
@@ -3951,6 +4063,7 @@ const SPECS = [
|
|
|
3951
4063
|
usage: "merges [folder]",
|
|
3952
4064
|
detail: "Both merge commands read the project this folder is linked to, so run\n" +
|
|
3953
4065
|
"them from a working copy — or name one.",
|
|
4066
|
+
examples: ["cbx merges", "cbx merges ../other-game"],
|
|
3954
4067
|
run: commandMerges,
|
|
3955
4068
|
},
|
|
3956
4069
|
{
|
|
@@ -3975,6 +4088,7 @@ const SPECS = [
|
|
|
3975
4088
|
{ flags: "--cancel", description: "call the merge off; your upload stays stored" },
|
|
3976
4089
|
{ flags: "--ask <usernames>", description: "ask people to review it, comma separated" },
|
|
3977
4090
|
],
|
|
4091
|
+
examples: ["cbx merge spike", "cbx merge M-3", "cbx merge M-3 --path src/save.c --mine", "cbx merge M-3 --cancel"],
|
|
3978
4092
|
run: (0, local_commands_js_1.localFirst)(local_commands_js_1.localMerge, commandMerge),
|
|
3979
4093
|
},
|
|
3980
4094
|
{
|
|
@@ -3982,6 +4096,8 @@ const SPECS = [
|
|
|
3982
4096
|
group: "Mods and bundles",
|
|
3983
4097
|
summary: "pack the project as a .cbx",
|
|
3984
4098
|
usage: "bundle [folder] [out]",
|
|
4099
|
+
detail: "Packs the folder's files into one .cbx file you can copy, archive or send to somebody without an account. What the ignore rules leave out stays out. Unpack it with cbx unbundle.",
|
|
4100
|
+
examples: ["cbx bundle", "cbx bundle . ../backups/my-game.cbx"],
|
|
3985
4101
|
run: commandBundle,
|
|
3986
4102
|
},
|
|
3987
4103
|
{
|
|
@@ -3989,6 +4105,8 @@ const SPECS = [
|
|
|
3989
4105
|
group: "Mods and bundles",
|
|
3990
4106
|
summary: "extract a .cbx",
|
|
3991
4107
|
usage: "unbundle <file> [dir]",
|
|
4108
|
+
detail: "Unpacks a .cbx made by cbx bundle into a new folder, named after the folder it was made from unless you give one.",
|
|
4109
|
+
examples: ["cbx unbundle my-game.cbx", "cbx unbundle my-game.cbx restored-game"],
|
|
3992
4110
|
run: commandUnbundle,
|
|
3993
4111
|
},
|
|
3994
4112
|
{
|
|
@@ -3997,6 +4115,8 @@ const SPECS = [
|
|
|
3997
4115
|
summary: "what a .cbx contains",
|
|
3998
4116
|
usage: "inspect <file>",
|
|
3999
4117
|
options: [{ flags: "--files", description: "list every file inside" }],
|
|
4118
|
+
detail: "Shows what a .cbx holds without unpacking it. --files lists every file inside.",
|
|
4119
|
+
examples: ["cbx inspect my-game.cbx", "cbx inspect my-game.cbx --files"],
|
|
4000
4120
|
run: commandInspect,
|
|
4001
4121
|
},
|
|
4002
4122
|
{
|
|
@@ -4015,6 +4135,21 @@ const SPECS = [
|
|
|
4015
4135
|
examples: ["cbx runner my-game --labels windows,signing"],
|
|
4016
4136
|
run: commandRunner,
|
|
4017
4137
|
},
|
|
4138
|
+
{
|
|
4139
|
+
name: "power",
|
|
4140
|
+
aliases: ["runner-power"],
|
|
4141
|
+
group: "Actions and builds",
|
|
4142
|
+
summary: "how big a machine your hosted and workspace runs get",
|
|
4143
|
+
usage: "power [standard|fast|max]",
|
|
4144
|
+
detail: "With no level, shows the one your account uses and what each costs. With one, switches to it: the same\n" +
|
|
4145
|
+
"setting as Runner power on the website's Billing page. It applies to hosted and workspace runs on every\n" +
|
|
4146
|
+
"project you pay for. More power finishes sooner and uses credits faster each minute, billed by the second.\n" +
|
|
4147
|
+
"A run already going keeps its machine. Free and trial accounts run on Standard.",
|
|
4148
|
+
arguments: { "[standard|fast|max]": "the level to switch to; left out, shows the one in use and what each costs" },
|
|
4149
|
+
options: [{ flags: "--json", description: "print the levels and your choice as JSON" }],
|
|
4150
|
+
examples: ["cbx power", "cbx power fast", "cbx power standard"],
|
|
4151
|
+
run: commandPower,
|
|
4152
|
+
},
|
|
4018
4153
|
{
|
|
4019
4154
|
/*
|
|
4020
4155
|
The other way to hand this to an assistant is a plugin marketplace,
|
|
@@ -4103,6 +4238,8 @@ const SPECS = [
|
|
|
4103
4238
|
group: "Getting started",
|
|
4104
4239
|
summary: "check the service, config and sign-in",
|
|
4105
4240
|
usage: "doctor",
|
|
4241
|
+
detail: "Prints this cbx's version, where its settings are kept, whether the service answers and which account this machine is signed in as. The first thing to run when something does not work.",
|
|
4242
|
+
examples: ["cbx doctor"],
|
|
4106
4243
|
run: () => commandDoctor(),
|
|
4107
4244
|
},
|
|
4108
4245
|
];
|
package/dist/cli/src/help.js
CHANGED
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
* afford whole sentences and examples.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.listedUsage = exports.USAGE_COLUMN = void 0;
|
|
18
|
+
exports.ALL_COMMANDS_HEADING = exports.listedUsage = exports.USAGE_COLUMN = void 0;
|
|
19
19
|
exports.renderHelp = renderHelp;
|
|
20
|
+
exports.explainArgument = explainArgument;
|
|
21
|
+
exports.unexplainedArguments = unexplainedArguments;
|
|
20
22
|
exports.renderCommandHelp = renderCommandHelp;
|
|
21
23
|
exports.renderUnknown = renderUnknown;
|
|
22
24
|
const registry_js_1 = require("./registry.js");
|
|
@@ -35,11 +37,50 @@ function rank(spec, declared) {
|
|
|
35
37
|
const at = registry_js_1.LISTING_ORDER.indexOf(spec.name);
|
|
36
38
|
return at === -1 ? registry_js_1.LISTING_ORDER.length + declared : at;
|
|
37
39
|
}
|
|
40
|
+
/*
|
|
41
|
+
The five things nearly everybody does, written out in full, before the list
|
|
42
|
+
of everything. The list is long because CodeRook does a lot, and somebody
|
|
43
|
+
looking for how to save their work with a message had to find `submit` in
|
|
44
|
+
the second group and then guess that `-m` takes the message (owner,
|
|
45
|
+
2026-11-10: "couldn't see how to do submit with comments or arguments").
|
|
46
|
+
*/
|
|
47
|
+
const START_HERE = [
|
|
48
|
+
["cbx sign-in", "connect this machine to your account (once)"],
|
|
49
|
+
["cbx clone <project>", "fetch a project into a new folder"],
|
|
50
|
+
["cbx status", "what changed here since the last save"],
|
|
51
|
+
['cbx submit -m "What changed"', "save the changes, with a message saying what"],
|
|
52
|
+
["cbx get", "bring this folder up to date with CodeRook"],
|
|
53
|
+
];
|
|
54
|
+
/* How a usage line is written, said once so every line below can be read. */
|
|
55
|
+
const READING = [
|
|
56
|
+
["<project>", "angle brackets: you must give it"],
|
|
57
|
+
["[folder]", "square brackets: you may leave it out"],
|
|
58
|
+
["a|b", "one of these words"],
|
|
59
|
+
['-m "Fix the menu"', "a message: in quotes whenever it has spaces"],
|
|
60
|
+
["--track spike", "an option and its value (--track=spike works too)"],
|
|
61
|
+
["cbx help submit", "everything one command takes, with examples"],
|
|
62
|
+
["cbx submit --help", "the same, from the command itself"],
|
|
63
|
+
];
|
|
64
|
+
/** Two aligned columns, indented like the rest of the help. */
|
|
65
|
+
function pairs(rows, colour) {
|
|
66
|
+
const width = rows.reduce((widest, [left]) => Math.max(widest, left.length), 0);
|
|
67
|
+
return rows.map(([left, right]) => ` ${colour(left.padEnd(width))} ${right}`);
|
|
68
|
+
}
|
|
69
|
+
/** The line that separates the introduction from the list of every command. */
|
|
70
|
+
exports.ALL_COMMANDS_HEADING = "Every command, by what you want to do";
|
|
38
71
|
function renderHelp(registry, version) {
|
|
39
72
|
const listed = registry.specs.filter((spec) => !spec.deprecatedBy);
|
|
40
73
|
const column = Math.min(nameColumn(listed), exports.USAGE_COLUMN);
|
|
41
74
|
const lines = [
|
|
42
|
-
`${(0, colour_js_1.bold)("cbx")} ${(0, colour_js_1.dim)(version)} —
|
|
75
|
+
`${(0, colour_js_1.bold)("cbx")} ${(0, colour_js_1.dim)(version)} — save, share and run your projects on CodeRook`,
|
|
76
|
+
"",
|
|
77
|
+
(0, colour_js_1.bold)("Start here"),
|
|
78
|
+
...pairs(START_HERE, colour_js_1.accent),
|
|
79
|
+
"",
|
|
80
|
+
(0, colour_js_1.bold)("How commands are written"),
|
|
81
|
+
...pairs(READING, colour_js_1.accent),
|
|
82
|
+
"",
|
|
83
|
+
(0, colour_js_1.bold)(exports.ALL_COMMANDS_HEADING),
|
|
43
84
|
"",
|
|
44
85
|
];
|
|
45
86
|
for (const group of registry_js_1.GROUP_ORDER) {
|
|
@@ -56,9 +97,73 @@ function renderHelp(registry, version) {
|
|
|
56
97
|
}
|
|
57
98
|
lines.push("");
|
|
58
99
|
}
|
|
59
|
-
lines.push((0, colour_js_1.dim)("cbx help <command> the full usage, options and examples for one command"), (0, colour_js_1.dim)("CODEROOK_TOKEN used instead of the stored sign-in, for automated runs"), (0, colour_js_1.dim)("CODEROOK_API_URL point at another service"));
|
|
100
|
+
lines.push((0, colour_js_1.dim)("cbx help <command> the full usage, arguments, options and examples for one command"), (0, colour_js_1.dim)("CODEROOK_TOKEN used instead of the stored sign-in, for automated runs"), (0, colour_js_1.dim)("CODEROOK_API_URL point at another service"));
|
|
60
101
|
return lines.join("\n");
|
|
61
102
|
}
|
|
103
|
+
/*
|
|
104
|
+
What each word in angle or square brackets means, said the same way on every
|
|
105
|
+
command's page. A command whose word means something else there names it in
|
|
106
|
+
its own `arguments`, which wins.
|
|
107
|
+
*/
|
|
108
|
+
const MEANINGS = {
|
|
109
|
+
project: { what: "a project on your account, by name (my-game) or as owner/name", leftOut: "the project this folder is linked to" },
|
|
110
|
+
folder: { what: "a folder on this machine", leftOut: "the folder you are in" },
|
|
111
|
+
dir: { what: "the folder to create", leftOut: "one named after what is being fetched" },
|
|
112
|
+
out: { what: "the file to write", leftOut: "the folder's name with .cbx, beside it" },
|
|
113
|
+
n: { what: "a save's number, as cbx versions shows it (12 or v12)", leftOut: "the newest save" },
|
|
114
|
+
number: { what: "the number cbx runs shows for a run (12 or #12)" },
|
|
115
|
+
line: { what: "a line of work, as cbx tracks lists them (main, spike)", leftOut: "the line this folder saves to" },
|
|
116
|
+
file: { what: "a file on this machine" },
|
|
117
|
+
"file…": { what: "one or more files on this machine" },
|
|
118
|
+
"paths…": { what: "one or more files or folders inside the project", leftOut: "everything" },
|
|
119
|
+
"path…": { what: "one or more paths inside the project" },
|
|
120
|
+
"pattern…": { what: "one or more paths or patterns, like art/ or *.psd" },
|
|
121
|
+
"owner/project": { what: "somebody's project, as owner/name (sam/encoder)" },
|
|
122
|
+
address: { what: "the project's web address on the other host" },
|
|
123
|
+
workspace: { what: "a draft's id, as cbx workspace list shows it" },
|
|
124
|
+
version: { what: "a save's number (12 or v12)", leftOut: "the newest save" },
|
|
125
|
+
release: { what: "a release's name, as cbx releases lists it (1.2)" },
|
|
126
|
+
"M-3": { what: "a pull request's reference, as cbx pr list shows it" },
|
|
127
|
+
NAME: { what: "the secret's name, as runs read it (API_KEY)" },
|
|
128
|
+
};
|
|
129
|
+
/** The words a usage line asks for, as written there: "<project>", "[folder]", "<a|b>". */
|
|
130
|
+
function argumentTokens(usage) {
|
|
131
|
+
const tokens = [];
|
|
132
|
+
/* An option and its value ("--name <text>", "--on|--off") is explained under Options. */
|
|
133
|
+
const words = usage.replace(/--?[A-Za-z][\w-]*(?:\|--?[A-Za-z][\w-]*)*(?:\s+(?:<[^<>]*>|[\w,.|-]+(?=\])))?/g, "");
|
|
134
|
+
for (const match of words.matchAll(/[<[]([^<>[\]]+)[>\]]/g)) {
|
|
135
|
+
const whole = match[0];
|
|
136
|
+
const inner = match[1].trim();
|
|
137
|
+
/* Options are explained under Options; a fragment with spaces is part of one. */
|
|
138
|
+
if (inner.startsWith("-") || (/\s/.test(inner) && !inner.includes("|")))
|
|
139
|
+
continue;
|
|
140
|
+
if (!tokens.includes(whole))
|
|
141
|
+
tokens.push(whole);
|
|
142
|
+
}
|
|
143
|
+
return tokens;
|
|
144
|
+
}
|
|
145
|
+
/** What one usage word means, or null for a word nothing here can explain. */
|
|
146
|
+
function explainArgument(token, spec) {
|
|
147
|
+
const own = spec.arguments?.[token];
|
|
148
|
+
if (own)
|
|
149
|
+
return own;
|
|
150
|
+
const optional = token.startsWith("[");
|
|
151
|
+
const inner = token.slice(1, -1).trim();
|
|
152
|
+
if (inner.includes("|")) {
|
|
153
|
+
const choices = inner.split("|").map((choice) => choice.trim()).filter(Boolean);
|
|
154
|
+
return `${optional ? "optionally " : ""}one of: ${choices.join(", ")}`;
|
|
155
|
+
}
|
|
156
|
+
const meaning = MEANINGS[inner];
|
|
157
|
+
if (!meaning)
|
|
158
|
+
return null;
|
|
159
|
+
if (!optional)
|
|
160
|
+
return meaning.what;
|
|
161
|
+
return meaning.leftOut ? `${meaning.what}; left out, ${meaning.leftOut}` : `${meaning.what}; may be left out`;
|
|
162
|
+
}
|
|
163
|
+
/** Every usage word the help cannot explain, for the test that keeps it complete. */
|
|
164
|
+
function unexplainedArguments(spec) {
|
|
165
|
+
return argumentTokens(spec.usage).filter((token) => !explainArgument(token, spec));
|
|
166
|
+
}
|
|
62
167
|
function renderCommandHelp(spec) {
|
|
63
168
|
const lines = [
|
|
64
169
|
`${(0, colour_js_1.bold)("cbx " + spec.name)} — ${spec.summary}`,
|
|
@@ -66,8 +171,17 @@ function renderCommandHelp(spec) {
|
|
|
66
171
|
(0, colour_js_1.bold)("Usage"),
|
|
67
172
|
` cbx ${spec.usage}`,
|
|
68
173
|
];
|
|
174
|
+
const words = argumentTokens(spec.usage)
|
|
175
|
+
.map((token) => [token, explainArgument(token, spec)])
|
|
176
|
+
.filter((row) => Boolean(row[1]));
|
|
177
|
+
if (words.length) {
|
|
178
|
+
const width = words.reduce((widest, [token]) => Math.max(widest, token.length), 0);
|
|
179
|
+
lines.push("", (0, colour_js_1.bold)("Arguments"));
|
|
180
|
+
for (const [token, meaning] of words)
|
|
181
|
+
lines.push(` ${token.padEnd(width)} ${meaning}`);
|
|
182
|
+
}
|
|
69
183
|
if (spec.aliases?.length) {
|
|
70
|
-
lines.push("", (0, colour_js_1.bold)("Also"), ` ${spec.aliases.map((alias) => `cbx ${alias}`).join(" ")}`);
|
|
184
|
+
lines.push("", (0, colour_js_1.bold)("Also called"), ` ${spec.aliases.map((alias) => `cbx ${alias}`).join(" ")}`);
|
|
71
185
|
}
|
|
72
186
|
if (spec.detail) {
|
|
73
187
|
lines.push("", spec.detail.trim());
|
|
@@ -84,6 +198,7 @@ function renderCommandHelp(spec) {
|
|
|
84
198
|
for (const example of spec.examples)
|
|
85
199
|
lines.push(` ${(0, colour_js_1.accent)(example)}`);
|
|
86
200
|
}
|
|
201
|
+
lines.push("", (0, colour_js_1.dim)("cbx help every command, and how commands are written"));
|
|
87
202
|
return lines.join("\n");
|
|
88
203
|
}
|
|
89
204
|
/**
|
package/dist/cli/src/machine.js
CHANGED
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.machineIdentity = machineIdentity;
|
|
7
|
+
exports.checkInBody = checkInBody;
|
|
8
|
+
exports.markCheckedIn = markCheckedIn;
|
|
7
9
|
exports.checkIn = checkIn;
|
|
8
10
|
/**
|
|
9
11
|
* This machine, as a project's Actions page shows it (backend machines.ts).
|
|
@@ -46,31 +48,46 @@ async function machineIdentity() {
|
|
|
46
48
|
cached = { id, name: (process.env.CODEROOK_MACHINE_NAME || (0, node_os_1.hostname)() || "This machine").slice(0, 120) };
|
|
47
49
|
return cached;
|
|
48
50
|
}
|
|
51
|
+
/** What a check-in says, as the service reads it (backend/src/machines.ts parseCheckIn). */
|
|
52
|
+
async function checkInBody(state) {
|
|
53
|
+
const me = await machineIdentity();
|
|
54
|
+
const client = (0, identify_js_1.clientHeaders)()["x-coderook-client"] ?? "";
|
|
55
|
+
return {
|
|
56
|
+
machineId: me.id,
|
|
57
|
+
name: me.name,
|
|
58
|
+
kind: state.kind,
|
|
59
|
+
platform: `${(0, node_os_1.platform)()} ${(0, node_os_1.release)()}`.slice(0, 80),
|
|
60
|
+
clientVersion: client.startsWith("cli/") ? client.slice(4) : null,
|
|
61
|
+
folderName: state.folder ? node_path_1.default.basename(node_path_1.default.resolve(state.folder)) : null,
|
|
62
|
+
track: state.track ?? null,
|
|
63
|
+
baseVersionId: state.baseVersionId ?? null,
|
|
64
|
+
changedFiles: state.changedFiles ?? null,
|
|
65
|
+
workspaceId: state.workspaceId ?? null,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/*
|
|
69
|
+
Projects a save has already checked this machine in to, as part of the save
|
|
70
|
+
itself (delta-save-v1 carries the check-in). The separate request after it
|
|
71
|
+
was half a second of every save, to say what the save had just said.
|
|
72
|
+
*/
|
|
73
|
+
const checkedIn = new Set();
|
|
74
|
+
function markCheckedIn(repositoryId) {
|
|
75
|
+
checkedIn.add(repositoryId);
|
|
76
|
+
}
|
|
49
77
|
/** Tell the project this machine is here. Never throws, and gives up after a moment. */
|
|
50
78
|
async function checkIn(repositoryId, state) {
|
|
51
79
|
if (!repositoryId || process.env.CODEROOK_NO_PRESENCE)
|
|
52
80
|
return;
|
|
81
|
+
if (checkedIn.has(repositoryId) && state.changedFiles === 0)
|
|
82
|
+
return;
|
|
53
83
|
try {
|
|
54
84
|
const token = await (0, config_js_1.loadToken)();
|
|
55
85
|
if (!token)
|
|
56
86
|
return;
|
|
57
|
-
const me = await machineIdentity();
|
|
58
|
-
const client = (0, identify_js_1.clientHeaders)()["x-coderook-client"] ?? "";
|
|
59
87
|
await fetch(`${(0, config_js_1.apiOrigin)()}/v1/repositories/${encodeURIComponent(repositoryId)}/machines`, {
|
|
60
88
|
method: "POST",
|
|
61
89
|
headers: { authorization: `Bearer ${token}`, "content-type": "application/json", ...(0, identify_js_1.clientHeaders)() },
|
|
62
|
-
body: JSON.stringify(
|
|
63
|
-
machineId: me.id,
|
|
64
|
-
name: me.name,
|
|
65
|
-
kind: state.kind,
|
|
66
|
-
platform: `${(0, node_os_1.platform)()} ${(0, node_os_1.release)()}`.slice(0, 80),
|
|
67
|
-
clientVersion: client.startsWith("cli/") ? client.slice(4) : null,
|
|
68
|
-
folderName: state.folder ? node_path_1.default.basename(node_path_1.default.resolve(state.folder)) : null,
|
|
69
|
-
track: state.track ?? null,
|
|
70
|
-
baseVersionId: state.baseVersionId ?? null,
|
|
71
|
-
changedFiles: state.changedFiles ?? null,
|
|
72
|
-
workspaceId: state.workspaceId ?? null,
|
|
73
|
-
}),
|
|
90
|
+
body: JSON.stringify(await checkInBody(state)),
|
|
74
91
|
signal: AbortSignal.timeout(2500),
|
|
75
92
|
});
|
|
76
93
|
}
|
package/dist/cli/src/registry.js
CHANGED
|
@@ -46,7 +46,7 @@ exports.LISTING_ORDER = [
|
|
|
46
46
|
"about", "features", "visibility", "ai", "private", "upload-rules", "people", "watch", "hooks", "secret", "assistant",
|
|
47
47
|
"security", "pages", "fork", "hand-over", "delete",
|
|
48
48
|
"issues", "issue",
|
|
49
|
-
"actions", "runs", "logs", "cancel", "rerun", "approve", "runner", "build", "machines",
|
|
49
|
+
"actions", "runs", "logs", "cancel", "rerun", "approve", "runner", "power", "build", "machines",
|
|
50
50
|
"workspace",
|
|
51
51
|
"mods", "bundle", "unbundle", "inspect",
|
|
52
52
|
"mcp", "skill", "tokens",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderook/cli",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.4",
|
|
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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"git-remote-coderook": "dist/cli/src/git_remote_bin.js"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
|
-
".claude-plugin",
|
|
31
|
+
".claude-plugin",
|
|
32
32
|
"engine-bin",
|
|
33
33
|
"dist",
|
|
34
34
|
"skills",
|