@coderook/cli 0.47.2 → 0.49.0
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/README.md +18 -0
- package/dist/cli/src/actions_command.js +75 -0
- package/dist/cli/src/cli.js +38 -1
- package/dist/cli/src/registry.js +1 -1
- package/dist/cli/src/workspace_command.js +20 -4
- package/package.json +1 -1
- package/skills/coderook/SKILL.md +12 -0
- package/dist/cli.bundle.cjs +0 -28322
|
@@ -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.
|
|
5
|
+
"version": "0.49.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ACCA Gaming Productions",
|
|
8
8
|
"url": "https://coderook.com"
|
package/README.md
CHANGED
|
@@ -598,6 +598,24 @@ https://api.coderook.com/v1/public/projects/OWNER/SLUG/releases
|
|
|
598
598
|
https://api.coderook.com/v1/public/projects/OWNER/SLUG/updates electron-updater's generic provider
|
|
599
599
|
```
|
|
600
600
|
|
|
601
|
+
## A copy on another git host
|
|
602
|
+
|
|
603
|
+
```
|
|
604
|
+
cbx mirror set https://github.com/you/project.git push each save to main there as well
|
|
605
|
+
cbx mirror set <url> --lines main,beta or to these lines' branches
|
|
606
|
+
cbx mirror where it goes and whether it is up to date
|
|
607
|
+
cbx mirror push send the newest version after commits made there
|
|
608
|
+
cbx mirror off stop
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
Each save is pushed as one commit on top of the last. It never forces: if
|
|
612
|
+
somebody else pushed to that branch, the mirror stops and says so until
|
|
613
|
+
`cbx mirror push` puts CodeRook's newest version after their commits. A branch
|
|
614
|
+
that already holds the same files is left alone, so a project also updated
|
|
615
|
+
from that remote does not loop. The token needs push access and is read like a
|
|
616
|
+
secret: piped in, from `--from-env VAR`, or typed at a hidden prompt. Only the
|
|
617
|
+
project's administrators can set a mirror.
|
|
618
|
+
|
|
601
619
|
## Mod repositories for games
|
|
602
620
|
|
|
603
621
|
A mod repository is where a game's players get mods from. The game's maker
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.commandSecret = commandSecret;
|
|
7
|
+
exports.commandMirror = commandMirror;
|
|
7
8
|
exports.commandCheckWorkflows = commandCheckWorkflows;
|
|
8
9
|
exports.commandSetWorkflow = commandSetWorkflow;
|
|
9
10
|
exports.commandApprove = commandApprove;
|
|
@@ -119,6 +120,80 @@ async function commandSecret(parsed) {
|
|
|
119
120
|
console.error((0, colour_js_1.red)(`cbx secret has no "${sub}". `) + "Try: list, set, remove");
|
|
120
121
|
return 1;
|
|
121
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* cbx mirror [status] | set <https-url> [--lines main,release] | push | off
|
|
125
|
+
*
|
|
126
|
+
* Keeps the project on another git host as well: after each save to the named
|
|
127
|
+
* lines, CodeRook pushes it to the remote's branch of the same name, never
|
|
128
|
+
* forcing (the service's project_mirror.ts). The token is read like a
|
|
129
|
+
* secret's value, never from an argument.
|
|
130
|
+
*/
|
|
131
|
+
async function commandMirror(parsed) {
|
|
132
|
+
const sub = parsed.positional[0] ?? "status";
|
|
133
|
+
const project = await (0, project_commands_js_1.resolveProject)(projectFlag(parsed));
|
|
134
|
+
if (!project)
|
|
135
|
+
return 1;
|
|
136
|
+
const base = `/v1/repositories/${encodeURIComponent(project.id)}/mirror`;
|
|
137
|
+
if (sub === "status") {
|
|
138
|
+
const { mirror } = await (0, api_js_1.callApi)(base);
|
|
139
|
+
if (!mirror) {
|
|
140
|
+
console.log(`${(0, colour_js_1.bold)(project.slug)} is not mirrored anywhere.`);
|
|
141
|
+
console.log((0, colour_js_1.dim)(" Set one up: cbx mirror set https://github.com/you/project.git (you are asked for a token)"));
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
const state = mirror.state === "ok" ? (0, colour_js_1.green)("up to date") : mirror.state === "diverged" ? (0, colour_js_1.red)("stopped") : mirror.state === "failed" ? (0, colour_js_1.red)("failing") : (0, colour_js_1.dim)("not pushed yet");
|
|
145
|
+
console.log(`${(0, colour_js_1.bold)(project.slug)} mirrors to ${(0, colour_js_1.accent)(mirror.remoteUrl)} ${mirror.enabled ? "" : (0, colour_js_1.dim)("(paused)")}`);
|
|
146
|
+
console.log(` Lines ${mirror.lines.join(", ")}`);
|
|
147
|
+
console.log(` State ${state}${mirror.lastSuccessAt ? (0, colour_js_1.dim)(`, last pushed ${new Date(mirror.lastSuccessAt).toLocaleString()}`) : ""}`);
|
|
148
|
+
if (mirror.detail)
|
|
149
|
+
console.log(` ${mirror.detail}`);
|
|
150
|
+
if (mirror.state === "diverged")
|
|
151
|
+
console.log((0, colour_js_1.dim)(" To send CodeRook's newest version after the remote's own commits: cbx mirror push"));
|
|
152
|
+
return 0;
|
|
153
|
+
}
|
|
154
|
+
if (sub === "set") {
|
|
155
|
+
const remoteUrl = (parsed.positional[1] ?? "").trim();
|
|
156
|
+
if (!remoteUrl) {
|
|
157
|
+
console.error((0, colour_js_1.red)("Give the remote's address: cbx mirror set https://github.com/you/project.git"));
|
|
158
|
+
return 1;
|
|
159
|
+
}
|
|
160
|
+
const linesFlag = parsed.flags.get("lines");
|
|
161
|
+
const lines = typeof linesFlag === "string" ? linesFlag.split(",").map((line) => line.trim()).filter(Boolean) : undefined;
|
|
162
|
+
const { mirror: current } = await (0, api_js_1.callApi)(base);
|
|
163
|
+
/* A token is needed the first time and for a new remote; otherwise only when one is offered. */
|
|
164
|
+
let normalised = remoteUrl;
|
|
165
|
+
try {
|
|
166
|
+
normalised = new URL(remoteUrl).toString();
|
|
167
|
+
}
|
|
168
|
+
catch { /* the service says what is wrong with it */ }
|
|
169
|
+
const needsToken = !current || current.remoteUrl !== normalised || parsed.flags.has("from-env") || !process.stdin.isTTY;
|
|
170
|
+
const token = needsToken ? await readSecretValue("the remote's access token (it needs permission to push)", parsed) : null;
|
|
171
|
+
if (needsToken && !token) {
|
|
172
|
+
console.error((0, colour_js_1.red)("No token was entered, so nothing was saved."));
|
|
173
|
+
return 1;
|
|
174
|
+
}
|
|
175
|
+
const { mirror } = await (0, api_js_1.callApi)(base, {
|
|
176
|
+
method: "PUT",
|
|
177
|
+
body: { remoteUrl, lines: lines ?? current?.lines ?? ["main"], ...(token ? { token } : {}), enabled: !parsed.flags.has("paused") },
|
|
178
|
+
});
|
|
179
|
+
console.log(`${(0, colour_js_1.green)("Mirroring")} ${mirror.lines.join(", ")} to ${(0, colour_js_1.accent)(mirror.remoteUrl)}.`);
|
|
180
|
+
console.log((0, colour_js_1.dim)(" Each save to those lines is pushed after it lands. It never forces: if the remote has commits"));
|
|
181
|
+
console.log((0, colour_js_1.dim)(" CodeRook did not push, it stops and tells you. Its runs show under cbx runs."));
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
if (sub === "push") {
|
|
185
|
+
const { queued } = await (0, api_js_1.callApi)(`${base}/push`, { method: "POST" });
|
|
186
|
+
console.log(queued ? `${(0, colour_js_1.green)("Pushing")} the newest version of ${queued === 1 ? "1 line" : `${queued} lines`}.` : "Nothing to push: none of the mirrored lines has a save yet.");
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
if (sub === "off" || sub === "remove") {
|
|
190
|
+
await (0, api_js_1.callApi)(base, { method: "DELETE" });
|
|
191
|
+
console.log(`${(0, colour_js_1.green)("Stopped mirroring")} ${project.slug}. The token is deleted; the remote is left as it is.`);
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
console.error((0, colour_js_1.red)(`cbx mirror has no "${sub}". `) + "Try: status, set, push, off");
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
122
197
|
const EVENT_WORDS = {
|
|
123
198
|
manual: "by hand",
|
|
124
199
|
version_saved: "on save",
|
package/dist/cli/src/cli.js
CHANGED
|
@@ -3256,8 +3256,12 @@ const SPECS = [
|
|
|
3256
3256
|
{ flags: "--base-version <id>", description: "select a saved base version" },
|
|
3257
3257
|
{ flags: "--revision <number>", description: "the exact reviewed workspace revision" },
|
|
3258
3258
|
{ flags: "--key <operation-key>", description: "unique idempotency key; preserve it for retries" },
|
|
3259
|
-
{ flags: "--path <path>", description: "read this project-relative file" },
|
|
3259
|
+
{ flags: "--path <path>", description: "read this project-relative file; search: only this folder or glob (src/api, client/**/*.tsx, *.md)" },
|
|
3260
3260
|
{ flags: "--query <text>", description: "text to find in the remote workspace" },
|
|
3261
|
+
{ flags: "--regex", description: "search: the query is a regular expression (a bad one is an error, not zero hits)" },
|
|
3262
|
+
{ flags: "--case-sensitive", description: "search: match upper and lower case exactly" },
|
|
3263
|
+
{ flags: "--count", description: "search: how many matches in each file, not the lines" },
|
|
3264
|
+
{ flags: "--hunks", description: "diff: unified-diff hunks instead of whole before/after files" },
|
|
3261
3265
|
{ flags: "--offset <number>", description: "continue a paginated listing, search or diff" },
|
|
3262
3266
|
{ flags: "--start-line <number>", description: "first text line to read" },
|
|
3263
3267
|
{ flags: "--lines <number>", description: "maximum text lines to read" },
|
|
@@ -4268,6 +4272,39 @@ const SPECS = [
|
|
|
4268
4272
|
],
|
|
4269
4273
|
run: actions_command_js_1.commandSecret,
|
|
4270
4274
|
},
|
|
4275
|
+
{
|
|
4276
|
+
name: "mirror",
|
|
4277
|
+
group: "Project settings",
|
|
4278
|
+
summary: "keep the project on another git host as well",
|
|
4279
|
+
usage: "mirror [status] | set <url> | push | off",
|
|
4280
|
+
arguments: {
|
|
4281
|
+
"[status]": "show where the project is mirrored and whether it is up to date (the default)",
|
|
4282
|
+
"<url>": "the remote's https address, like https://github.com/you/project.git",
|
|
4283
|
+
},
|
|
4284
|
+
brief: "mirror status|set|push|off",
|
|
4285
|
+
detail: "After each save to the named lines (main by default), CodeRook pushes it\n" +
|
|
4286
|
+
"to the remote's branch of the same name, as one commit. It never forces:\n" +
|
|
4287
|
+
"if somebody else has pushed there, it stops and tells you, and\n" +
|
|
4288
|
+
"`cbx mirror push` sends CodeRook's newest version after their commits.\n" +
|
|
4289
|
+
"A branch already holding the same files is left alone, so a project that\n" +
|
|
4290
|
+
"is also updated from that remote does not loop.\n\n" +
|
|
4291
|
+
"The token needs permission to push. It is read like a secret's value:\n" +
|
|
4292
|
+
"piped in, from --from-env, or typed at a hidden prompt.",
|
|
4293
|
+
options: [
|
|
4294
|
+
{ flags: "--lines <a,b>", description: "which lines to mirror (default main)" },
|
|
4295
|
+
{ flags: "--from-env <VAR>", description: "take the token from this environment variable" },
|
|
4296
|
+
{ flags: "--paused", description: "save the settings without pushing yet" },
|
|
4297
|
+
{ flags: "--project <name>", description: "which project" },
|
|
4298
|
+
],
|
|
4299
|
+
examples: [
|
|
4300
|
+
"cbx mirror set https://github.com/you/project.git",
|
|
4301
|
+
"cbx mirror set https://github.com/you/project.git --lines main,release",
|
|
4302
|
+
"cbx mirror",
|
|
4303
|
+
"cbx mirror push",
|
|
4304
|
+
"cbx mirror off",
|
|
4305
|
+
],
|
|
4306
|
+
run: actions_command_js_1.commandMirror,
|
|
4307
|
+
},
|
|
4271
4308
|
{
|
|
4272
4309
|
name: "runs",
|
|
4273
4310
|
group: "Actions and builds",
|
package/dist/cli/src/registry.js
CHANGED
|
@@ -43,7 +43,7 @@ exports.LISTING_ORDER = [
|
|
|
43
43
|
"tracks", "line-rules", "merges", "merge", "propose", "proposals", "pr",
|
|
44
44
|
"versions", "files", "mark", "notes", "labels", "promote", "release", "releases", "attach", "held", "review", "undo",
|
|
45
45
|
"take-down", "verify", "deps",
|
|
46
|
-
"about", "features", "visibility", "ai", "private", "upload-rules", "people", "watch", "hooks", "secret", "assistant",
|
|
46
|
+
"about", "features", "visibility", "ai", "private", "upload-rules", "people", "watch", "hooks", "secret", "mirror", "assistant",
|
|
47
47
|
"security", "pages", "fork", "hand-over", "delete",
|
|
48
48
|
"issues", "issue",
|
|
49
49
|
"actions", "runs", "logs", "cancel", "rerun", "approve", "runner", "power", "build", "machines",
|
|
@@ -101,7 +101,13 @@ async function commandWorkspace(parsed) {
|
|
|
101
101
|
if (!workspace)
|
|
102
102
|
throw new Error("Supply the remote workspace ID; this command does not use a local project folder");
|
|
103
103
|
path += `/${encodeURIComponent(workspace)}`;
|
|
104
|
-
if (operation === "read"
|
|
104
|
+
if (operation === "read" && Array.isArray(data.files)) {
|
|
105
|
+
/* Several files in one request: --data-file {"files":[{"path":"a.ts","startLine":1,"lines":40},…]}. */
|
|
106
|
+
path += "/files/read";
|
|
107
|
+
method = "POST";
|
|
108
|
+
body = { files: data.files, ...(integer("revision") !== undefined ? { revision: integer("revision") } : {}) };
|
|
109
|
+
}
|
|
110
|
+
else if (operation === "read" || operation === "files") {
|
|
105
111
|
const q = new URLSearchParams();
|
|
106
112
|
for (const [name, value] of Object.entries({
|
|
107
113
|
path: flag("path"),
|
|
@@ -114,10 +120,20 @@ async function commandWorkspace(parsed) {
|
|
|
114
120
|
q.set(name, String(value));
|
|
115
121
|
path += `/files?${q}`;
|
|
116
122
|
}
|
|
117
|
-
else if (operation === "search")
|
|
118
|
-
|
|
123
|
+
else if (operation === "search") {
|
|
124
|
+
const q = new URLSearchParams({ q: flag("query") ?? "", offset: String(integer("offset") ?? 0) });
|
|
125
|
+
if (parsed.flags.has("regex"))
|
|
126
|
+
q.set("regex", "1");
|
|
127
|
+
if (parsed.flags.has("case-sensitive"))
|
|
128
|
+
q.set("caseSensitive", "1");
|
|
129
|
+
if (parsed.flags.has("count"))
|
|
130
|
+
q.set("count", "1");
|
|
131
|
+
if (flag("path"))
|
|
132
|
+
q.set("path", flag("path"));
|
|
133
|
+
path += `/search?${q}`;
|
|
134
|
+
}
|
|
119
135
|
else if (operation === "diff")
|
|
120
|
-
path += `/diff?offset=${integer("offset") ?? 0}`;
|
|
136
|
+
path += `/diff?offset=${integer("offset") ?? 0}${parsed.flags.has("hunks") ? "&format=hunks" : ""}`;
|
|
121
137
|
else if (operation === "patch") {
|
|
122
138
|
path += "/changes";
|
|
123
139
|
method = "POST";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderook/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
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",
|
package/skills/coderook/SKILL.md
CHANGED
|
@@ -23,6 +23,8 @@ Use `cbx submit` for folders that are not git repositories.
|
|
|
23
23
|
|
|
24
24
|
Use `cbx workspace` when the person wants to continue a CodeRook project from a lightweight laptop. Do not clone the full project unless that work needs local files. Start with `cbx workspace list <project>` or open a named draft with a unique `--key`. Keep its ID and revision, read/search the needed paths, edit with explicit hashes in a JSON `--data-file`, review the diff, then save the authorised revision. Retry a lost response using the same operation key and arguments. Saving and deploying are different actions.
|
|
25
25
|
|
|
26
|
+
Send only what changes. In a `patch` data file a change can be `{"path":"src/a.ts","edits":[{"oldText":"…","newText":"…"}]}` (each oldText must appear exactly once, or set `"replaceAll":true`; a CRLF file needs `\r\n` in the text) or `{"path":"new/name.ts","from":"old/name.ts"}` to rename; the reply gives each changed file's new sha256. Search with `--regex`, `--case-sensitive`, `--path <folder or glob>` and `--count`; read several files in one call with `read --data-file` holding `{"files":[{"path":"…","startLine":1,"lines":80}]}`; review with `diff --hunks`. An empty project gets its first version with the remote MCP `create_first_version` tool.
|
|
27
|
+
|
|
26
28
|
`cbx workspace show <project> <id>` includes the administrator-configured recipe commands and target information. Run a named recipe, inspect its job with `logs`, and use `cancel` if needed. Only deploy an explicitly requested target and a saved version with applicable checks. A missing recipe requires configuration; running a local terminal command does not change remote files.
|
|
27
29
|
|
|
28
30
|
To hand a draft to a machine that is not signed in as the owner, run `cbx workspace assign <project> <draft> --name "Laptop"`. It prints a token that reaches that one draft (read the project, edit, save and run its checks; no deploys, settings, other drafts or more tokens). Tell the person to give it to the other machine privately; never repeat the token yourself. On that machine: `cbx sign-in` (paste the token), `cbx workspace checkout <project> <draft> [folder]`, edit the files, then `cbx workspace push` (add `--save -m "…"` to save, `--dry-run` to preview). A checked-out folder is not a linked folder, so `cbx submit` does not apply there. A handed-over machine's saves never land on the draft's line directly: they go to the draft's own line `drafts/<name>-<id>` and open a pull request into it, which the owner or a reviewer approves and merges (see it with `cbx pr list`). Saves made signed in as the owner go straight to the line. `cbx workspace assignments` lists live tokens and `cbx workspace unassign` ends one; archiving the draft ends them all.
|
|
@@ -387,6 +389,16 @@ project's owner; never put vulnerability details in a public issue.
|
|
|
387
389
|
`cbx verify owner/project v2.0 ./file` checks a download; `cbx deps` lists
|
|
388
390
|
known vulnerabilities in the lockfiles. Ask before publishing.
|
|
389
391
|
|
|
392
|
+
## A copy on another git host
|
|
393
|
+
|
|
394
|
+
`cbx mirror set https://github.com/you/project.git` makes CodeRook push each
|
|
395
|
+
save to `main` (or `--lines a,b`) to that remote's branch of the same name. It
|
|
396
|
+
never forces: if somebody pushed there first it stops, `cbx mirror` says so,
|
|
397
|
+
and `cbx mirror push` sends the newest version after their commits. `cbx mirror
|
|
398
|
+
off` stops it. The token is read like a secret (piped, `--from-env VAR`, or a
|
|
399
|
+
hidden prompt), so let the person give it; never put it on the command line.
|
|
400
|
+
Only a project's administrators can set a mirror. Ask before setting one.
|
|
401
|
+
|
|
390
402
|
## Mod repositories for games
|
|
391
403
|
|
|
392
404
|
A game's maker can run a mod repository: players' game clients read a signed
|