@davidbyoung/software-factory 0.1.3 → 0.1.5

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.
Files changed (80) hide show
  1. package/README.md +12 -11
  2. package/actions/factory-agent/action.yml +1 -1
  3. package/agents/factory-e2e-reviewer.md +102 -0
  4. package/agents/factory-test-reviewer.md +26 -64
  5. package/agents/factory-ticket-readiness.md +14 -6
  6. package/dist/cli.mjs +28 -1
  7. package/dist/code-host/github-setup.mjs +1 -1
  8. package/dist/commands.d.mts +16 -0
  9. package/dist/commands.mjs +129 -0
  10. package/dist/config.d.mts +61 -13
  11. package/dist/config.mjs +271 -69
  12. package/dist/deps.d.mts +7 -4
  13. package/dist/deps.mjs +20 -9
  14. package/dist/doctor.d.mts +3 -2
  15. package/dist/doctor.mjs +19 -4
  16. package/dist/explain.d.mts +4 -2
  17. package/dist/explain.mjs +70 -23
  18. package/dist/guard-commit.d.mts +7 -2
  19. package/dist/guard-commit.mjs +58 -21
  20. package/dist/init.d.mts +4 -2
  21. package/dist/init.mjs +18 -8
  22. package/dist/lib/default-branch.d.mts +35 -0
  23. package/dist/lib/default-branch.mjs +117 -0
  24. package/dist/lib/refined-check.d.mts +7 -0
  25. package/dist/lib/refined-check.mjs +76 -0
  26. package/dist/lib/work-status.d.mts +2 -2
  27. package/dist/lib/work-status.mjs +4 -4
  28. package/dist/parts.d.mts +1 -1
  29. package/dist/parts.mjs +2 -2
  30. package/dist/patch-coverage.d.mts +13 -0
  31. package/dist/patch-coverage.mjs +73 -0
  32. package/dist/pr-watch.d.mts +3 -2
  33. package/dist/pr-watch.mjs +22 -5
  34. package/dist/pr.mjs +34 -2
  35. package/dist/review-cost.mjs +1 -1
  36. package/dist/review-tools.mjs +3 -3
  37. package/dist/session-start.d.mts +23 -13
  38. package/dist/session-start.mjs +56 -44
  39. package/dist/site/servers.d.mts +6 -2
  40. package/dist/site/servers.mjs +14 -9
  41. package/dist/site.mjs +2 -2
  42. package/dist/sync.d.mts +8 -2
  43. package/dist/sync.mjs +41 -7
  44. package/dist/ticket.mjs +19 -1
  45. package/docs/builds.md +8 -8
  46. package/docs/cli.md +82 -45
  47. package/docs/configuration.md +838 -565
  48. package/docs/design.md +17 -4
  49. package/docs/developing.md +44 -8
  50. package/docs/existing-repo.md +9 -7
  51. package/docs/github/by-hand.md +27 -14
  52. package/docs/github/reference.md +21 -16
  53. package/docs/github/setup.md +14 -11
  54. package/docs/glossary.md +14 -5
  55. package/docs/limitations.md +27 -2
  56. package/docs/plugins.md +307 -52
  57. package/docs/quick-start.md +37 -9
  58. package/docs/removing.md +2 -2
  59. package/docs/skills.md +103 -54
  60. package/docs/updating.md +149 -3
  61. package/docs/workflow.md +13 -10
  62. package/package.json +1 -1
  63. package/review.md +20 -11
  64. package/rules.md +23 -19
  65. package/settings.schema.json +292 -72
  66. package/skills/factory-address-review/SKILL.md +50 -30
  67. package/skills/factory-build/SKILL.md +76 -23
  68. package/skills/factory-deps/SKILL.md +46 -21
  69. package/skills/factory-design/SKILL.md +18 -9
  70. package/skills/factory-diagnose/SKILL.md +22 -20
  71. package/skills/factory-mutate/SKILL.md +38 -24
  72. package/skills/factory-refine/SKILL.md +55 -31
  73. package/skills/factory-resolve-conflicts/SKILL.md +76 -34
  74. package/skills/factory-trace/SKILL.md +3 -2
  75. package/workflows/factory-build.yml +1 -1
  76. package/workflows/factory-claude-review.yml +1 -1
  77. package/workflows/factory-conflicts.yml +8 -8
  78. package/workflows/factory-deps.yml +1 -1
  79. package/workflows/factory-review.yml +1 -1
  80. package/skills/factory-address-review/patch-coverage.py +0 -68
@@ -1,45 +1,43 @@
1
1
  // The SessionStart hook, run as `factory session-start`. Its output opens
2
2
  // the session's context, so work left on another branch is visible before
3
3
  // anything new starts: the checkout's state, the local branches with work
4
- // not on origin/main, then each ticket's state.
5
- import { spawnSync } from "node:child_process";
4
+ // not on the default branch, then each ticket's state.
6
5
  import { readFileSync } from "node:fs";
7
6
  import { join } from "node:path";
8
- export const gitIn = (cwd) => (args) => {
9
- const r = spawnSync("git", args, {
10
- cwd,
11
- encoding: "utf8",
12
- stdio: ["ignore", "pipe", "ignore"],
13
- });
14
- return { ok: r.status === 0, out: r.stdout ?? "" };
15
- };
16
- /** Each local branch but main with work origin/main lacks, as
17
- * "NAME (N commits not on origin/main)". Pull requests are squash-merged, so
18
- * a merged branch still has commits main lacks: it counts as merged when
19
- * merging it into main would change nothing. */
20
- export function unmergedBranches(git) {
21
- const mainTree = git(["rev-parse", "origin/main^{tree}"]).out.trim();
7
+ import { branchDeps, CANNOT_TELL, defaultBranch, gitIn, } from "./lib/default-branch.mjs";
8
+ export { gitIn };
9
+ /** Each local branch but the default one, `branch`, with work
10
+ * origin/BRANCH lacks, as "NAME (N commits not on origin/BRANCH)". Pull
11
+ * requests are squash-merged, so a merged branch still has commits the
12
+ * default branch lacks: it counts as merged when merging it into the
13
+ * default branch would change nothing. */
14
+ export function unmergedBranches(git, branch) {
15
+ const base = `origin/${branch}`;
16
+ const baseTree = git(["rev-parse", `${base}^{tree}`]).out.trim();
22
17
  const branches = git([
23
18
  "for-each-ref",
24
19
  "--format=%(refname:short)",
25
20
  "refs/heads",
26
21
  ])
27
22
  .out.split("\n")
28
- .filter((b) => b && b !== "main");
23
+ .filter((b) => b && b !== branch);
29
24
  const found = [];
30
25
  for (const b of branches) {
31
- const merged = git(["merge-tree", "--write-tree", "origin/main", b]);
32
- if (merged.ok && merged.out.split("\n")[0] === mainTree)
26
+ const merged = git(["merge-tree", "--write-tree", base, b]);
27
+ if (merged.ok && merged.out.split("\n")[0] === baseTree)
33
28
  continue;
34
- const count = Number(git(["rev-list", "--count", `origin/main..${b}`]).out.trim() || 0);
29
+ const count = Number(git(["rev-list", "--count", `${base}..${b}`]).out.trim() || 0);
35
30
  if (count > 0)
36
- found.push(`${b} (${count} commits not on origin/main)`);
31
+ found.push(`${b} (${count} commits not on ${base})`);
37
32
  }
38
33
  return found;
39
34
  }
40
- /** What the hook prints before the tickets' state. */
41
- export function repositoryState(git) {
42
- git(["fetch", "-q", "origin", "main"]);
35
+ /** What the hook prints before the tickets' state. `branch` is the default
36
+ * branch, or null when it could not be told: then no branch is compared
37
+ * with anything, and the line that names the fix stands in for the list. */
38
+ export function repositoryState(git, branch) {
39
+ if (branch !== null)
40
+ git(["fetch", "-q", "origin", branch]);
43
41
  const lines = [
44
42
  "## Repository state at session start",
45
43
  "",
@@ -48,9 +46,11 @@ export function repositoryState(git) {
48
46
  "```",
49
47
  "",
50
48
  ];
51
- const unmerged = unmergedBranches(git);
49
+ if (branch === null)
50
+ return [...lines, CANNOT_TELL];
51
+ const unmerged = unmergedBranches(git, branch);
52
52
  if (unmerged.length) {
53
- lines.push("Local branches with work not on origin/main:", "", ...unmerged.map((b) => `- ${b}`), "", "Mention any of these to the user before starting work on another branch.");
53
+ lines.push(`Local branches with work not on origin/${branch}:`, "", ...unmerged.map((b) => `- ${b}`), "", "Mention any of these to the user before starting work on another branch.");
54
54
  }
55
55
  return lines;
56
56
  }
@@ -86,6 +86,15 @@ export function installBehind(dir) {
86
86
  }
87
87
  return null;
88
88
  }
89
+ export async function main(d) {
90
+ const branch = await defaultBranch(d.branch).catch(() => null);
91
+ d.out(repositoryState(gitIn(d.dir), branch).join("\n"));
92
+ const behind = installBehind(d.dir);
93
+ if (behind)
94
+ d.out(`\n${behind}\n`);
95
+ return d.tickets();
96
+ }
97
+ /** `factory session-start`. */
89
98
  export async function run() {
90
99
  const dir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
91
100
  try {
@@ -94,22 +103,25 @@ export async function run() {
94
103
  catch {
95
104
  return 0;
96
105
  }
97
- console.log(repositoryState(gitIn(dir)).join("\n"));
98
- const behind = installBehind(dir);
99
- if (behind)
100
- console.log(`\n${behind}\n`);
101
- // What each ticket's board card says, and who is working on it. The status
102
- // command enforces its own time limit, since a hook the harness kills
103
- // prints nothing.
104
- const error = console.error;
105
- console.error = () => { };
106
- try {
107
- return await (await import("./status.mjs")).run(["--hook"]);
108
- }
109
- catch {
110
- return 0;
111
- }
112
- finally {
113
- console.error = error;
114
- }
106
+ return main({
107
+ dir,
108
+ branch: branchDeps(dir),
109
+ out: (text) => console.log(text),
110
+ // What each ticket's board card says, and who is working on it. The
111
+ // status command enforces its own time limit, since a hook the harness
112
+ // kills prints nothing.
113
+ tickets: async () => {
114
+ const error = console.error;
115
+ console.error = () => { };
116
+ try {
117
+ return await (await import("./status.mjs")).run(["--hook"]);
118
+ }
119
+ catch {
120
+ return 0;
121
+ }
122
+ finally {
123
+ console.error = error;
124
+ }
125
+ },
126
+ });
115
127
  }
@@ -1,3 +1,4 @@
1
+ import { type Deps as BranchDeps } from "../lib/default-branch.mts";
1
2
  export declare class SiteError extends Error {
2
3
  }
3
4
  export type Running = {
@@ -25,8 +26,11 @@ export declare function startSite(opts: {
25
26
  * that stops the others. */
26
27
  export declare function startSites(sites: Parameters<typeof startSite>[0][], pids: number[]): Promise<Running[]>;
27
28
  export declare function stopProcess(pid: number): void;
28
- /** Whether the repository is a git checkout with this ref. */
29
- export declare const defaultBranch: (root: string) => string;
29
+ /** The ref a comparison's base is started from when none is given: the
30
+ * default branch, as `origin` has it, or the checkout's own branch of that
31
+ * name where there is no such ref, as in a checkout with no remote. It
32
+ * fails, naming the fix, when the default branch cannot be told. */
33
+ export declare function defaultBase(root: string, d?: BranchDeps): Promise<string>;
30
34
  /** A detached worktree of `ref` in a temporary folder, with its dependencies
31
35
  * installed when it has a lockfile. Returns its path. */
32
36
  export declare function addWorktree(root: string, ref: string): string;
@@ -6,6 +6,7 @@ import { createServer } from "node:net";
6
6
  import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
7
7
  import { tmpdir } from "node:os";
8
8
  import { join } from "node:path";
9
+ import { branchDeps, CANNOT_TELL, defaultBranch, } from "../lib/default-branch.mjs";
9
10
  export class SiteError extends Error {
10
11
  }
11
12
  /** A port nothing is listening on. */
@@ -80,15 +81,19 @@ export function stopProcess(pid) {
80
81
  }
81
82
  }
82
83
  }
83
- /** Whether the repository is a git checkout with this ref. */
84
- export const defaultBranch = (root) => {
85
- try {
86
- return execFileSync("git", ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
87
- }
88
- catch {
89
- return "origin/main";
90
- }
91
- };
84
+ /** The ref a comparison's base is started from when none is given: the
85
+ * default branch, as `origin` has it, or the checkout's own branch of that
86
+ * name where there is no such ref, as in a checkout with no remote. It
87
+ * fails, naming the fix, when the default branch cannot be told. */
88
+ export async function defaultBase(root, d = branchDeps(root)) {
89
+ const name = await defaultBranch(d);
90
+ if (name === null)
91
+ throw new SiteError(CANNOT_TELL);
92
+ const remote = `refs/remotes/origin/${name}`;
93
+ return d.git(["rev-parse", "--verify", "--quiet", remote]).ok
94
+ ? `origin/${name}`
95
+ : name;
96
+ }
92
97
  /** A detached worktree of `ref` in a temporary folder, with its dependencies
93
98
  * installed when it has a lockfile. Returns its path. */
94
99
  export function addWorktree(root, ref) {
package/dist/site.mjs CHANGED
@@ -17,7 +17,7 @@ import { crawl, normalize, sitemapPaths } from "./site/pages.mjs";
17
17
  import { changedWithoutNoise, classify, diff, } from "./site/pixels.mjs";
18
18
  import { encode, launch, measureView, shoot, } from "./site/capture.mjs";
19
19
  import { addToCensus, AXE_TAGS, emptyCensus, formatFinding, newValues, newViolations, sidewaysScroll, } from "./site/measure.mjs";
20
- import { addWorktree, defaultBranch, freePort, keep, removeWorktree, SiteError, startSites, stopKept, stopProcess, } from "./site/servers.mjs";
20
+ import { addWorktree, defaultBase, freePort, keep, removeWorktree, SiteError, startSites, stopKept, stopProcess, } from "./site/servers.mjs";
21
21
  const slug = (p) => p.replace(/^\/|\/$/g, "").replace(/\W+/g, "-") || "home";
22
22
  async function text(url) {
23
23
  try {
@@ -261,7 +261,7 @@ async function compare(argv) {
261
261
  after = given.after;
262
262
  }
263
263
  else {
264
- const base = flag(argv, "--base") ?? defaultBranch(root);
264
+ const base = flag(argv, "--base") ?? (await defaultBase(root));
265
265
  const [pa, pb] = [await freePort(), await freePort()];
266
266
  worktree = addWorktree(root, base);
267
267
  const common = { start: site.start, minutes: site.startMinutes };
package/dist/sync.d.mts CHANGED
@@ -11,6 +11,9 @@ type Has = (path: string) => boolean;
11
11
  /** The scheduled poller's workflow, its one `cron` line set to run every
12
12
  * `minutes`: on the hour for 60, every N minutes past it otherwise. */
13
13
  export declare function withSchedule(text: string, minutes: number, file: string): string;
14
+ /** A workflow with the one `branches:` line of its push trigger naming the
15
+ * default branch and nothing else. */
16
+ export declare function withDefaultBranch(text: string, name: string, file: string): string;
14
17
  /** A session workflow with the minutes its session may run, and its job 10
15
18
  * more, so the steps after the session still run before the job is
16
19
  * stopped. */
@@ -63,14 +66,17 @@ export type Plan = {
63
66
  /** Paths the lock lists that this version no longer writes. */
64
67
  remove: string[];
65
68
  };
66
- /** What a sync of `root` from `pkg` writes and deletes. */
67
- export declare function plan(pkg: string, root: string, s: Settings): Plan;
69
+ /** What a sync of `root` from `pkg` writes and deletes, in a repository
70
+ * whose default branch is `branch`. */
71
+ export declare function plan(pkg: string, root: string, s: Settings, branch: string): Plan;
68
72
  /** The paths whose content a sync would change, in the plan's order. */
69
73
  export declare function differences(root: string, p: Plan): string[];
70
74
  export declare function main(argv: string[], d: {
71
75
  root: string;
72
76
  pkg: string;
73
77
  settings: () => Promise<Settings>;
78
+ /** The repository's default branch, or null when it cannot be told. */
79
+ defaultBranch: () => Promise<string | null>;
74
80
  out: (line: string) => void;
75
81
  err: (line: string) => void;
76
82
  }): Promise<number>;
package/dist/sync.mjs CHANGED
@@ -7,13 +7,16 @@
7
7
  // factory sync # write what differs
8
8
  // factory sync --check # write nothing; exit 1 naming what differs
9
9
  //
10
- // A copy is the source, byte for byte: edit the source in the package, never
11
- // the copy. A file the lock lists that the package no longer has is
10
+ // A copy is the source, byte for byte but for what the settings and the
11
+ // repository decide: the minutes a session may run, the poller's schedule,
12
+ // the rules' numbers, and the default branch's name in the push triggers.
13
+ // Edit the source in the package, never the copy. A file the lock lists that the package no longer has is
12
14
  // deleted. Nothing else is.
13
15
  import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, } from "node:fs";
14
16
  import { dirname, join, relative, sep } from "node:path";
15
17
  import { fileURLToPath } from "node:url";
16
18
  import { defaultDeps, loadSettings, repoRoot, RULE_NUMBERS, } from "./config.mjs";
19
+ import { branchDeps, CANNOT_TELL, defaultBranch, } from "./lib/default-branch.mjs";
17
20
  /** The package's own folder: the parent of `src/`, or of `dist/` once
18
21
  * compiled. */
19
22
  export const PACKAGE = dirname(dirname(fileURLToPath(import.meta.url)));
@@ -30,12 +33,13 @@ const DEPENDABOT = ".github/dependabot.yml";
30
33
  const NEEDS = {
31
34
  "skills/factory-design": (s) => s.site !== null,
32
35
  "agents/factory-ui-reviewer.md": (s) => s.site !== null,
36
+ "agents/factory-e2e-reviewer.md": (s) => s.commands.endToEnd !== null,
33
37
  "skills/factory-deps": (_, has) => has(DEPENDABOT),
34
38
  "workflows/factory-deps.yml": (_, has) => has(DEPENDABOT),
35
39
  "workflows/factory-deps-auto-merge.yml": (_, has) => has(DEPENDABOT),
36
40
  "workflows/factory-board-sync.yml": (s) => s.tickets.board !== null,
37
41
  "workflows/factory-merge-policy.yml": (s) => s.autoMerge.allow.length > 0,
38
- "workflows/factory-claude-review.yml": (s) => s.ciReview !== null,
42
+ "workflows/factory-claude-review.yml": (s) => s.prReview !== null,
39
43
  "workflows/factory-poller.yml": (s) => s.builds.trigger === "github-action",
40
44
  };
41
45
  const POLLER_WORKFLOW = "workflows/factory-poller.yml";
@@ -48,6 +52,24 @@ export function withSchedule(text, minutes, file) {
48
52
  const cron = minutes === 60 ? "0 * * * *" : `*/${minutes} * * * *`;
49
53
  return text.replace(pattern, (_, lead) => `${lead}"${cron}"`);
50
54
  }
55
+ /** The workflows whose push trigger names the default branch. A workflow
56
+ * cannot ask for it in a trigger, so the sync writes it there. */
57
+ const PUSH_WORKFLOWS = [
58
+ "workflows/factory-check.yml",
59
+ "workflows/factory-conflicts.yml",
60
+ ];
61
+ /** A workflow with the one `branches:` line of its push trigger naming the
62
+ * default branch and nothing else. */
63
+ export function withDefaultBranch(text, name, file) {
64
+ const pattern = /^(\s+branches: )\[[^\]\n]*\]$/gm;
65
+ if ((text.match(pattern) ?? []).length !== 1)
66
+ throw new Error(`${file}: expected one branches line, to set the push trigger's branch`);
67
+ // Plain where YAML reads the name as text, quoted otherwise.
68
+ const written = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(name)
69
+ ? name
70
+ : JSON.stringify(name);
71
+ return text.replace(pattern, (_, lead) => `${lead}[${written}]`);
72
+ }
51
73
  /** The workflows that run a Claude session, by the kind of session each
52
74
  * runs. */
53
75
  const SESSION_WORKFLOWS = {
@@ -344,14 +366,18 @@ export function lockedFiles(text) {
344
366
  .map((l) => /^ {2}- (.+)$/.exec(l)?.[1])
345
367
  .filter((f) => Boolean(f));
346
368
  }
347
- /** What a sync of `root` from `pkg` writes and deletes. */
348
- export function plan(pkg, root, s) {
369
+ /** What a sync of `root` from `pkg` writes and deletes, in a repository
370
+ * whose default branch is `branch`. */
371
+ export function plan(pkg, root, s, branch) {
349
372
  const manifest = JSON.parse(readFileSync(join(pkg, "package.json"), "utf8"));
350
373
  const read = (p) => existsSync(join(root, p)) ? readFileSync(join(root, p), "utf8") : null;
351
374
  const write = new Map();
352
375
  const has = (p) => existsSync(join(root, p));
353
376
  for (const [from, to] of copies(pkg, s, has)) {
354
- const text = readFileSync(join(pkg, from), "utf8");
377
+ const source = readFileSync(join(pkg, from), "utf8");
378
+ const text = PUSH_WORKFLOWS.includes(from)
379
+ ? withDefaultBranch(source, branch, from)
380
+ : source;
355
381
  const kind = SESSION_WORKFLOWS[from.replace(/^workflows\//, "")];
356
382
  write.set(to, kind && from.startsWith("workflows/")
357
383
  ? withMinutes(text, s.sessionMinutes[kind], from)
@@ -387,7 +413,14 @@ export async function main(argv, d) {
387
413
  d.err(e instanceof Error ? e.message : String(e));
388
414
  return 1;
389
415
  }
390
- const p = plan(d.pkg, d.root, s);
416
+ // Nothing is written with a guessed name: a push trigger that names the
417
+ // wrong branch never runs.
418
+ const branch = await d.defaultBranch();
419
+ if (branch === null) {
420
+ d.err(CANNOT_TELL);
421
+ return 1;
422
+ }
423
+ const p = plan(d.pkg, d.root, s, branch);
391
424
  const differ = differences(d.root, p);
392
425
  if (check) {
393
426
  if (differ.length === 0)
@@ -419,6 +452,7 @@ export async function run(argv) {
419
452
  root,
420
453
  pkg: PACKAGE,
421
454
  settings: () => loadSettings(defaultDeps(root)),
455
+ defaultBranch: () => defaultBranch(branchDeps(root)),
422
456
  out: (line) => console.log(line),
423
457
  err: (line) => console.error(line),
424
458
  });
package/dist/ticket.mjs CHANGED
@@ -8,7 +8,7 @@
8
8
  // npx --no-install factory ticket stop N "one-line reason"
9
9
  // npx --no-install factory ticket end N
10
10
  // npx --no-install factory ticket refining|waiting N
11
- // npx --no-install factory ticket refined N [--before-file FILE]
11
+ // npx --no-install factory ticket refined N [--check] [--before-file FILE]
12
12
  // npx --no-install factory follow-up FILE "what is wrong"
13
13
  // npx --no-install factory ticket ready N
14
14
  // npx --no-install factory ticket cost N
@@ -36,6 +36,11 @@
36
36
  // or pull request N. The clock is keyed by CLAUDE_CODE_SESSION_ID, the ID the
37
37
  // hooks receive and the transcript's file name.
38
38
  //
39
+ // `refined` posts its marker only on a ticket whose body a build can read
40
+ // (`lib/refined-check.mts`): otherwise it prints one line for each part that
41
+ // is missing and exits 1. With `--check` it posts nothing, and prints
42
+ // `sound` when nothing is missing.
43
+ //
39
44
  // `ready` moves issue N's card to Ready when the owner asks a session to, so
40
45
  // the sync and the poller treat it as the owner's own move. It is the one
41
46
  // write to Status outside the sync, and needs the project scope:
@@ -55,6 +60,7 @@ import { openCodeHost } from "./code-host/index.mjs";
55
60
  import { openRunner } from "./runner/index.mjs";
56
61
  import { loadSettings, targetOf } from "./config.mjs";
57
62
  import { commentBody, sameName, reviewingPulls, workState, } from "./lib/work-status.mjs";
63
+ import { missingParts } from "./lib/refined-check.mjs";
58
64
  import { commonDir, readClock, writeClock } from "./lib/clock.mjs";
59
65
  import { costNote, measureSession, projectsDir } from "./lib/usage.mjs";
60
66
  import { boardConfigOf, checkFields } from "./board.mjs";
@@ -509,6 +515,18 @@ export async function main(argv, deps) {
509
515
  await post(d, issue, { kind: "cost", cost: takeCost(issue, d) });
510
516
  break;
511
517
  case "refined": {
518
+ // A body the build could not read gets no marker, whoever wrote it.
519
+ const ticket = await d.tickets.read(issue);
520
+ const missing = missingParts(ticket.body, ticket.labels);
521
+ if (missing.length > 0) {
522
+ for (const line of missing)
523
+ console.error(line);
524
+ return 1;
525
+ }
526
+ if (rest.includes("--check")) {
527
+ d.out("sound");
528
+ return 0;
529
+ }
512
530
  const at = rest.indexOf("--before-file");
513
531
  const before = at === -1 ? undefined : d.readFile(rest[at + 1]);
514
532
  await post(d, issue, {
package/docs/builds.md CHANGED
@@ -72,8 +72,8 @@ the account the build acts as. Without one, its commits are unsigned.
72
72
  commits is not shown as verified, when your own git signs commits.
73
73
 
74
74
  **Before the session starts,** the commands under
75
- [`build-setup`](configuration.md#build-setup) in your settings run, after
76
- your npm dependencies are installed.
75
+ [`commands.build-setup`](configuration.md#commandsbuild-setup) in your
76
+ settings run, after your npm dependencies are installed.
77
77
 
78
78
  ## The other jobs that run in the cloud
79
79
 
@@ -82,11 +82,11 @@ anything to do and starts a session only when there is, so a run with
82
82
  nothing to do costs about a minute of the runner and no use of the agent. A
83
83
  run that works costs about what a build does.
84
84
 
85
- | Job | Starts on | What the session does |
86
- | ------------------------ | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
87
- | Answering your review | A review you submit on a pull request | Works your comments with `factory-address-review` |
88
- | The conflict sweep | A push to your main branch, nightly, or by hand | Merges your main branch into each pull request that conflicts with it, with `factory-resolve-conflicts` |
89
- | Dependency pull requests | Three times a day, or by hand | Moves each dependency update toward merged, with `factory-deps`, in a repository with a `.github/dependabot.yml` |
85
+ | Job | Starts on | What the session does |
86
+ | ------------------------ | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
87
+ | Answering your review | A review you submit on a pull request | Works your comments with `factory-address-review` |
88
+ | The conflict sweep | A push to your default branch, nightly, or by hand | Merges your default branch into each pull request that conflicts with it, with `factory-resolve-conflicts` |
89
+ | Dependency pull requests | Three times a day, or by hand | Moves each dependency update toward merged, with `factory-deps`, in a repository with a `.github/dependabot.yml` |
90
90
 
91
91
  Each acts as the same account a build does. The review job answers your
92
92
  reviews only: the factory's own replies start runs that find nothing of
@@ -101,7 +101,7 @@ each ticket in Ready with no open blocker it:
101
101
 
102
102
  1. posts a comment on the ticket saying a build is starting, carrying a
103
103
  marker;
104
- 2. starts a build of that ticket in the cloud, from your main branch.
104
+ 2. starts a build of that ticket in the cloud, from your default branch.
105
105
 
106
106
  ```bash
107
107
  factory poller