@davidbyoung/software-factory 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +20 -20
  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/agent/claude-code.d.mts +3 -0
  7. package/dist/agent/claude-code.mjs +89 -0
  8. package/dist/agent/index.d.mts +2 -0
  9. package/dist/agent/index.mjs +5 -0
  10. package/dist/board.mjs +1 -1
  11. package/dist/cli.mjs +46 -4
  12. package/dist/code-host/github-setup.d.mts +5 -0
  13. package/dist/code-host/github-setup.mjs +133 -0
  14. package/dist/code-host/github.mjs +4 -0
  15. package/dist/code-host/index.d.mts +1 -1
  16. package/dist/code-host/index.mjs +2 -1
  17. package/dist/code-host/types.d.mts +2 -0
  18. package/dist/commands.d.mts +16 -0
  19. package/dist/commands.mjs +129 -0
  20. package/dist/config.d.mts +87 -20
  21. package/dist/config.mjs +344 -89
  22. package/dist/deps.d.mts +7 -4
  23. package/dist/deps.mjs +20 -9
  24. package/dist/doctor.d.mts +9 -16
  25. package/dist/doctor.mjs +71 -68
  26. package/dist/explain.d.mts +4 -0
  27. package/dist/explain.mjs +174 -0
  28. package/dist/guard-commit.d.mts +7 -2
  29. package/dist/guard-commit.mjs +58 -21
  30. package/dist/init.d.mts +12 -14
  31. package/dist/init.mjs +194 -136
  32. package/dist/lib/default-branch.d.mts +35 -0
  33. package/dist/lib/default-branch.mjs +117 -0
  34. package/dist/lib/has-command.d.mts +5 -0
  35. package/dist/lib/has-command.mjs +8 -0
  36. package/dist/lib/listed.d.mts +2 -0
  37. package/dist/lib/listed.mjs +4 -0
  38. package/dist/lib/refined-check.d.mts +7 -0
  39. package/dist/lib/refined-check.mjs +76 -0
  40. package/dist/lib/work-status.d.mts +12 -2
  41. package/dist/lib/work-status.mjs +14 -3
  42. package/dist/parts.d.mts +18 -15
  43. package/dist/parts.mjs +15 -43
  44. package/dist/patch-coverage.d.mts +13 -0
  45. package/dist/patch-coverage.mjs +73 -0
  46. package/dist/poller.d.mts +20 -3
  47. package/dist/poller.mjs +62 -15
  48. package/dist/pr-watch.d.mts +3 -2
  49. package/dist/pr-watch.mjs +22 -5
  50. package/dist/pr.mjs +34 -2
  51. package/dist/remove.d.mts +11 -0
  52. package/dist/remove.mjs +156 -0
  53. package/dist/runner/github-actions.d.mts +1 -1
  54. package/dist/runner/github-actions.mjs +12 -0
  55. package/dist/runner/index.d.mts +1 -1
  56. package/dist/runner/index.mjs +2 -1
  57. package/dist/runner/setup.d.mts +2 -0
  58. package/dist/runner/setup.mjs +22 -0
  59. package/dist/runner/types.d.mts +3 -0
  60. package/dist/runner/types.mjs +0 -2
  61. package/dist/session-start.d.mts +23 -13
  62. package/dist/session-start.mjs +56 -44
  63. package/dist/setup.d.mts +98 -0
  64. package/dist/setup.mjs +3 -0
  65. package/dist/site/servers.d.mts +6 -2
  66. package/dist/site/servers.mjs +14 -9
  67. package/dist/site.mjs +2 -2
  68. package/dist/status.d.mts +4 -4
  69. package/dist/status.mjs +8 -7
  70. package/dist/sync.d.mts +26 -2
  71. package/dist/sync.mjs +177 -13
  72. package/dist/ticket.mjs +19 -1
  73. package/dist/tickets/github-setup.d.mts +2 -0
  74. package/dist/tickets/github-setup.mjs +50 -0
  75. package/dist/tickets/github.mjs +0 -2
  76. package/dist/tickets/index.mjs +2 -1
  77. package/dist/tickets/transport.mjs +1 -3
  78. package/dist/tickets/types.mjs +0 -2
  79. package/dist/tool-names.d.mts +11 -0
  80. package/dist/tool-names.mjs +20 -0
  81. package/dist/tools.d.mts +56 -0
  82. package/dist/tools.mjs +76 -0
  83. package/docs/builds.md +111 -59
  84. package/docs/cli.md +106 -69
  85. package/docs/configuration.md +489 -171
  86. package/docs/design.md +18 -5
  87. package/docs/developing.md +179 -73
  88. package/docs/existing-repo.md +25 -12
  89. package/docs/github/by-hand.md +334 -0
  90. package/docs/github/reference.md +76 -67
  91. package/docs/github/setup.md +105 -286
  92. package/docs/glossary.md +18 -7
  93. package/docs/limitations.md +39 -12
  94. package/docs/plugins.md +305 -56
  95. package/docs/quick-start.md +85 -100
  96. package/docs/removing.md +37 -17
  97. package/docs/skills.md +121 -62
  98. package/docs/updating.md +150 -9
  99. package/docs/workflow.md +23 -19
  100. package/package.json +1 -1
  101. package/poller.Dockerfile +10 -18
  102. package/review.md +20 -11
  103. package/rules.md +36 -30
  104. package/settings.schema.json +313 -69
  105. package/skills/factory-address-review/SKILL.md +50 -30
  106. package/skills/factory-build/SKILL.md +76 -23
  107. package/skills/factory-deps/SKILL.md +46 -21
  108. package/skills/factory-design/SKILL.md +17 -8
  109. package/skills/factory-diagnose/SKILL.md +22 -20
  110. package/skills/factory-mutate/SKILL.md +38 -24
  111. package/skills/factory-refine/SKILL.md +55 -31
  112. package/skills/factory-resolve-conflicts/SKILL.md +76 -34
  113. package/skills/factory-trace/SKILL.md +80 -0
  114. package/workflows/factory-build.yml +6 -5
  115. package/workflows/factory-conflicts.yml +8 -8
  116. package/workflows/factory-deps-auto-merge.yml +3 -2
  117. package/workflows/factory-deps.yml +1 -1
  118. package/workflows/factory-poller.yml +46 -0
  119. package/workflows/factory-review.yml +1 -1
  120. package/skills/factory-address-review/patch-coverage.py +0 -68
@@ -0,0 +1,133 @@
1
+ // GitHub as the code host: the remotes it recognizes, the one access token
2
+ // the factory's jobs use, the signed-in check, and what removing the
3
+ // factory leaves on it.
4
+ import { listed } from "../lib/listed.mjs";
5
+ import { AUTOMERGE_TOKEN, BOARD_TOKEN, BUILD_TOKEN, } from "../parts.mjs";
6
+ import { RULE, } from "../setup.mjs";
7
+ /** The repository a remote's address names, or null for one not on
8
+ * GitHub. */
9
+ export function githubRepository(url) {
10
+ const match = /^(?:git@github\.com:|(?:https|ssh):\/\/(?:git@)?github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(url.trim());
11
+ return match ? `${match[1]}/${match[2]}` : null;
12
+ }
13
+ /** What a token must be able to do, in words. */
14
+ const NEED_TEXT = {
15
+ push: "push a branch",
16
+ workflows: "change a workflow's file",
17
+ board: "write the board",
18
+ };
19
+ /** The board is GitHub's to write only when the tickets are GitHub's. */
20
+ const githubBoard = (c) => c.parts.has("board") && c.chosen.tickets === "github";
21
+ /** What the one token must be able to do for the parts on. */
22
+ function tokenNeeds(c) {
23
+ return githubBoard(c)
24
+ ? ["push", "workflows", "board"]
25
+ : ["push", "workflows"];
26
+ }
27
+ /** The names the token is stored under: the board's with a board, which
28
+ * builds also read, the build token's without one, and the auto-merge
29
+ * token's. */
30
+ function tokenNames(c) {
31
+ const names = [];
32
+ if (githubBoard(c))
33
+ names.push(BOARD_TOKEN);
34
+ else if (c.parts.has("cloud"))
35
+ names.push(BUILD_TOKEN);
36
+ if (c.parts.has("auto-merge"))
37
+ names.push(AUTOMERGE_TOKEN);
38
+ return names;
39
+ }
40
+ /** The secrets each part on reads from the token. */
41
+ function tokenReads(c) {
42
+ const needs = [];
43
+ const add = (part, anyOf) => {
44
+ if (c.parts.has(part))
45
+ needs.push({ part, anyOf });
46
+ };
47
+ add("cloud", [BUILD_TOKEN, BOARD_TOKEN]);
48
+ if (c.chosen.tickets === "github") {
49
+ add("board", [BOARD_TOKEN]);
50
+ add("from-board", [BOARD_TOKEN]);
51
+ }
52
+ add("auto-merge", [AUTOMERGE_TOKEN]);
53
+ return needs;
54
+ }
55
+ const ALL_TOKENS = [BOARD_TOKEN, BUILD_TOKEN, AUTOMERGE_TOKEN];
56
+ export const githubCodeHostSetup = {
57
+ steps: (c) => {
58
+ const needs = tokenReads(c);
59
+ if (!needs.length)
60
+ return [];
61
+ const codeHost = c.opened.codeHost;
62
+ const wants = tokenNeeds(c);
63
+ const scopes = codeHost.scopesFor(wants);
64
+ const page = codeHost.newTokenPage(scopes, `software factory: ${c.repository}`);
65
+ return [
66
+ {
67
+ kind: "secret",
68
+ needs,
69
+ storeAs: tokenNames(c),
70
+ intro: [
71
+ "",
72
+ `An access token: opening ${page}`,
73
+ `Check that ${listed(scopes)} ${scopes.length === 1 ? "is" : "are"} ticked, choose an expiry, and generate it.`,
74
+ ],
75
+ get: { page },
76
+ prompt: "Paste it (leave empty to do this later):",
77
+ skipped: "No token stored.",
78
+ verify: async (value) => {
79
+ let owned;
80
+ try {
81
+ owned = await codeHost.tokenOwner(value);
82
+ }
83
+ catch (e) {
84
+ throw new Error(`${e instanceof Error ? e.message : String(e)}. Paste another.`);
85
+ }
86
+ const lacking = owned.scopes
87
+ ? scopes.filter((x) => !owned.scopes.includes(x))
88
+ : [];
89
+ if (lacking.length)
90
+ throw new Error(`That token lacks ${listed(lacking)}. Make one with every scope checked, and paste it.`);
91
+ return {
92
+ account: owned.account,
93
+ lines: owned.scopes === null
94
+ ? [
95
+ `The code host does not say what this token may do: make sure it can ${listed(wants.map((n) => NEED_TEXT[n]))}.`,
96
+ ]
97
+ : [],
98
+ };
99
+ },
100
+ stored: (names, account) => `It belongs to ${account}. Stored as ${names.join(", ")}.`,
101
+ },
102
+ ];
103
+ },
104
+ checks: async (c) => {
105
+ try {
106
+ return [
107
+ {
108
+ state: "pass",
109
+ text: `Signed in to the code host as ${await c.opened.codeHost.signedInAs()}`,
110
+ },
111
+ ];
112
+ }
113
+ catch (e) {
114
+ return [
115
+ {
116
+ state: "fail",
117
+ text: "Signed in to the code host",
118
+ fix: e instanceof Error ? e.message : String(e),
119
+ },
120
+ ];
121
+ }
122
+ },
123
+ leftovers: (c) => {
124
+ const lines = [];
125
+ // init only ever adds the rule, so it can outlast the review.
126
+ const sure = c.settings?.ciReview != null;
127
+ lines.push(`Delete the "${RULE}" ruleset first${sure ? "" : ", if there is one"}, under Settings, Rules: until then every pull request waits on its "Review verdict" check`);
128
+ const names = ALL_TOKENS.filter((n) => c.secrets === null || c.secrets.includes(n));
129
+ if (names.length)
130
+ lines.push(`Delete the secret${names.length === 1 ? "" : "s"} ${listed(names)}${c.secrets === null ? " if set" : ""}`);
131
+ return lines;
132
+ },
133
+ };
@@ -230,6 +230,10 @@ export function githubCodeHost(o) {
230
230
  const repo = await t.rest("GET", API);
231
231
  return repo.default_branch;
232
232
  },
233
+ async isPrivate() {
234
+ const repo = await t.rest("GET", API);
235
+ return repo.private;
236
+ },
233
237
  async checkRuns(sha) {
234
238
  const answer = await t.rest("GET", `${API}/commits/${sha}/check-runs?per_page=100`);
235
239
  return answer.check_runs.map((c) => ({
@@ -3,7 +3,7 @@ import type { CodeHost } from "./types.mts";
3
3
  export * from "./types.mts";
4
4
  export declare const DEFAULT_CODE_HOST: "github";
5
5
  /** The message for a code host that is not built. */
6
- export declare const unsupportedCodeHost: (type: string) => string;
6
+ export declare const unsupportedCodeHost: (type: string, built?: readonly string[]) => string;
7
7
  /** The code host of that name for the repository, reached through the
8
8
  * GitHub CLI. */
9
9
  export declare function openCodeHost(repository: string, type?: string, run?: Gh): CodeHost;
@@ -5,10 +5,11 @@
5
5
  import { gh } from "../lib/gh.mjs";
6
6
  import { ghTransport } from "../tickets/transport.mjs";
7
7
  import { githubCodeHost } from "./github.mjs";
8
+ import { BUILT, unsupported } from "../tool-names.mjs";
8
9
  export * from "./types.mjs";
9
10
  export const DEFAULT_CODE_HOST = "github";
10
11
  /** The message for a code host that is not built. */
11
- export const unsupportedCodeHost = (type) => `code-host.type "${type}" is not supported. "github" is the only code host built.`;
12
+ export const unsupportedCodeHost = (type, built = BUILT.codeHost) => unsupported("code-host.type", type, "code host", built);
12
13
  /** The code host of that name for the repository, reached through the
13
14
  * GitHub CLI. */
14
15
  export function openCodeHost(repository, type = DEFAULT_CODE_HOST, run = gh) {
@@ -121,6 +121,8 @@ export type CodeHost = {
121
121
  /** The commit two commits both descend from. */
122
122
  mergeBase(base: string, head: string): Promise<string>;
123
123
  defaultBranch(): Promise<string>;
124
+ /** Whether only people given access can see the repository. */
125
+ isPrivate(): Promise<boolean>;
124
126
  /** The check runs on a commit, without its statuses. */
125
127
  checkRuns(sha: string): Promise<CheckRun[]>;
126
128
  /** The statuses on a commit, without its check runs. */
@@ -0,0 +1,16 @@
1
+ import { type Settings } from "./config.mts";
2
+ export type Deps = {
3
+ /** The repository's root, where every command runs. */
4
+ root: string;
5
+ settings: () => Promise<Settings>;
6
+ /** Runs one settings command from `cwd` with `env` added to the
7
+ * environment, and returns its exit status. */
8
+ exec: (command: string, cwd: string, env: Record<string, string>) => number;
9
+ out: (line: string) => void;
10
+ err: (line: string) => void;
11
+ };
12
+ /** `argv` is the command's name, then its arguments. */
13
+ export declare function main(argv: string[], d: Deps): Promise<number>;
14
+ /** `factory gate`, `factory test-one`, `factory end-to-end`, and
15
+ * `factory specs check`, the last as `specs-check`. */
16
+ export declare function run(argv: string[]): Promise<number>;
@@ -0,0 +1,129 @@
1
+ // The commands that run what the settings name, so a skill says what to
2
+ // run and the repository's settings say how:
3
+ //
4
+ // factory gate # commands.gate, in order
5
+ // factory test-one FILE [NAME] # commands.test-one, one test alone
6
+ // factory end-to-end FILE [--times K] # commands.end-to-end, K times in a row
7
+ // factory specs check # specs.check
8
+ //
9
+ // Each command runs with bash from the repository's root, with its output
10
+ // passed through and no standard input. `test-one` gets FILE and NAME in its
11
+ // environment, `end-to-end` FILE, and the spec check DO_NOT_TRACK=1. An
12
+ // argument a command does not know prints its usage and exits 2.
13
+ import { spawnSync } from "node:child_process";
14
+ import { defaultDeps, loadSettings, repoRoot, SETTINGS_FILE, SettingsError, } from "./config.mjs";
15
+ const USAGE = {
16
+ gate: "Usage: factory gate",
17
+ "test-one": "Usage: factory test-one FILE [NAME]",
18
+ "end-to-end": "Usage: factory end-to-end FILE [--times K]",
19
+ "specs-check": "Usage: factory specs check",
20
+ };
21
+ /** What `factory end-to-end` was asked: the file, and how many runs when
22
+ * `--times` is given; null when the arguments are not ones it knows. */
23
+ function endToEndArgs(args) {
24
+ let file = null;
25
+ let times = null;
26
+ for (let i = 0; i < args.length; i++) {
27
+ if (args[i] === "--times") {
28
+ // A whole number above zero.
29
+ if (times !== null || !/^[1-9]\d*$/.test(args[i + 1] ?? ""))
30
+ return null;
31
+ times = Number(args[++i]);
32
+ }
33
+ else if (args[i].startsWith("-") || file !== null)
34
+ return null;
35
+ else
36
+ file = args[i];
37
+ }
38
+ return file === null ? null : { file, times };
39
+ }
40
+ /** `argv` is the command's name, then its arguments. */
41
+ export async function main(argv, d) {
42
+ const [name, ...args] = argv;
43
+ const usage = () => {
44
+ d.err(USAGE[name]);
45
+ return 2;
46
+ };
47
+ const e2e = name === "end-to-end" ? endToEndArgs(args) : null;
48
+ if (name === "gate" || name === "specs-check") {
49
+ if (args.length > 0)
50
+ return usage();
51
+ }
52
+ else if (name === "test-one") {
53
+ if (args.length < 1 || args.length > 2)
54
+ return usage();
55
+ if (args.some((a) => a.startsWith("--")))
56
+ return usage();
57
+ }
58
+ else if (!e2e)
59
+ return usage();
60
+ let s;
61
+ try {
62
+ s = await d.settings();
63
+ }
64
+ catch (e) {
65
+ if (!(e instanceof SettingsError))
66
+ throw e;
67
+ d.err(e.message);
68
+ return 1;
69
+ }
70
+ const notSet = (key) => {
71
+ d.err(`commands.${key} is not set`);
72
+ return 1;
73
+ };
74
+ if (name === "gate") {
75
+ if (s.commands.gate.length === 0) {
76
+ d.err(`commands.gate is not set: add the commands that check a change to ${SETTINGS_FILE}`);
77
+ return 1;
78
+ }
79
+ for (const command of s.commands.gate) {
80
+ d.out(`$ ${command}`);
81
+ if (d.exec(command, d.root, {}) !== 0) {
82
+ d.err(`gate failed on: ${command}`);
83
+ return 1;
84
+ }
85
+ }
86
+ return 0;
87
+ }
88
+ if (name === "test-one") {
89
+ if (s.commands.testOne === null)
90
+ return notSet("test-one");
91
+ const [file, test = ""] = args;
92
+ return d.exec(s.commands.testOne, d.root, { FILE: file, NAME: test });
93
+ }
94
+ if (name === "end-to-end") {
95
+ const { file, times } = e2e;
96
+ const command = s.commands.endToEnd;
97
+ if (command === null)
98
+ return notSet("end-to-end");
99
+ if (times === null)
100
+ return d.exec(command, d.root, { FILE: file });
101
+ for (let run = 1; run <= times; run++)
102
+ if (d.exec(command, d.root, { FILE: file }) !== 0) {
103
+ d.err(`failed on run ${run} of ${times}`);
104
+ return 1;
105
+ }
106
+ return 0;
107
+ }
108
+ if (s.specCheck === null) {
109
+ d.out("specs are off");
110
+ return 0;
111
+ }
112
+ return d.exec(s.specCheck, d.root, { DO_NOT_TRACK: "1" });
113
+ }
114
+ /** `factory gate`, `factory test-one`, `factory end-to-end`, and
115
+ * `factory specs check`, the last as `specs-check`. */
116
+ export async function run(argv) {
117
+ const root = repoRoot();
118
+ return main(argv, {
119
+ root,
120
+ settings: () => loadSettings(defaultDeps(root)),
121
+ exec: (command, cwd, env) => spawnSync("bash", ["-c", command], {
122
+ cwd,
123
+ env: { ...process.env, ...env },
124
+ stdio: ["ignore", "inherit", "inherit"],
125
+ }).status ?? 1,
126
+ out: (line) => console.log(line),
127
+ err: (line) => console.error(line),
128
+ });
129
+ }
package/dist/config.d.mts CHANGED
@@ -1,10 +1,29 @@
1
1
  #!/usr/bin/env node
2
- import { type Columns, type StateKey } from "./lib/work-status.mts";
2
+ import { type Built } from "./tool-names.mts";
3
+ import { type Watch, type Columns, type StateKey } from "./lib/work-status.mts";
3
4
  export declare class SettingsError extends Error {
4
5
  }
5
- export declare const ROLES: readonly ["mockups", "builder", "reviewer"];
6
- export type Role = (typeof ROLES)[number];
6
+ /** What a plug-in does, in the order `factory plugins` prints them. */
7
+ export declare const SLOTS: readonly ["refiner", "mockups", "builder", "reviewer", "prover", "test-reviewer", "resolver"];
8
+ export type Slot = (typeof SLOTS)[number];
9
+ /** The phases `plugins` is grouped by. */
10
+ export declare const PHASES: readonly ["refine", "build", "test", "conflicts"];
11
+ type SlotShape = {
12
+ phase: (typeof PHASES)[number];
13
+ key: string;
14
+ kind: Plugin["kind"];
15
+ list: boolean;
16
+ files: "required" | "optional" | "none";
17
+ labels: "required" | "none";
18
+ };
19
+ /** Each slot: the phase and key it is written under, the one kind it
20
+ * takes, whether it holds one plug-in or a list, and whether a plug-in in
21
+ * it must have, may have, or cannot have `files` and `labels`. */
22
+ export declare const SLOT_SHAPE: Record<Slot, SlotShape>;
7
23
  export declare const TRIGGERS: readonly ["own-server", "github-action", "manual"];
24
+ /** How often the scheduled poller may check the board, in minutes: each
25
+ * divides an hour, so a schedule every N minutes keeps an even beat. */
26
+ export declare const POLL_MINUTES: readonly [5, 10, 15, 30, 60];
8
27
  export declare const SPECS: readonly ["none", "openspec"];
9
28
  declare const FIELD_DEFAULTS: {
10
29
  readonly session: "Session";
@@ -15,15 +34,17 @@ export type FieldKey = keyof typeof FIELD_DEFAULTS;
15
34
  export type Plugin = {
16
35
  kind: "skill" | "agent";
17
36
  name: string;
18
- role: Role;
37
+ slot: Slot;
19
38
  files: string[];
20
39
  labels: string[];
21
40
  };
22
41
  export type Settings = {
23
- version: 1;
42
+ version: 2;
24
43
  repository: string;
25
44
  tickets: {
26
- type: "github";
45
+ type: string;
46
+ /** The keys the ticket system adds under `tickets`, by name. */
47
+ options: Record<string, string>;
27
48
  board: number | null;
28
49
  /** The board's column for each state, null for none. */
29
50
  columns: Record<StateKey, string | null>;
@@ -32,19 +53,45 @@ export type Settings = {
32
53
  };
33
54
  /** Where pull requests are. */
34
55
  codeHost: {
35
- type: "github";
56
+ type: string;
36
57
  };
37
58
  builds: {
38
59
  /** What notices a card moved to Ready and starts its build. */
39
60
  trigger: (typeof TRIGGERS)[number];
40
61
  /** Where an unattended build runs. */
41
- runner: "github-actions";
62
+ runner: string;
63
+ /** How often the scheduled poller checks the board. */
64
+ pollMinutes: (typeof POLL_MINUTES)[number];
42
65
  };
43
66
  specs: (typeof SPECS)[number];
44
- beforeCommit: string[];
45
- /** Commands an unattended build runs from the root before it starts. */
46
- buildSetup: string[];
67
+ /** The command that checks the specs, or null when `specs` is none. */
68
+ specCheck: string | null;
69
+ /** Every command a build runs, each from the repository's root. */
70
+ commands: {
71
+ /** Before an unattended build starts work. */
72
+ buildSetup: string[];
73
+ /** Before every commit a session makes. */
74
+ beforeCommit: string[];
75
+ /** Before a session reports a task done. */
76
+ gate: string[];
77
+ /** One test alone, with `FILE` and `NAME` in its environment. */
78
+ testOne: string | null;
79
+ /** One end-to-end spec alone, with `FILE` in its environment. */
80
+ endToEnd: string | null;
81
+ /** Coverage, and where its report lands. */
82
+ coverage: {
83
+ run: string;
84
+ report: string;
85
+ } | null;
86
+ /** Rebuilds the package manager's lock file after a conflict in it. */
87
+ relock: string;
88
+ };
89
+ /** The plug-ins the settings name, in the slots' order. `pluginsOf` adds
90
+ * the factory's own for each slot left out. */
47
91
  plugins: Plugin[];
92
+ /** Whether `plugins.test.reviewers` is written. Written, it is the whole
93
+ * list of test reviewers, even when it is empty. */
94
+ testReviewersWritten: boolean;
48
95
  autoMerge: {
49
96
  allow: string[];
50
97
  deny: string[];
@@ -60,6 +107,17 @@ export type Settings = {
60
107
  site: Site | null;
61
108
  /** How long each kind of unattended session may run, in minutes. */
62
109
  sessionMinutes: Record<SessionKind, number>;
110
+ /** The numbers the process rules use, which `factory sync` writes into
111
+ * the copies of the rules and skills that state them. */
112
+ rules: {
113
+ smallChangeLines: number;
114
+ reviewRounds: number;
115
+ };
116
+ };
117
+ /** Each number the rules use, with its default. */
118
+ export declare const RULE_NUMBERS: {
119
+ readonly "small-change-lines": 30;
120
+ readonly "review-rounds": 2;
63
121
  };
64
122
  /** Each kind of unattended session, with how long it may run by default. */
65
123
  export declare const SESSION_MINUTES: {
@@ -89,11 +147,17 @@ export declare const ACCESSIBILITY: readonly ["wcag22aa", "wcag21aa", "wcag2aa",
89
147
  export type Accessibility = (typeof ACCESSIBILITY)[number];
90
148
  /** The agent that needs `site`. */
91
149
  export declare const SITE_AGENT = "factory-ui-reviewer";
150
+ /** The agent that needs `commands.end-to-end`. */
151
+ export declare const E2E_AGENT = "factory-e2e-reviewer";
152
+ /** The spec check where `specs.type` is openspec and none is written. */
153
+ export declare const OPENSPEC_CHECK = "npx --no-install openspec validate --all --strict --no-interactive";
154
+ /** `commands.relock` where none is written. */
155
+ export declare const DEFAULT_RELOCK = "npm install";
92
156
  export declare const NO_PLAYWRIGHT = "site needs Playwright: npm install -D playwright";
93
157
  /** The keys each block allows, by the block's path: `""` is the top of the
94
- * file and `plugins[]` is one plug-in. `settings.schema.json` lists the same
95
- * keys, and a test fails when the two differ. A key the code accepts goes
96
- * here, in the schema, and in docs/configuration.md. */
158
+ * file and `plugins.build.builders[]` is one builder. `settings.schema.json`
159
+ * lists the same keys, and a test fails when the two differ. A key the code
160
+ * accepts goes here, in the schema, and in docs/configuration.md. */
97
161
  export declare const SETTINGS_KEYS: Record<string, readonly string[]>;
98
162
  /** `factory config get site`: every key in the table's order. */
99
163
  export declare function siteLines(site: Site): string[];
@@ -104,7 +168,7 @@ export declare const SETTINGS_FILE = ".claude/factory.yaml";
104
168
  /** The settings with every default filled in. Throws a SettingsError naming
105
169
  * the key on anything unsound. `exists` says whether a path from the root
106
170
  * exists, for the plug-ins' files. */
107
- export declare function parseSettings(raw: unknown, exists: (path: string) => boolean): Settings;
171
+ export declare function parseSettings(raw: unknown, exists: (path: string) => boolean, built?: Built): Settings;
108
172
  /** One line for each pattern that matches none of `files`: a stale pattern
109
173
  * is how a policy rots. */
110
174
  export declare function patternWarnings(s: Settings, files: string[]): string[];
@@ -135,19 +199,22 @@ export declare function fieldNamesOf(s: Settings): {
135
199
  };
136
200
  /** The settings of the checkout the command runs in. */
137
201
  export declare const loadSettings: (d?: Deps) => Promise<Settings>;
138
- /** The settings' plug-ins, and the factory's design skill as the mockups
139
- * plug-in of a site that lists none, once it is synced. */
202
+ /** Every plug-in the factory will use, in the slots' order: the settings'
203
+ * own, and the factory's for each slot they leave out. The refiner and the
204
+ * prover are always there. The factory's test reviewer is there unless the
205
+ * settings write the list. Its design skill is the mockups plug-in of a
206
+ * site that names none, once it is synced. */
140
207
  export declare function pluginsOf(s: Settings, exists: (path: string) => boolean): Plugin[];
141
208
  export declare function main(argv: string[], d: Deps): Promise<number>;
142
209
  /** `factory config get KEY`, `factory config check`, and
143
- * `factory plugins [ROLE]`. */
210
+ * `factory plugins [SLOT]`. */
144
211
  export declare function run(argv: string[]): Promise<number>;
145
212
  /** What a reading needs from the settings. */
146
213
  export type Target = {
147
214
  repository: string;
148
215
  board: number | null;
149
- /** Whether something starts builds from the board. */
150
- watched: boolean;
216
+ /** What starts builds from the board, and how long it may take. */
217
+ watch: Watch | null;
151
218
  /** The column each state shows in on the board. */
152
219
  columns: Columns;
153
220
  };