@coderook/cli 0.46.8 → 0.46.10
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 +4 -0
- package/dist/cbx/src/core/download.js +111 -5
- package/dist/cbx/src/core/upload.js +8 -0
- package/dist/cbx/src/shared/merge_diff.js +136 -0
- package/dist/cli/src/api.js +71 -5
- package/dist/cli/src/cli.js +145 -15
- package/dist/cli/src/diff_command.js +32 -34
- package/dist/cli/src/paint.js +3 -1
- package/dist/cli/src/pending_merges.js +62 -0
- package/dist/cli/src/project_commands.js +17 -0
- package/dist/cli/src/remote_restore.js +20 -24
- package/dist/cli/src/workspace_command.js +14 -1
- package/dist/cli/src/workspace_put.js +34 -6
- package/dist/cli/src/workspace_review.js +15 -7
- package/dist/cli/src/workspace_starter.js +61 -7
- package/package.json +2 -2
|
@@ -31,12 +31,8 @@ const node_process_1 = __importDefault(require("node:process"));
|
|
|
31
31
|
const download_js_1 = require("../../cbx/src/core/download.js");
|
|
32
32
|
const safe_path_js_1 = require("../../cbx/src/shared/safe_path.js");
|
|
33
33
|
const config_js_1 = require("./config.js");
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const dim = paint("2");
|
|
37
|
-
const red = paint("31");
|
|
38
|
-
const green = paint("32");
|
|
39
|
-
const accent = paint("33");
|
|
34
|
+
/* The shared colours: only at a terminal, never with NO_COLOR. */
|
|
35
|
+
const colour_js_1 = require("./colour.js");
|
|
40
36
|
const plural = (count, one, many = `${one}s`) => `${count} ${count === 1 ? one : many}`;
|
|
41
37
|
async function digestOfFile(full) {
|
|
42
38
|
try {
|
|
@@ -78,10 +74,10 @@ function projectPath(root, cwd, typed) {
|
|
|
78
74
|
async function commandRemoteRestore(parsed) {
|
|
79
75
|
const found = await linkedRoot(node_process_1.default.cwd());
|
|
80
76
|
if (!found) {
|
|
81
|
-
console.error(red("No history here."));
|
|
82
|
-
console.error(dim(" This folder is not linked to a CodeRook project and has no local history. ") +
|
|
83
|
-
accent("cbx link <project>") + dim(" connects it; ") + accent("cbx init") +
|
|
84
|
-
dim(" starts a history on this machine."));
|
|
77
|
+
console.error((0, colour_js_1.red)("No history here."));
|
|
78
|
+
console.error((0, colour_js_1.dim)(" This folder is not linked to a CodeRook project and has no local history. ") +
|
|
79
|
+
(0, colour_js_1.accent)("cbx link <project>") + (0, colour_js_1.dim)(" connects it; ") + (0, colour_js_1.accent)("cbx init") +
|
|
80
|
+
(0, colour_js_1.dim)(" starts a history on this machine."));
|
|
85
81
|
return 1;
|
|
86
82
|
}
|
|
87
83
|
const { root, link } = found;
|
|
@@ -90,7 +86,7 @@ async function commandRemoteRestore(parsed) {
|
|
|
90
86
|
for (const typed of parsed.positional) {
|
|
91
87
|
const one = projectPath(root, node_process_1.default.cwd(), typed);
|
|
92
88
|
if (one === null) {
|
|
93
|
-
console.error(red(`${typed} is outside the project folder (${root}).`));
|
|
89
|
+
console.error((0, colour_js_1.red)(`${typed} is outside the project folder (${root}).`));
|
|
94
90
|
return 1;
|
|
95
91
|
}
|
|
96
92
|
wanted.push(one);
|
|
@@ -105,7 +101,7 @@ async function commandRemoteRestore(parsed) {
|
|
|
105
101
|
? versions.find((one) => one.sequence === Number(sequence[1]))
|
|
106
102
|
: versions.find((one) => one.id.startsWith(from.trim()));
|
|
107
103
|
if (!version) {
|
|
108
|
-
console.error(red(`No version ${from} in ${link.slug}.`) + dim(" cbx versions lists them."));
|
|
104
|
+
console.error((0, colour_js_1.red)(`No version ${from} in ${link.slug}.`) + (0, colour_js_1.dim)(" cbx versions lists them."));
|
|
109
105
|
return 1;
|
|
110
106
|
}
|
|
111
107
|
}
|
|
@@ -115,14 +111,14 @@ async function commandRemoteRestore(parsed) {
|
|
|
115
111
|
versions.find((one) => one.id === base) ??
|
|
116
112
|
versions.find((one) => one.sequence === link.sequence);
|
|
117
113
|
if (!version) {
|
|
118
|
-
console.error(red("This folder's saved version could not be found.") +
|
|
119
|
-
dim(" Name one with --from vN."));
|
|
114
|
+
console.error((0, colour_js_1.red)("This folder's saved version could not be found.") +
|
|
115
|
+
(0, colour_js_1.dim)(" Name one with --from vN."));
|
|
120
116
|
return 1;
|
|
121
117
|
}
|
|
122
118
|
}
|
|
123
119
|
const files = selectFiles(await downloader.files(link.repositoryId, version.id), wanted);
|
|
124
120
|
if (!files.length) {
|
|
125
|
-
console.error(red(`v${version.sequence} holds nothing at ${wanted.join(", ") || "the project root"}.`));
|
|
121
|
+
console.error((0, colour_js_1.red)(`v${version.sequence} holds nothing at ${wanted.join(", ") || "the project root"}.`));
|
|
126
122
|
return 1;
|
|
127
123
|
}
|
|
128
124
|
const toWrite = [];
|
|
@@ -130,7 +126,7 @@ async function commandRemoteRestore(parsed) {
|
|
|
130
126
|
for (const file of files) {
|
|
131
127
|
const unsafe = (0, safe_path_js_1.whyUnsafe)(file.path);
|
|
132
128
|
if (unsafe) {
|
|
133
|
-
console.error(red(`Skipped ${JSON.stringify(file.path)}: ${unsafe}.`));
|
|
129
|
+
console.error((0, colour_js_1.red)(`Skipped ${JSON.stringify(file.path)}: ${unsafe}.`));
|
|
134
130
|
continue;
|
|
135
131
|
}
|
|
136
132
|
const here = await digestOfFile(node_path_1.default.join(root, ...file.path.split("/")));
|
|
@@ -147,28 +143,28 @@ async function commandRemoteRestore(parsed) {
|
|
|
147
143
|
toWrite.push(file);
|
|
148
144
|
}
|
|
149
145
|
if (edited.length) {
|
|
150
|
-
console.error(red(`${plural(edited.length, "file")} here ${edited.length === 1 ? "has" : "have"} ` +
|
|
146
|
+
console.error((0, colour_js_1.red)(`${plural(edited.length, "file")} here ${edited.length === 1 ? "has" : "have"} ` +
|
|
151
147
|
`unsaved changes that restoring would overwrite:`));
|
|
152
148
|
for (const one of edited.slice(0, 20))
|
|
153
149
|
console.error(` ${one}`);
|
|
154
150
|
if (edited.length > 20)
|
|
155
|
-
console.error(dim(` …and ${edited.length - 20} more`));
|
|
156
|
-
console.error(`\nAdd ${accent("--force")} to discard them, or save them first with ${accent("cbx submit")}.`);
|
|
151
|
+
console.error((0, colour_js_1.dim)(` …and ${edited.length - 20} more`));
|
|
152
|
+
console.error(`\nAdd ${(0, colour_js_1.accent)("--force")} to discard them, or save them first with ${(0, colour_js_1.accent)("cbx submit")}.`);
|
|
157
153
|
return 1;
|
|
158
154
|
}
|
|
159
155
|
if (!toWrite.length) {
|
|
160
|
-
console.log(`Already matches ${accent(`v${version.sequence}`)}; nothing to put back.`);
|
|
156
|
+
console.log(`Already matches ${(0, colour_js_1.accent)(`v${version.sequence}`)}; nothing to put back.`);
|
|
161
157
|
return 0;
|
|
162
158
|
}
|
|
163
159
|
for (const file of toWrite) {
|
|
164
160
|
await downloader.fileTo(link.repositoryId, version.id, file, node_path_1.default.join(root, ...file.path.split("/")));
|
|
165
161
|
}
|
|
166
|
-
console.log(`Put back ${plural(toWrite.length, "file")} from ${accent(`v${version.sequence}`)}: ` +
|
|
162
|
+
console.log(`Put back ${plural(toWrite.length, "file")} from ${(0, colour_js_1.accent)(`v${version.sequence}`)}: ` +
|
|
167
163
|
`${version.message.split("\n")[0]}`);
|
|
168
164
|
for (const file of toWrite.slice(0, 20))
|
|
169
|
-
console.log(` ${green("restored")} ${file.path}`);
|
|
165
|
+
console.log(` ${(0, colour_js_1.green)("restored")} ${file.path}`);
|
|
170
166
|
if (toWrite.length > 20)
|
|
171
|
-
console.log(dim(` …and ${toWrite.length - 20} more`));
|
|
172
|
-
console.log(dim("The folder's link has not moved. cbx submit saves the folder as it is now."));
|
|
167
|
+
console.log((0, colour_js_1.dim)(` …and ${toWrite.length - 20} more`));
|
|
168
|
+
console.log((0, colour_js_1.dim)("The folder's link has not moved. cbx submit saves the folder as it is now."));
|
|
173
169
|
return 0;
|
|
174
170
|
}
|
|
@@ -164,13 +164,16 @@ async function commandWorkspace(parsed) {
|
|
|
164
164
|
body = {};
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
else if (operation === "handoff" || operation === "close") {
|
|
167
|
+
else if (operation === "handoff" || operation === "close" || operation === "reopen") {
|
|
168
168
|
method = "PATCH";
|
|
169
169
|
body = {
|
|
170
170
|
...data,
|
|
171
171
|
expectedRevision: revision,
|
|
172
172
|
note: flag("note") ?? data.note,
|
|
173
173
|
...(operation === "close" ? { archived: true } : {}),
|
|
174
|
+
/* Closing a draft with unsaved edits needs this: the service refuses otherwise. The edits are kept for reopen. */
|
|
175
|
+
...(operation === "close" && parsed.flags.has("unsaved") ? { unsaved: true } : {}),
|
|
176
|
+
...(operation === "reopen" ? { archived: false } : {}),
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
else if (operation !== "show")
|
|
@@ -197,6 +200,16 @@ async function commandWorkspace(parsed) {
|
|
|
197
200
|
throw error;
|
|
198
201
|
}
|
|
199
202
|
console.log(JSON.stringify(result, null, 2));
|
|
203
|
+
/*
|
|
204
|
+
A save kept as a merge did not reach the line. It exited 0 with only JSON
|
|
205
|
+
to say otherwise, so a script or agent read it as saved (2026-11-11, M-1).
|
|
206
|
+
Exit 3 means exactly that, the same as cbx submit.
|
|
207
|
+
*/
|
|
208
|
+
const kept = operation === "save" ? result?.mergeTrack : null;
|
|
209
|
+
if (kept?.reference) {
|
|
210
|
+
say(`Kept as ${kept.reference}, not saved to the line: somebody changed the same lines. Run cbx merge ${kept.reference} to decide.`);
|
|
211
|
+
return 3;
|
|
212
|
+
}
|
|
200
213
|
return 0;
|
|
201
214
|
}
|
|
202
215
|
const say = (line) => process.stderr.write(line + "\n");
|
|
@@ -88,13 +88,41 @@ async function commandWorkspacePut(parsed, root, workspace) {
|
|
|
88
88
|
const draft = `${root}/workspaces/${encodeURIComponent(workspace)}`;
|
|
89
89
|
const wanted = [...new Set(paths.map((p) => projectPath(folder, p)))];
|
|
90
90
|
/* The hashes the draft holds now; the listing pages 500 at a time, so stop once every wanted path is found. */
|
|
91
|
+
/*
|
|
92
|
+
Asked path by path first. Paging never stopped early for a new file, which
|
|
93
|
+
no page names: a put into a 20,000-file draft made about 41 requests and
|
|
94
|
+
took 22-24 s (2026-11-11 agent exercise). The listing is still the way for
|
|
95
|
+
many paths, and for a service that does not answer meta=1.
|
|
96
|
+
*/
|
|
91
97
|
const held = new Map();
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
for (const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
let pageThrough = wanted.length > 32;
|
|
99
|
+
if (!pageThrough) {
|
|
100
|
+
for (const path of wanted) {
|
|
101
|
+
try {
|
|
102
|
+
const one = await (0, api_js_1.callApi)(`${draft}/files?path=${encodeURIComponent(path)}&meta=1`);
|
|
103
|
+
if (typeof one.sha256 !== "string") {
|
|
104
|
+
pageThrough = true;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
held.set(path, one.sha256);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (error instanceof api_js_1.ServiceError && error.code === "workspace_file_missing")
|
|
111
|
+
continue;
|
|
112
|
+
pageThrough = true;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (pageThrough) {
|
|
118
|
+
held.clear();
|
|
119
|
+
for (let offset = 0; offset !== null && held.size < wanted.length;) {
|
|
120
|
+
const page = await (0, api_js_1.callApi)(`${draft}/files?offset=${offset}`);
|
|
121
|
+
for (const f of page.files)
|
|
122
|
+
if (wanted.includes(f.path))
|
|
123
|
+
held.set(f.path, f.sha256);
|
|
124
|
+
offset = page.nextOffset;
|
|
125
|
+
}
|
|
98
126
|
}
|
|
99
127
|
const changes = [];
|
|
100
128
|
const unchanged = [];
|
|
@@ -7,9 +7,11 @@ exports.commandWorkspaceReviewers = commandWorkspaceReviewers;
|
|
|
7
7
|
* cbx workspace review <project> <workspace> --ok [-m "…"] | --changes -m "…"
|
|
8
8
|
* cbx workspace reviewers <project> [--data-file rules.json]
|
|
9
9
|
*
|
|
10
|
-
* The CLI side of the review gate (backend workspace_reviews.ts).
|
|
11
|
-
* counts only from the reviewer's own
|
|
12
|
-
*
|
|
10
|
+
* The CLI side of the review gate (backend workspace_reviews.ts). Where the
|
|
11
|
+
* project names reviewers, a review counts only from the reviewer's own
|
|
12
|
+
* sign-in or token, and the service refuses a name given with --as. Where it
|
|
13
|
+
* names none, any member's review, a named machine's included, is kept as
|
|
14
|
+
* advisory: shown, and waited on by nobody.
|
|
13
15
|
*/
|
|
14
16
|
const promises_1 = require("node:fs/promises");
|
|
15
17
|
const api_js_1 = require("./api.js");
|
|
@@ -25,6 +27,11 @@ const flag = (parsed, ...names) => {
|
|
|
25
27
|
/** One line per reviewer: a word for where it stands, never only a colour. */
|
|
26
28
|
function describeReviewer(s, revision) {
|
|
27
29
|
const when = [s.beforeSave && "save", s.beforeDeploy && "deploy"].filter(Boolean).join(" + ");
|
|
30
|
+
if (s.advisory) {
|
|
31
|
+
const said = s.state === "ok" ? (0, colour_js_1.green)("OK ") : s.state === "changes" ? (0, colour_js_1.red)("changes ") : "outdated ";
|
|
32
|
+
const on = s.state === "outdated" ? `on revision ${s.revision}, draft is at ${revision}` : `on revision ${s.revision}`;
|
|
33
|
+
return `${said}${(0, colour_js_1.bold)(s.label)} ${(0, colour_js_1.dim)(`advisory, ${on}`)}${s.note ? ` ${s.note}` : ""}`;
|
|
34
|
+
}
|
|
28
35
|
if (!s.applies)
|
|
29
36
|
return `${(0, colour_js_1.dim)("not needed")} ${s.label} ${(0, colour_js_1.dim)(`(no changes in its paths)`)}`;
|
|
30
37
|
const word = s.state === "ok"
|
|
@@ -42,8 +49,9 @@ function describeReviewer(s, revision) {
|
|
|
42
49
|
return `${word}${(0, colour_js_1.bold)(s.label)} ${(0, colour_js_1.dim)(`before ${when}`)}${detail ? ` ${detail}` : ""}`;
|
|
43
50
|
}
|
|
44
51
|
async function commandWorkspaceReview(parsed, root, workspace) {
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
/* Passed on: the service keeps it as advisory where no reviewers are named, and refuses it where they are. */
|
|
53
|
+
const asValue = parsed.flags.get("as");
|
|
54
|
+
const named = typeof asValue === "string" ? asValue : process.env.CBX_NAME || undefined;
|
|
47
55
|
const ok = parsed.flags.has("ok");
|
|
48
56
|
const changes = parsed.flags.has("changes");
|
|
49
57
|
const draft = `${root}/workspaces/${encodeURIComponent(workspace)}`;
|
|
@@ -54,7 +62,7 @@ async function commandWorkspaceReview(parsed, root, workspace) {
|
|
|
54
62
|
if (parsed.flags.has("json"))
|
|
55
63
|
console.log(JSON.stringify({ revision: shown.workspace.revision, review }, null, 2));
|
|
56
64
|
else if (!review.length)
|
|
57
|
-
console.log("This project names no reviewers. An administrator
|
|
65
|
+
console.log("This project names no reviewers, so nothing waits on a review; any review given is kept as advisory. An administrator names reviewers with cbx workspace reviewers.");
|
|
58
66
|
else
|
|
59
67
|
for (const s of review)
|
|
60
68
|
console.log(describeReviewer(s, shown.workspace.revision));
|
|
@@ -68,7 +76,7 @@ async function commandWorkspaceReview(parsed, root, workspace) {
|
|
|
68
76
|
: (await (0, api_js_1.callApi)(draft)).workspace.revision;
|
|
69
77
|
const out = await (0, api_js_1.callApi)(`${draft}/reviews`, {
|
|
70
78
|
method: "POST",
|
|
71
|
-
body: { verdict: ok ? "ok" : "changes", note, expectedRevision: revision },
|
|
79
|
+
body: { verdict: ok ? "ok" : "changes", note, expectedRevision: revision, ...(named ? { as: named } : {}) },
|
|
72
80
|
});
|
|
73
81
|
if (parsed.flags.has("json"))
|
|
74
82
|
console.log(JSON.stringify(out, null, 2));
|
|
@@ -21,6 +21,54 @@ const promises_1 = require("node:fs/promises");
|
|
|
21
21
|
const node_path_1 = require("node:path");
|
|
22
22
|
const api_js_1 = require("./api.js");
|
|
23
23
|
const colour_js_1 = require("./colour.js");
|
|
24
|
+
/*
|
|
25
|
+
Installs Rust where the runner has none; CodeRook's hosted runner does not ship
|
|
26
|
+
it. Nor a C compiler, which most crates' build scripts link with ("linker `cc`
|
|
27
|
+
not found", 2026-11-11), so gcc comes too when cc is missing.
|
|
28
|
+
*/
|
|
29
|
+
const CARGO = "command -v cc >/dev/null 2>&1 || { S=; [ \"$(id -u)\" = 0 ] || S=sudo; $S apt-get update -qq && $S apt-get install -y -qq --no-install-recommends gcc libc6-dev; }; " +
|
|
30
|
+
"command -v cargo >/dev/null 2>&1 || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal; }; " +
|
|
31
|
+
'. "$HOME/.cargo/env" 2>/dev/null; cargo test';
|
|
32
|
+
/** Sibling folders a package reaches with ../, from its tsconfig and file: dependencies. */
|
|
33
|
+
function siblingsOf(directory, seen) {
|
|
34
|
+
if (!directory)
|
|
35
|
+
return [];
|
|
36
|
+
const at = (name) => `${directory}/${name}`;
|
|
37
|
+
const found = new Set();
|
|
38
|
+
const add = (relative) => {
|
|
39
|
+
const parts = [...directory.split("/"), ...relative.split("/")];
|
|
40
|
+
const out = [];
|
|
41
|
+
for (const part of parts) {
|
|
42
|
+
if (!part || part === ".")
|
|
43
|
+
continue;
|
|
44
|
+
if (part === "..")
|
|
45
|
+
out.pop();
|
|
46
|
+
else
|
|
47
|
+
out.push(part);
|
|
48
|
+
}
|
|
49
|
+
const top = out.join("/");
|
|
50
|
+
if (top && top !== directory && !top.startsWith(`${directory}/`))
|
|
51
|
+
found.add(top);
|
|
52
|
+
};
|
|
53
|
+
const text = seen.get(at("tsconfig.json")) ?? "";
|
|
54
|
+
for (const match of text.matchAll(/"((?:\.\.\/)+[A-Za-z0-9_.-]+)/g))
|
|
55
|
+
add(match[1]);
|
|
56
|
+
try {
|
|
57
|
+
const pkg = JSON.parse(seen.get(at("package.json")) ?? "{}");
|
|
58
|
+
for (const group of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
59
|
+
for (const value of Object.values(pkg[group] ?? {})) {
|
|
60
|
+
const local = /^file:((?:\.\.\/)+[A-Za-z0-9_.-]+)/.exec(String(value));
|
|
61
|
+
if (local)
|
|
62
|
+
add(local[1]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
/* A package.json that does not parse already produced no starter. */
|
|
68
|
+
}
|
|
69
|
+
return [...found].sort();
|
|
70
|
+
}
|
|
71
|
+
const pathsFor = (directory, extra = []) => directory ? [`${directory}/`, ...extra.map((one) => `${one}/`)] : [];
|
|
24
72
|
const SKIP = new Set(["node_modules", ".git", ".coderook", ".rook", "dist", "build", "target", ".venv", "venv", "vendor", ".next"]);
|
|
25
73
|
const slug = (directory) => (directory.split("/").pop() || "project").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "project";
|
|
26
74
|
function nodeStarter(directory, seen) {
|
|
@@ -50,6 +98,7 @@ function nodeStarter(directory, seen) {
|
|
|
50
98
|
directory,
|
|
51
99
|
command: [install, ...steps.map((s) => `${run} ${s}`)].join(" && "),
|
|
52
100
|
because: `package.json scripts: ${steps.join(", ")}`,
|
|
101
|
+
includePaths: pathsFor(directory, siblingsOf(directory, seen)),
|
|
53
102
|
};
|
|
54
103
|
}
|
|
55
104
|
/** The starters a folder's files suggest, one per recognised package. */
|
|
@@ -66,12 +115,12 @@ function detectStarters(seen) {
|
|
|
66
115
|
if (node)
|
|
67
116
|
out.push(node);
|
|
68
117
|
else if (seen.has(at("Cargo.toml")))
|
|
69
|
-
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command:
|
|
118
|
+
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command: CARGO, because: "Cargo.toml (Rust is installed on the runner if missing)", includePaths: pathsFor(directory) });
|
|
70
119
|
else if (seen.has(at("go.mod")))
|
|
71
|
-
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command: "go vet ./... && go test ./...", because: "go.mod" });
|
|
120
|
+
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command: "go vet ./... && go test ./...", because: "go.mod", includePaths: pathsFor(directory) });
|
|
72
121
|
else if (seen.has(at("pyproject.toml")) || seen.has(at("requirements.txt"))) {
|
|
73
122
|
const install = seen.has(at("requirements.txt")) ? "python -m pip install -r requirements.txt" : "python -m pip install -e .";
|
|
74
|
-
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command: `${install} && python -m pytest`, because: seen.has(at("pyproject.toml")) ? "pyproject.toml" : "requirements.txt" });
|
|
123
|
+
out.push({ recipe: `${slug(directory)}-check`, workflow: `Draft check · ${directory || "project"}`, directory, command: `${install} && python -m pytest`, because: seen.has(at("pyproject.toml")) ? "pyproject.toml" : "requirements.txt", includePaths: pathsFor(directory) });
|
|
75
124
|
}
|
|
76
125
|
}
|
|
77
126
|
/* Two folders with the same last name ("app/web", "site/web") keep apart by their full path. */
|
|
@@ -83,7 +132,9 @@ function detectStarters(seen) {
|
|
|
83
132
|
s.recipe = `${s.directory.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "project"}-check`;
|
|
84
133
|
return out;
|
|
85
134
|
}
|
|
86
|
-
const MARKERS = new Set(["package.json", "package-lock.json", "pnpm-lock.yaml", "yarn.lock", "Cargo.toml", "go.mod", "pyproject.toml", "requirements.txt"]);
|
|
135
|
+
const MARKERS = new Set(["package.json", "package-lock.json", "pnpm-lock.yaml", "yarn.lock", "Cargo.toml", "go.mod", "pyproject.toml", "requirements.txt", "tsconfig.json"]);
|
|
136
|
+
/* Read for what they say, not only noticed. */
|
|
137
|
+
const READ = new Set(["package.json", "tsconfig.json"]);
|
|
87
138
|
/** The marker files in a folder, two levels deep, skipping dependencies and build output. */
|
|
88
139
|
async function scan(root) {
|
|
89
140
|
const seen = new Map();
|
|
@@ -96,7 +147,7 @@ async function scan(root) {
|
|
|
96
147
|
await walk(path, depth + 1);
|
|
97
148
|
}
|
|
98
149
|
else if (MARKERS.has(entry.name)) {
|
|
99
|
-
seen.set(path, entry.name
|
|
150
|
+
seen.set(path, READ.has(entry.name) ? await (0, promises_1.readFile)((0, node_path_1.join)(root, ...path.split("/")), "utf8") : "");
|
|
100
151
|
}
|
|
101
152
|
}
|
|
102
153
|
};
|
|
@@ -126,8 +177,11 @@ async function commandWorkspaceStarter(parsed, root) {
|
|
|
126
177
|
for (const s of starters) {
|
|
127
178
|
const kept = taken.has(s.recipe);
|
|
128
179
|
console.log(`${kept ? (0, colour_js_1.dim)("exists ") : (0, colour_js_1.green)("new ")} ${(0, colour_js_1.bold)(s.recipe)} ${(0, colour_js_1.dim)(`in ${s.directory || "."}`)}`);
|
|
129
|
-
if (!kept)
|
|
180
|
+
if (!kept) {
|
|
130
181
|
console.log(` ${s.command}\n ${(0, colour_js_1.dim)(s.because)}`);
|
|
182
|
+
if (s.includePaths.length > 1)
|
|
183
|
+
console.log(` ${(0, colour_js_1.dim)(`also sends ${s.includePaths.slice(1).join(", ")} (it builds from them)`)}`);
|
|
184
|
+
}
|
|
131
185
|
}
|
|
132
186
|
console.log(fresh.length
|
|
133
187
|
? (0, colour_js_1.dim)(`\nNothing was created. Add ${fresh.length === 1 ? "it" : "them"} with `) + (0, colour_js_1.accent)("--apply") + (0, colour_js_1.dim)("; drafts then run them with cbx workspace run <project> <draft> --recipe <name>.")
|
|
@@ -150,7 +204,7 @@ async function commandWorkspaceStarter(parsed, root) {
|
|
|
150
204
|
}
|
|
151
205
|
await (0, api_js_1.callApi)(`${root}/workspace-recipes/${encodeURIComponent(s.recipe)}`, {
|
|
152
206
|
method: "PUT",
|
|
153
|
-
body: { kind: "check", workflowId, includePaths: s.
|
|
207
|
+
body: { kind: "check", workflowId, includePaths: s.includePaths },
|
|
154
208
|
});
|
|
155
209
|
made.push(s.recipe);
|
|
156
210
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderook/cli",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.10",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"test:matrix": "node test/state-matrix.mjs",
|
|
45
45
|
"test:attempt": "node test/attempt-identity.mjs",
|
|
46
46
|
"test:get": "node test/get-safety.mjs",
|
|
47
|
-
"test:live": "node test/e2e.mjs --allow-production && node test/state-matrix.mjs --allow-production && node test/get-safety.mjs --allow-production && node test/get-track.mjs --allow-production && node test/get-protects-edits.mjs --allow-production && node test/upgrade-migration.mjs --allow-production && node test/fault-get.mjs --allow-production && node test/rename-sync.mjs --allow-production && node test/version-floor.mjs --allow-production && node test/fault-submit.mjs --allow-production && node test/race-attempts.mjs --allow-production && node test/attempt-identity.mjs --allow-production",
|
|
47
|
+
"test:live": "node test/e2e.mjs --allow-production && node test/state-matrix.mjs --allow-production && node test/get-safety.mjs --allow-production && node test/get-track.mjs --allow-production && node test/get-protects-edits.mjs --allow-production && node test/upgrade-migration.mjs --allow-production && node test/fault-get.mjs --allow-production && node test/rename-sync.mjs --allow-production && node test/exercise-fixes.mjs --allow-production && node test/version-floor.mjs --allow-production && node test/fault-submit.mjs --allow-production && node test/race-attempts.mjs --allow-production && node test/attempt-identity.mjs --allow-production",
|
|
48
48
|
"test:getedits": "node test/get-protects-edits.mjs",
|
|
49
49
|
"test:upgrade": "node test/upgrade-migration.mjs",
|
|
50
50
|
"test:faultget": "node test/fault-get.mjs",
|