architecture-harness 0.21.2 → 0.22.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/package.json +8 -3
- package/src/cli/check.mjs +61 -0
- package/src/cli/child-run.mjs +39 -0
- package/src/cli/child-run.test.mjs +16 -0
- package/src/cli/ci-template.test.mjs +28 -0
- package/src/cli/codex-implement.mjs +72 -3
- package/src/cli/codex-implement.test.mjs +141 -4
- package/src/cli/dispatch-guard.mjs +24 -1
- package/src/cli/dispatch-guard.test.mjs +30 -0
- package/src/cli/dispatch-reminder.mjs +4 -4
- package/src/cli/dispatch-reminder.test.mjs +3 -3
- package/src/cli/dispatch-slot.mjs +12 -0
- package/src/cli/gate-slot.mjs +151 -0
- package/src/cli/gate-slot.test.mjs +90 -0
- package/src/cli/integrate.mjs +122 -0
- package/src/cli/integrate.test.mjs +94 -0
- package/src/cli/ledger.mjs +25 -3
- package/src/cli/ledger.test.mjs +9 -0
- package/src/cli/merge-guard.mjs +13 -3
- package/src/cli/merge-guard.test.mjs +24 -1
- package/src/cli/migrations.mjs +127 -0
- package/src/cli/migrations.test.mjs +94 -0
- package/src/cli/plugin-agents.test.mjs +35 -8
- package/src/cli/qc.mjs +44 -0
- package/src/cli/report-stop.mjs +3 -0
- package/src/cli/report-stop.test.mjs +8 -0
- package/src/cli/retry-failed.mjs +80 -0
- package/src/cli/retry-failed.test.mjs +51 -0
- package/src/cli/review-gate.mjs +16 -7
- package/src/cli/slot-guard.mjs +43 -0
- package/src/cli/slot-guard.test.mjs +28 -0
- package/src/cli/task-gate-review.test.mjs +10 -0
- package/src/cli/task-gate.mjs +39 -7
- package/src/cli/task-gate.test.mjs +45 -0
- package/src/cli/throwaway-db.mjs +127 -0
- package/src/cli/throwaway-db.test.mjs +83 -0
- package/src/cli/ui-reuse-hint.mjs +89 -0
- package/src/cli/ui-reuse-hint.test.mjs +60 -0
- package/src/cli/ui.mjs +181 -0
- package/src/cli/ui.test.mjs +137 -0
- package/src/cli/watch.mjs +211 -0
- package/src/cli/watch.test.mjs +246 -0
- package/src/config.mjs +27 -2
- package/src/descriptions.mjs +3 -0
- package/src/gates/contract-keys.mjs +33 -0
- package/src/gates/contract-keys.test.mjs +38 -0
- package/src/gates/migration-numbers.mjs +1 -1
- package/src/gates/migration-numbers.test.mjs +1 -0
- package/src/gates/ui-catalog.mjs +45 -0
- package/src/gates/ui-catalog.test.mjs +48 -0
- package/src/gates/ui-dupes.mjs +36 -0
- package/src/gates/ui-dupes.test.mjs +29 -0
- package/src/ui/catalog.mjs +87 -0
- package/src/ui/catalog.test.mjs +54 -0
- package/src/ui/class-sites.mjs +151 -0
- package/src/ui/class-sites.test.mjs +41 -0
- package/src/ui/codemod.mjs +138 -0
- package/src/ui/codemod.test.mjs +140 -0
- package/src/ui/components.mjs +176 -0
- package/src/ui/components.test.mjs +87 -0
- package/src/ui/dupes.mjs +141 -0
- package/src/ui/dupes.test.mjs +85 -0
- package/src/ui/find.mjs +45 -0
- package/src/ui/find.test.mjs +48 -0
- package/src/ui/options.mjs +40 -0
- package/src/ui/scan.mjs +78 -0
- package/src/ui/typescript.mjs +29 -0
- package/templates/github/workflows/ci.yml +54 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// `qc migrations renumber`: moves a branch's migrations after the last one of another ref, so two branches
|
|
2
|
+
// that took the same number merge with no duplicate and no gap.
|
|
3
|
+
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
|
|
9
|
+
export const USAGE = `qc migrations — keep migration numbers unique across branches
|
|
10
|
+
|
|
11
|
+
qc migrations renumber --onto <ref> [--branch <ref>]
|
|
12
|
+
rename the migrations <branch> added since its merge base with <ref> to follow the last
|
|
13
|
+
migration of <ref>, in order, and rewrite each reference to an old name in the tracked files.
|
|
14
|
+
<branch> is HEAD by default; during a merge, pass --onto HEAD --branch MERGE_HEAD.`;
|
|
15
|
+
|
|
16
|
+
const MIGRATION = /^(\d+)_(.*\.sql)$/;
|
|
17
|
+
const TEMP_SUFFIX = ".renumber-tmp";
|
|
18
|
+
|
|
19
|
+
function git(cwd, args) {
|
|
20
|
+
const result = spawnSync("git", args, { cwd, encoding: "utf8", windowsHide: true });
|
|
21
|
+
if (result.status !== 0) throw new Error(`git ${args.join(" ")}: ${(result.stderr ?? "").trim() || `exit ${result.status}`}`);
|
|
22
|
+
return result.stdout ?? "";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const lines = (text) => text.split(/\r?\n/).filter(Boolean);
|
|
26
|
+
|
|
27
|
+
/** The folder as git spells it: forward slashes, no trailing slash. */
|
|
28
|
+
export const posixDir = (dir) => String(dir ?? "").replace(/\\/g, "/").replace(/\/+$/, "");
|
|
29
|
+
|
|
30
|
+
function parsed(name) {
|
|
31
|
+
const match = MIGRATION.exec(name);
|
|
32
|
+
return match ? { name, number: Number(match[1]), digits: match[1].length, rest: match[2] } : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The renames that put `added` after the highest number in `existing`, in number order, then name order.
|
|
37
|
+
* @returns `{ from, to }` for each name that changes
|
|
38
|
+
*/
|
|
39
|
+
export function planRenumber(existing, added) {
|
|
40
|
+
const base = existing.map(parsed).filter(Boolean);
|
|
41
|
+
const mine = added.map(parsed).filter(Boolean).sort((a, b) => a.number - b.number || a.name.localeCompare(b.name));
|
|
42
|
+
const last = base.reduce((max, entry) => Math.max(max, entry.number), 0);
|
|
43
|
+
const width = base[0]?.digits ?? mine[0]?.digits ?? 4;
|
|
44
|
+
return mine.flatMap((entry, index) => {
|
|
45
|
+
const to = `${String(last + index + 1).padStart(width, "0")}_${entry.rest}`;
|
|
46
|
+
return to === entry.name ? [] : [{ from: entry.name, to }];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The migration names in `dir` at `ref`; a ref with no such folder holds none. */
|
|
51
|
+
export function migrationsAt(root, ref, dir) {
|
|
52
|
+
try {
|
|
53
|
+
return lines(git(root, ["ls-tree", "--name-only", `${ref}:${dir}`])).filter((name) => MIGRATION.test(name));
|
|
54
|
+
} catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The migration names `branch` added in `dir` since its merge base with `onto`. */
|
|
60
|
+
export function addedMigrations(root, onto, branch, dir) {
|
|
61
|
+
const base = git(root, ["merge-base", onto, branch]).trim();
|
|
62
|
+
return lines(git(root, ["diff", "--name-only", "--diff-filter=A", base, branch, "--", dir]))
|
|
63
|
+
.filter((file) => path.posix.dirname(file) === dir)
|
|
64
|
+
.map((file) => path.posix.basename(file))
|
|
65
|
+
.filter((name) => MIGRATION.test(name));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** A stem, matched only where no name character follows it, so `0002_add` leaves `0002_add_index` alone. */
|
|
69
|
+
const stemPattern = (stem) => new RegExp(stem.replace(/\W/g, (c) => `\\${c}`) + "(?![A-Za-z0-9_])", "g");
|
|
70
|
+
|
|
71
|
+
/** Renames through a temporary name, so no rename lands on a file that still exists, then rewrites the references. */
|
|
72
|
+
export function applyRenumber(root, dir, plan) {
|
|
73
|
+
for (const { from } of plan) git(root, ["mv", `${dir}/${from}`, `${dir}/${from}${TEMP_SUFFIX}`]);
|
|
74
|
+
for (const { from, to } of plan) git(root, ["mv", `${dir}/${from}${TEMP_SUFFIX}`, `${dir}/${to}`]);
|
|
75
|
+
const touched = new Set();
|
|
76
|
+
for (const { from, to } of plan) {
|
|
77
|
+
const oldStem = from.replace(/\.sql$/, "");
|
|
78
|
+
const newStem = to.replace(/\.sql$/, "");
|
|
79
|
+
const found = spawnSync("git", ["grep", "-l", "-I", "-F", oldStem, "--", "."], { cwd: root, encoding: "utf8", windowsHide: true });
|
|
80
|
+
for (const file of lines(found.stdout ?? "")) {
|
|
81
|
+
const full = path.join(root, file);
|
|
82
|
+
writeFileSync(full, readFileSync(full, "utf8").replace(stemPattern(oldStem), () => newStem));
|
|
83
|
+
touched.add(file);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (touched.size > 0) git(root, ["add", "--", ...touched]);
|
|
87
|
+
return [...touched];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** @returns the renames made and the files whose references were rewritten */
|
|
91
|
+
export function renumber(root, dir, { onto, branch = "HEAD" }) {
|
|
92
|
+
const folder = posixDir(dir);
|
|
93
|
+
const dirty = git(root, ["status", "--porcelain"]).trim() !== "";
|
|
94
|
+
const merging = spawnSync("git", ["rev-parse", "-q", "--verify", "MERGE_HEAD"], { cwd: root, windowsHide: true }).status === 0;
|
|
95
|
+
if (dirty && !merging) throw new Error("the working tree has uncommitted changes; commit or stash them, or run this during a merge");
|
|
96
|
+
const plan = planRenumber(migrationsAt(root, onto, folder), addedMigrations(root, onto, branch, folder));
|
|
97
|
+
const references = plan.length > 0 ? applyRenumber(root, folder, plan) : [];
|
|
98
|
+
return { plan, references };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** `qc migrations`. @returns the exit code */
|
|
102
|
+
export function runMigrations(config, argv, { say = (line) => console.log(line) } = {}) {
|
|
103
|
+
const [sub, ...rest] = argv;
|
|
104
|
+
if (sub !== "renumber") {
|
|
105
|
+
console.error(USAGE);
|
|
106
|
+
return 2;
|
|
107
|
+
}
|
|
108
|
+
let values;
|
|
109
|
+
try {
|
|
110
|
+
({ values } = parseArgs({ args: rest, options: { onto: { type: "string" }, branch: { type: "string" } }, strict: true }));
|
|
111
|
+
if (!values.onto) throw new Error("--onto <ref> is required");
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error(`qc migrations: ${error.message}\n\n${USAGE}`);
|
|
114
|
+
return 2;
|
|
115
|
+
}
|
|
116
|
+
const dir = posixDir(config.paths.migrations);
|
|
117
|
+
try {
|
|
118
|
+
const { plan, references } = renumber(config.root, dir, { onto: values.onto, branch: values.branch ?? "HEAD" });
|
|
119
|
+
for (const { from, to } of plan) say(`rename ${dir}/${from} -> ${to}`);
|
|
120
|
+
for (const file of references) say(`ref ${file}`);
|
|
121
|
+
say(plan.length === 0 ? `OK migrations already follow ${values.onto}` : `OK ${plan.length} migration(s) renumbered after ${values.onto}`);
|
|
122
|
+
return 0;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error(`qc migrations: ${error.message}`);
|
|
125
|
+
return 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { test } from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { planRenumber, renumber } from "./migrations.mjs";
|
|
9
|
+
|
|
10
|
+
const QC = fileURLToPath(new URL("./qc.mjs", import.meta.url));
|
|
11
|
+
const git = (cwd, ...args) => execFileSync("git", args, { cwd, stdio: "pipe", encoding: "utf8" }).trim();
|
|
12
|
+
|
|
13
|
+
function repo(t) {
|
|
14
|
+
const dir = realpathSync.native(mkdtempSync(path.join(os.tmpdir(), "qc-migrations-")));
|
|
15
|
+
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
16
|
+
git(dir, "init", "-q", "-b", "main");
|
|
17
|
+
for (const [key, value] of [["user.name", "qc"], ["user.email", "qc@example.com"], ["commit.gpgsign", "false"], ["core.autocrlf", "false"]]) git(dir, "config", key, value);
|
|
18
|
+
commitFile(dir, "db/0001_init.sql", "select 1;\n");
|
|
19
|
+
return dir;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function commitFile(dir, file, text) {
|
|
23
|
+
mkdirSync(path.dirname(path.join(dir, file)), { recursive: true });
|
|
24
|
+
writeFileSync(path.join(dir, file), text);
|
|
25
|
+
git(dir, "add", ".");
|
|
26
|
+
git(dir, "commit", "-q", "-m", file);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
test("the plan puts the added migrations after the last one, in number order", () => {
|
|
30
|
+
assert.deepEqual(planRenumber(["0001_a.sql", "0002_b.sql"], ["0003_y.sql", "0002_x.sql"]), [
|
|
31
|
+
{ from: "0002_x.sql", to: "0003_x.sql" },
|
|
32
|
+
{ from: "0003_y.sql", to: "0004_y.sql" },
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("a migration already in place is left alone, and a name that is no migration is ignored", () => {
|
|
37
|
+
assert.deepEqual(planRenumber(["0001_a.sql"], ["0002_x.sql", "meta.json"]), []);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("the plan keeps the width of the existing numbers", () => {
|
|
41
|
+
assert.deepEqual(planRenumber(["000009_a.sql"], ["000009_x.sql"]), [{ from: "000009_x.sql", to: "000010_x.sql" }]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("renumber moves the branch's migrations after the base's last, rewrites references, and a second run changes nothing", (t) => {
|
|
45
|
+
const dir = repo(t);
|
|
46
|
+
git(dir, "switch", "-q", "-c", "feat/1-x");
|
|
47
|
+
commitFile(dir, "db/0002_x.sql", "select 2;\n");
|
|
48
|
+
commitFile(dir, "db/meta.json", '{"tag":"0002_x"}\n');
|
|
49
|
+
git(dir, "switch", "-q", "main");
|
|
50
|
+
commitFile(dir, "db/0002_main.sql", "select 3;\n");
|
|
51
|
+
git(dir, "switch", "-q", "feat/1-x");
|
|
52
|
+
git(dir, "merge", "-q", "--no-edit", "main");
|
|
53
|
+
const first = renumber(dir, "db", { onto: "main" });
|
|
54
|
+
assert.deepEqual(first.plan, [{ from: "0002_x.sql", to: "0003_x.sql" }]);
|
|
55
|
+
assert.deepEqual(readdirSync(path.join(dir, "db")).sort(), ["0001_init.sql", "0002_main.sql", "0003_x.sql", "meta.json"]);
|
|
56
|
+
assert.equal(readFileSync(path.join(dir, "db", "meta.json"), "utf8"), '{"tag":"0003_x"}\n');
|
|
57
|
+
git(dir, "commit", "-q", "-m", "renumber");
|
|
58
|
+
assert.deepEqual(renumber(dir, "db", { onto: "main" }).plan, []);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("qc migrations with no subcommand prints its usage and exits 2", (t) => {
|
|
62
|
+
const dir = repo(t);
|
|
63
|
+
const result = spawnSync(process.execPath, [QC, "migrations"], { cwd: dir, encoding: "utf8" });
|
|
64
|
+
assert.equal(result.status, 2);
|
|
65
|
+
assert.match(result.stderr, /qc migrations renumber --onto <ref>/);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("renumber refuses a dirty tree outside a merge", (t) => {
|
|
69
|
+
const dir = repo(t);
|
|
70
|
+
git(dir, "switch", "-q", "-c", "feat/1-x");
|
|
71
|
+
commitFile(dir, "db/0002_x.sql", "select 2;\n");
|
|
72
|
+
writeFileSync(path.join(dir, "stray.txt"), "uncommitted\n");
|
|
73
|
+
assert.throws(() => renumber(dir, "db", { onto: "main" }), /uncommitted|clean/);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("a stem is rewritten only where no name character follows it", () => {
|
|
77
|
+
const dir = realpathSync.native(mkdtempSync(path.join(os.tmpdir(), "qc-migrations-stem-")));
|
|
78
|
+
try {
|
|
79
|
+
git(dir, "init", "-q", "-b", "main");
|
|
80
|
+
for (const [key, value] of [["user.name", "qc"], ["user.email", "qc@example.com"], ["commit.gpgsign", "false"], ["core.autocrlf", "false"]]) git(dir, "config", key, value);
|
|
81
|
+
commitFile(dir, "db/0001_init.sql", "select 1;\n");
|
|
82
|
+
git(dir, "switch", "-q", "-c", "feat/1-x");
|
|
83
|
+
commitFile(dir, "db/0002_add.sql", "select 2;\n");
|
|
84
|
+
commitFile(dir, "refs.txt", "0002_add 0002_add_index\n");
|
|
85
|
+
git(dir, "switch", "-q", "main");
|
|
86
|
+
commitFile(dir, "db/0002_main.sql", "select 3;\n");
|
|
87
|
+
git(dir, "switch", "-q", "feat/1-x");
|
|
88
|
+
git(dir, "merge", "-q", "--no-edit", "main");
|
|
89
|
+
renumber(dir, "db", { onto: "main" });
|
|
90
|
+
assert.equal(readFileSync(path.join(dir, "refs.txt"), "utf8"), "0003_add 0002_add_index\n");
|
|
91
|
+
} finally {
|
|
92
|
+
rmSync(dir, { recursive: true, force: true });
|
|
93
|
+
}
|
|
94
|
+
});
|
|
@@ -5,6 +5,7 @@ import { test } from "node:test";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { dispatchDefaults, runtimeModels } from "../config.mjs";
|
|
7
7
|
import { REMINDER } from "./dispatch-reminder.mjs";
|
|
8
|
+
import { dispatchRefusal, dispatchSettings } from "./dispatch.mjs";
|
|
8
9
|
|
|
9
10
|
const AGENTS = fileURLToPath(new URL("../../../../agents/", import.meta.url));
|
|
10
11
|
const README = fileURLToPath(new URL("../../../../README.md", import.meta.url));
|
|
@@ -45,6 +46,9 @@ const EXPECTED = {
|
|
|
45
46
|
"sdd-reviewer": { model: "inherit", effort: "high", tools: READ_TOOLS },
|
|
46
47
|
"sdd-branch-reviewer": { model: "inherit", effort: "high", tools: READ_TOOLS },
|
|
47
48
|
};
|
|
49
|
+
// The watcher runs one `qc codex-implement` job. It reads no source, so it needs Bash alone and the cheapest model.
|
|
50
|
+
const WATCHER = { codex: { model: "haiku", effort: undefined, tools: ["Bash"] } };
|
|
51
|
+
const SHIPPED = { ...EXPECTED, ...WATCHER };
|
|
48
52
|
// Fields Claude Code ignores on a plugin agent, and the one that drops a repository's CLAUDE.md and rules.
|
|
49
53
|
const FORBIDDEN_FIELDS = ["disallowedTools", "hooks", "mcpServers", "permissionMode", "omitClaudeMd"];
|
|
50
54
|
|
|
@@ -83,7 +87,7 @@ const frontOf = (name) => frontmatterOf(path.join(AGENTS, `${name}.md`));
|
|
|
83
87
|
test("each subagent type inherits the session model, has a model in every runtime, and keeps its effort and tool list", () => {
|
|
84
88
|
assert.deepEqual(
|
|
85
89
|
readdirSync(AGENTS).sort(),
|
|
86
|
-
Object.keys(
|
|
90
|
+
Object.keys(SHIPPED).map((name) => `${name}.md`).sort(),
|
|
87
91
|
"agents/ holds exactly the shipped types",
|
|
88
92
|
);
|
|
89
93
|
for (const [name, want] of Object.entries(EXPECTED)) {
|
|
@@ -100,20 +104,21 @@ test("each subagent type inherits the session model, has a model in every runtim
|
|
|
100
104
|
}
|
|
101
105
|
});
|
|
102
106
|
|
|
103
|
-
test("each listed tool is one a subagent keeps, never Agent and never an MCP tool, and
|
|
104
|
-
for (const name of Object.keys(
|
|
107
|
+
test("each listed tool is one a subagent keeps, never Agent and never an MCP tool, and Bash is always there", () => {
|
|
108
|
+
for (const name of Object.keys(SHIPPED)) {
|
|
105
109
|
const tools = listOf(frontOf(name).tools);
|
|
106
110
|
assert.ok(!tools.includes("Agent"), `${name} can dispatch a subagent`);
|
|
107
111
|
for (const tool of tools) {
|
|
108
112
|
assert.ok(!tool.startsWith("mcp__"), `${name} lists the MCP tool ${tool}`);
|
|
109
113
|
assert.ok(SUBAGENT_TOOLS.has(tool), `${name} lists ${tool}, which no subagent keeps`);
|
|
110
114
|
}
|
|
111
|
-
|
|
115
|
+
assert.ok(tools.includes("Bash"), `${name} lacks Bash`);
|
|
116
|
+
if (name in EXPECTED) assert.ok(tools.includes("Read"), `${name} lacks Read`);
|
|
112
117
|
}
|
|
113
118
|
});
|
|
114
119
|
|
|
115
120
|
test("no type sets a field a plugin agent ignores, or one that drops the repository's CLAUDE.md", () => {
|
|
116
|
-
for (const name of Object.keys(
|
|
121
|
+
for (const name of Object.keys(SHIPPED)) {
|
|
117
122
|
const front = frontOf(name);
|
|
118
123
|
for (const field of FORBIDDEN_FIELDS) assert.equal(front[field], undefined, `${name} sets ${field}`);
|
|
119
124
|
}
|
|
@@ -121,8 +126,8 @@ test("no type sets a field a plugin agent ignores, or one that drops the reposit
|
|
|
121
126
|
|
|
122
127
|
test("the README table gives each shipped type the tools its definition lists, and no other type", () => {
|
|
123
128
|
const documented = readmeToolsOf(readFileSync(README, "utf8"));
|
|
124
|
-
assert.deepEqual(Object.keys(documented).sort(), Object.keys(
|
|
125
|
-
for (const [name, want] of Object.entries(
|
|
129
|
+
assert.deepEqual(Object.keys(documented).sort(), Object.keys(SHIPPED).sort());
|
|
130
|
+
for (const [name, want] of Object.entries(SHIPPED)) assert.deepEqual(documented[name], want.tools, name);
|
|
126
131
|
});
|
|
127
132
|
|
|
128
133
|
test("the README reader takes a CRLF checkout and skips the rows of other tables", () => {
|
|
@@ -149,7 +154,7 @@ test("the default allowed types are the shipped types, bare and scoped", () => {
|
|
|
149
154
|
|
|
150
155
|
test("no type pins a prompt cache lifetime, so a user's own setting decides it", () => {
|
|
151
156
|
// The measured one-hour lifetime cost more for all four types; `qc tokens` reports it per session.
|
|
152
|
-
for (const name of Object.keys(
|
|
157
|
+
for (const name of Object.keys(SHIPPED)) {
|
|
153
158
|
const front = frontOf(name);
|
|
154
159
|
assert.equal(front.experimental, undefined, `${name} sets experimental`);
|
|
155
160
|
assert.equal(front.cacheTtl, undefined, `${name} sets cacheTtl`);
|
|
@@ -166,3 +171,25 @@ test("both reviewers review only the increment when the dispatch carries a Revie
|
|
|
166
171
|
assert.ok(text.indexOf("`Reviewed: <sha>`") < text.indexOf("`VERDICT: APPROVED <sha>`"), `${name} keeps the verdict line rule last`);
|
|
167
172
|
}
|
|
168
173
|
});
|
|
174
|
+
|
|
175
|
+
test("the codex watcher runs on haiku with Bash alone, and the guard accepts haiku or sonnet for it", () => {
|
|
176
|
+
const front = frontOf("codex");
|
|
177
|
+
assert.equal(front.name, "codex");
|
|
178
|
+
assert.equal(front.model, WATCHER.codex.model);
|
|
179
|
+
assert.deepEqual(listOf(front.tools), WATCHER.codex.tools);
|
|
180
|
+
for (const type of ["codex", `${PLUGIN}:codex`]) assert.deepEqual(runtimeModels.claude[type], ["haiku", "sonnet"], type);
|
|
181
|
+
const settings = dispatchSettings({ dispatch: {} }, "claude");
|
|
182
|
+
for (const model of ["haiku", "sonnet"]) {
|
|
183
|
+
assert.equal(dispatchRefusal({ subagent_type: `${PLUGIN}:codex`, model, prompt: "Brief: b" }, settings), null, model);
|
|
184
|
+
}
|
|
185
|
+
assert.match(dispatchRefusal({ subagent_type: `${PLUGIN}:codex`, model: "opus", prompt: "Brief: b" }, settings) ?? "", /haiku, sonnet/);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("the codex watcher starts one background job and polls the wrapper file with until grep", () => {
|
|
189
|
+
const text = readFileSync(path.join(AGENTS, "codex.md"), "utf8").replace(/\r/g, "");
|
|
190
|
+
assert.ok(text.includes("run_in_background: true"));
|
|
191
|
+
assert.ok(text.includes("codex-implement --brief"));
|
|
192
|
+
assert.ok(text.includes("until grep -q"));
|
|
193
|
+
assert.ok(text.includes("Never pipe `tail -f` into `grep -m1`"));
|
|
194
|
+
assert.ok(!/^\s*tail -f/m.test(text), "no step runs tail -f");
|
|
195
|
+
});
|
package/src/cli/qc.mjs
CHANGED
|
@@ -25,13 +25,27 @@ const USAGE = `qc — architecture gates
|
|
|
25
25
|
qc ledger [--cost] [branch] the workflow ledger: dispatches, stops, verdicts, merges, issue updates; --cost totals tokens and tool calls
|
|
26
26
|
qc codex-implement --brief <file> --worktree <path> --progress <file> [--log <file>] [--max-runs <n>]
|
|
27
27
|
run a brief through codex exec as an implementer, restarting until the progress file says ALL TASKS DONE; exit 2 on a Codex limit
|
|
28
|
+
qc gate-slot [--slots <n>] -- <command...>
|
|
29
|
+
run a heavy local command in one of the machine's gate slots; --status lists them
|
|
30
|
+
qc watch [--pr <n>]... [--codex <wrapper.log>]... [--run <workflow>@<branch>]... [--max <minutes>] [--repo <owner/name>] [--interval <seconds>]
|
|
31
|
+
block until the first event among the items, print one EVENT line; exit 0 done, 4 bound (default 55 minutes), 5 failed, 6 queued past 15 minutes
|
|
28
32
|
qc plan-check <plan.md> each task names files, a test step and a commit step, within the tool-call budget
|
|
29
33
|
qc tokens [--session <id>] [--project <dir>] [--claude-dir <dir>] [--json]
|
|
30
34
|
one session's tokens and cache hit rate per agent type, from its transcripts
|
|
35
|
+
qc throwaway-db [--port <n>|auto] -- <command...>
|
|
36
|
+
run a command on a database of its own, in a container on a free port
|
|
37
|
+
qc retry-failed --report <json> --rerun "<command>" -- <command...>
|
|
38
|
+
rerun only the failed test files once before the run fails
|
|
39
|
+
qc ui <catalog|find|dupes|codemod>
|
|
40
|
+
the component catalog, a search over it, a duplicate finder and a class-token codemod
|
|
31
41
|
qc worktree add <name> <branch> [--from <ref>]
|
|
32
42
|
fetch, add .worktree/<name> in the main checkout, install, print the path
|
|
33
43
|
qc worktree remove <name>
|
|
34
44
|
refuse a dirty tree; delete it, then its branch once merged, pushed, or a merged PR head
|
|
45
|
+
qc migrations renumber --onto <ref> [--branch <ref>]
|
|
46
|
+
move this branch's migrations after the last one of <ref>, and rewrite references
|
|
47
|
+
qc integrate --issue <n> [--type <t>] [--slug <s>] [--from <ref>] <branch>...
|
|
48
|
+
one <t>/<n>-<s> branch for a batch: merge, renumber, regenerate; stop on a conflict
|
|
35
49
|
qc enforcement-map refresh the generated rule/gate table in docs/enforcement.md
|
|
36
50
|
qc doctor the hooks and the lockfile must run the same harness
|
|
37
51
|
qc config print the resolved configuration
|
|
@@ -50,6 +64,16 @@ async function main() {
|
|
|
50
64
|
const { runCodexImplement } = await import("./codex-implement.mjs");
|
|
51
65
|
process.exit(await runCodexImplement(rest));
|
|
52
66
|
}
|
|
67
|
+
// The slots are machine-wide, so the runner reads no configuration.
|
|
68
|
+
if (command === "gate-slot") {
|
|
69
|
+
const { runGateSlot } = await import("./gate-slot.mjs");
|
|
70
|
+
process.exit(await runGateSlot(rest));
|
|
71
|
+
}
|
|
72
|
+
// The watcher reads no configuration either.
|
|
73
|
+
if (command === "watch") {
|
|
74
|
+
const { runWatch } = await import("./watch.mjs");
|
|
75
|
+
process.exit(await runWatch(rest));
|
|
76
|
+
}
|
|
53
77
|
const config = load(process.cwd());
|
|
54
78
|
|
|
55
79
|
switch (command) {
|
|
@@ -115,6 +139,14 @@ async function main() {
|
|
|
115
139
|
const { runTokens } = await import("./tokens.mjs");
|
|
116
140
|
process.exit(runTokens(config, rest));
|
|
117
141
|
}
|
|
142
|
+
case "throwaway-db": {
|
|
143
|
+
const { runThrowawayDb } = await import("./throwaway-db.mjs");
|
|
144
|
+
process.exit(await runThrowawayDb(config, rest));
|
|
145
|
+
}
|
|
146
|
+
case "retry-failed": {
|
|
147
|
+
const { runRetryFailed } = await import("./retry-failed.mjs");
|
|
148
|
+
process.exit(await runRetryFailed(rest));
|
|
149
|
+
}
|
|
118
150
|
case "decisions": {
|
|
119
151
|
const { runDecisions } = await import("./decisions.mjs");
|
|
120
152
|
process.exit(await runDecisions(config, rest));
|
|
@@ -124,6 +156,18 @@ async function main() {
|
|
|
124
156
|
const { runWorktree } = await import("./worktree.mjs");
|
|
125
157
|
process.exit(await runWorktree(config, rest));
|
|
126
158
|
}
|
|
159
|
+
case "migrations": {
|
|
160
|
+
const { runMigrations } = await import("./migrations.mjs");
|
|
161
|
+
process.exit(runMigrations(config, rest));
|
|
162
|
+
}
|
|
163
|
+
case "integrate": {
|
|
164
|
+
const { runIntegrate } = await import("./integrate.mjs");
|
|
165
|
+
process.exit(await runIntegrate(config, rest));
|
|
166
|
+
}
|
|
167
|
+
case "ui": {
|
|
168
|
+
const { runUi } = await import("./ui.mjs");
|
|
169
|
+
process.exit(await runUi(config, rest));
|
|
170
|
+
}
|
|
127
171
|
case "enforcement-map": {
|
|
128
172
|
const { runSyncEnforcementMap } = await import("./sync-enforcement-map.mjs");
|
|
129
173
|
await runSyncEnforcementMap(config);
|
package/src/cli/report-stop.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { checkoutRootOf } from "./checkout-root.mjs";
|
|
|
8
8
|
import { branchAt, branchesAt, gitOut, pathKey } from "./git-read.mjs";
|
|
9
9
|
import { checkHandoffFile, handoffPathOf } from "./handoff-note.mjs";
|
|
10
10
|
import { appendRecord, readLedger } from "./ledger.mjs";
|
|
11
|
+
import { scopeOf } from "./review-gate.mjs";
|
|
11
12
|
import { dropReport, keepReport, reportOf } from "./report-stash.mjs";
|
|
12
13
|
import { commitLookup, firstUserText, resolveNamedWorktree, workflowOfRepo } from "./workflow-place.mjs";
|
|
13
14
|
import { agentTranscriptOf } from "./transcript-usage.mjs";
|
|
@@ -165,6 +166,7 @@ function recordStop({ workflow, call, session, agentId, role, worktree, verdict,
|
|
|
165
166
|
appendRecord(workflow.ledger, { type: "stop", session, agentType: call.agent_type, agentId, role, ...place, ...handedOff });
|
|
166
167
|
// A failed read keeps the sha as the reviewer wrote it, which the gates match by prefix.
|
|
167
168
|
const sha = lookup?.sha ?? (lookup?.error ? verdict.sha : null);
|
|
169
|
+
const scope = role === "branch" ? scopeOf(firstUserText(agentTranscriptOf(call))) : null;
|
|
168
170
|
if (verdict && sha) {
|
|
169
171
|
appendRecord(workflow.ledger, {
|
|
170
172
|
type: "verdict",
|
|
@@ -175,6 +177,7 @@ function recordStop({ workflow, call, session, agentId, role, worktree, verdict,
|
|
|
175
177
|
sha,
|
|
176
178
|
branch: lookup.sha ? branchOf(workflow, sha, { worktree, dispatches: dispatchesOf(records, session) }) : null,
|
|
177
179
|
redChecked: RED_CHECKED_LINE.test(text),
|
|
180
|
+
...(scope ? { scope } : {}),
|
|
178
181
|
});
|
|
179
182
|
}
|
|
180
183
|
dropReport(session, agentId, tmp);
|
|
@@ -542,3 +542,11 @@ test("the no-transcript line is left off for an agent type the workflow does not
|
|
|
542
542
|
assert.equal(decide(bare(stop(ws.on, "Explore", "done")), ws.tmp), null);
|
|
543
543
|
assert.equal(decide(bare(handback(ws.on, "Explore", "done")), ws.tmp), null);
|
|
544
544
|
});
|
|
545
|
+
|
|
546
|
+
test("a branch review records the scope its prompt names on its verdict", (t) => {
|
|
547
|
+
const ws = workspace(t);
|
|
548
|
+
const named = { agent_transcript_path: transcript(ws, "scoped", `Review the branch.\nWorktree: ${ws.on}\nScope: Photos\n`) };
|
|
549
|
+
decide({ ...stop(ws.on, "architecture:sdd-branch-reviewer", `VERDICT: APPROVED ${ws.head}\nAll good.`), ...named }, ws.tmp);
|
|
550
|
+
const verdict = readLedger(ws.ledger).find((record) => record.type === "verdict");
|
|
551
|
+
assert.equal(verdict?.scope, "photos");
|
|
552
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// `qc retry-failed`: a run that fails only in a few test files reruns those files once before it fails.
|
|
2
|
+
// A load flake passes on the rerun; a real failure fails twice, and any other failure is never rerun.
|
|
3
|
+
|
|
4
|
+
import { readFileSync, rmSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { parseArgs } from "node:util";
|
|
7
|
+
import { commandLine, runInShell, splitAtDashes } from "./child-run.mjs";
|
|
8
|
+
|
|
9
|
+
export const USAGE = `qc retry-failed — rerun only the failed test files, once, before a run fails
|
|
10
|
+
|
|
11
|
+
qc retry-failed --report <json> --rerun "<command>" [--max-files <n>] -- <command...>
|
|
12
|
+
run <command>. When it fails and <json>, the Jest or Vitest JSON report the run wrote, names at
|
|
13
|
+
most --max-files failed test files (5 by default), run "<rerun> <files>" once and exit with its
|
|
14
|
+
code. Any other failure exits with the first code. The report is removed before the run.`;
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_MAX_FILES = 5;
|
|
17
|
+
|
|
18
|
+
const readText = (file) => {
|
|
19
|
+
try {
|
|
20
|
+
return readFileSync(file, "utf8");
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** The failed test files of a Jest or Vitest JSON report, relative to `root`, or null when the text is no such report. */
|
|
27
|
+
export function failedFiles(text, root) {
|
|
28
|
+
let report;
|
|
29
|
+
try {
|
|
30
|
+
report = JSON.parse(text);
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (!report || !Array.isArray(report.testResults)) return null;
|
|
35
|
+
return report.testResults
|
|
36
|
+
.filter((result) => result?.status === "failed" && typeof result.name === "string")
|
|
37
|
+
.map((result) => (path.isAbsolute(result.name) ? path.relative(root, result.name) : result.name).split(path.sep).join("/"));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** `qc retry-failed`. @returns the exit code */
|
|
41
|
+
export async function runRetryFailed(argv, deps = {}) {
|
|
42
|
+
const {
|
|
43
|
+
run = runInShell,
|
|
44
|
+
read = readText,
|
|
45
|
+
remove = (file) => rmSync(file, { force: true }),
|
|
46
|
+
cwd = process.cwd(),
|
|
47
|
+
env = process.env,
|
|
48
|
+
say = (line) => console.error(line),
|
|
49
|
+
} = deps;
|
|
50
|
+
const { flags, command } = splitAtDashes(argv);
|
|
51
|
+
let values;
|
|
52
|
+
let maxFiles;
|
|
53
|
+
try {
|
|
54
|
+
({ values } = parseArgs({ args: flags, options: { report: { type: "string" }, rerun: { type: "string" }, "max-files": { type: "string" } }, strict: true }));
|
|
55
|
+
if (!values.report || !values.rerun || command.length === 0) throw new Error("--report, --rerun, and a command after -- are required");
|
|
56
|
+
maxFiles = Number(values["max-files"] ?? DEFAULT_MAX_FILES);
|
|
57
|
+
if (!Number.isInteger(maxFiles) || maxFiles < 1) throw new Error(`--max-files must be a positive integer, got ${values["max-files"]}`);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
say(`qc retry-failed: ${error.message}\n\n${USAGE}`);
|
|
60
|
+
return 2;
|
|
61
|
+
}
|
|
62
|
+
const reportFile = path.resolve(cwd, values.report);
|
|
63
|
+
remove(reportFile);
|
|
64
|
+
const first = await run(commandLine(command), env, cwd);
|
|
65
|
+
if (first === 0) return 0;
|
|
66
|
+
const text = read(reportFile);
|
|
67
|
+
const files = text === null ? null : failedFiles(text, cwd);
|
|
68
|
+
if (files === null || files.length === 0) {
|
|
69
|
+
say(`qc retry-failed: the run failed with no failed test file in ${values.report}, so nothing is rerun`);
|
|
70
|
+
return first;
|
|
71
|
+
}
|
|
72
|
+
if (files.length > maxFiles) {
|
|
73
|
+
say(`qc retry-failed: ${files.length} test files failed, over --max-files ${maxFiles}, so nothing is rerun`);
|
|
74
|
+
return first;
|
|
75
|
+
}
|
|
76
|
+
say(`qc retry-failed: ${files.length} test file(s) failed; rerunning them once: ${files.join(" ")}`);
|
|
77
|
+
const second = await run(`${values.rerun} ${commandLine(files)}`, env, cwd);
|
|
78
|
+
if (second === 0) say(`qc retry-failed: the rerun passed, so these files are flaky: ${files.join(" ")}`);
|
|
79
|
+
return second;
|
|
80
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { test } from "node:test";
|
|
4
|
+
import { failedFiles, runRetryFailed } from "./retry-failed.mjs";
|
|
5
|
+
|
|
6
|
+
const ROOT = path.resolve("/repo");
|
|
7
|
+
const report = (...results) => JSON.stringify({ testResults: results.map(([name, status]) => ({ name: path.join(ROOT, name), status })) });
|
|
8
|
+
|
|
9
|
+
test("the failed files of a Jest or Vitest report are read relative to the root", () => {
|
|
10
|
+
assert.deepEqual(failedFiles(report(["src/a.test.ts", "failed"], ["src/b.test.ts", "passed"]), ROOT), ["src/a.test.ts"]);
|
|
11
|
+
assert.equal(failedFiles("not json", ROOT), null);
|
|
12
|
+
assert.equal(failedFiles("{}", ROOT), null);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/** A runner that answers from a list of exit codes, and records each command. */
|
|
16
|
+
function scripted(codes, ran) {
|
|
17
|
+
return async (command) => {
|
|
18
|
+
ran.push(command);
|
|
19
|
+
return codes.shift();
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const deps = (overrides) => ({ cwd: ROOT, env: {}, say: () => {}, remove: () => {}, ...overrides });
|
|
24
|
+
|
|
25
|
+
test("a run that fails in two test files reruns only those files once, and passes when the rerun passes", async () => {
|
|
26
|
+
const ran = [];
|
|
27
|
+
const code = await runRetryFailed(["--report", "r.json", "--rerun", "pnpm vitest run", "--", "pnpm", "check:local"], deps({
|
|
28
|
+
run: scripted([1, 0], ran),
|
|
29
|
+
read: () => report(["src/a.test.ts", "failed"], ["src/b.test.ts", "failed"]),
|
|
30
|
+
}));
|
|
31
|
+
assert.equal(code, 0);
|
|
32
|
+
assert.deepEqual(ran, ["pnpm check:local", "pnpm vitest run src/a.test.ts src/b.test.ts"]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("a failure with no report, or with more failed files than the limit, is not rerun", async () => {
|
|
36
|
+
const ran = [];
|
|
37
|
+
const argv = ["--report", "r.json", "--rerun", "pnpm vitest run", "--max-files", "1", "--", "pnpm", "check:local"];
|
|
38
|
+
assert.equal(await runRetryFailed(argv, deps({ run: scripted([3], ran), read: () => null })), 3);
|
|
39
|
+
assert.equal(await runRetryFailed(argv, deps({ run: scripted([1], ran), read: () => report(["a.test.ts", "failed"], ["b.test.ts", "failed"]) })), 1);
|
|
40
|
+
assert.deepEqual(ran, ["pnpm check:local", "pnpm check:local"]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("the report of an earlier run is removed before the command runs", async () => {
|
|
44
|
+
const removed = [];
|
|
45
|
+
await runRetryFailed(["--report", "r.json", "--rerun", "x", "--", "y"], deps({ run: async () => 0, read: () => null, remove: (file) => removed.push(file) }));
|
|
46
|
+
assert.deepEqual(removed, [path.join(ROOT, "r.json")]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("a missing flag or command is a usage error", async () => {
|
|
50
|
+
assert.equal(await runRetryFailed(["--", "pnpm", "test"], deps({ run: async () => 0, read: () => null })), 2);
|
|
51
|
+
});
|
package/src/cli/review-gate.mjs
CHANGED
|
@@ -25,6 +25,11 @@ const KNOWN_EXTENSIONS = new Set(
|
|
|
25
25
|
"mjs cjs js jsx ts tsx json md yml yaml sh sql css html cs py go rs toml txt xml csv".split(" "),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
+
const SCOPE_LINE = /^[ \t]*Scope:[ \t]*(\S.*?)[ \t]*$/im;
|
|
29
|
+
|
|
30
|
+
/** The scope on a prompt's `Scope:` line, in lowercase, or null. */
|
|
31
|
+
export const scopeOf = (prompt) => SCOPE_LINE.exec(String(prompt ?? ""))?.[1]?.toLowerCase() ?? null;
|
|
32
|
+
|
|
28
33
|
const short = (sha) => (typeof sha === "string" ? sha.slice(0, 7) : "(none)");
|
|
29
34
|
const pass = (note = null) => ({ refusal: null, note });
|
|
30
35
|
const refuse = (refusal) => ({ refusal, note: null });
|
|
@@ -51,20 +56,24 @@ export const unreadableRefusal = (type, why) =>
|
|
|
51
56
|
"Add a line `Worktree: <path>` that names a worktree whose checked-out branch is the branch under review, then dispatch.";
|
|
52
57
|
|
|
53
58
|
function branchReviewRefusal({ records, branch, prompt }) {
|
|
54
|
-
const
|
|
59
|
+
const scope = scopeOf(prompt);
|
|
60
|
+
const counts = (record) =>
|
|
61
|
+
record.type === "verdict" && record.kind === "branch" && record.branch === branch && (scope === null || record.scope === scope);
|
|
62
|
+
const last = records.findLast(counts);
|
|
55
63
|
if (!last) return null;
|
|
56
64
|
const named = reviewedShaOf(prompt);
|
|
65
|
+
const which = scope === null ? "a branch review" : `a branch review of scope "${scope}"`;
|
|
57
66
|
if (named === null) {
|
|
58
67
|
return (
|
|
59
|
-
`Task gate: ${branch} already has
|
|
60
|
-
`Send the incremental review: add a line \`Reviewed: ${short(last.sha)}\`, the last head a branch review named, and pass the delta diff ${short(last.sha)}..<head> in place of the whole branch
|
|
68
|
+
`Task gate: ${branch} already has ${which} in the ledger (${short(last.sha)}), and a PR gets one. ` +
|
|
69
|
+
`Send the incremental review: add a line \`Reviewed: ${short(last.sha)}\`, the last head a branch review named, and pass the delta diff ${short(last.sha)}..<head> in place of the whole branch. ` +
|
|
70
|
+
"A review of another part of the branch runs beside it with its own line `Scope: <name>`."
|
|
61
71
|
);
|
|
62
72
|
}
|
|
63
|
-
|
|
64
|
-
if (known) return null;
|
|
73
|
+
if (records.some((record) => counts(record) && shaMatches(record.sha, named))) return null;
|
|
65
74
|
return (
|
|
66
|
-
`Task gate: \`Reviewed: ${short(named)}\` is no head
|
|
67
|
-
`Write the last head
|
|
75
|
+
`Task gate: \`Reviewed: ${short(named)}\` is no head ${which} of ${branch} named. ` +
|
|
76
|
+
`Write the last head ${which} named: \`Reviewed: ${short(last.sha)}\`.`
|
|
68
77
|
);
|
|
69
78
|
}
|
|
70
79
|
|