@davidbyoung/software-factory 0.1.1 → 0.1.3

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 (83) hide show
  1. package/README.md +8 -9
  2. package/dist/agent/claude-code.d.mts +3 -0
  3. package/dist/agent/claude-code.mjs +89 -0
  4. package/dist/agent/index.d.mts +2 -0
  5. package/dist/agent/index.mjs +5 -0
  6. package/dist/board.mjs +1 -1
  7. package/dist/cli.mjs +17 -2
  8. package/dist/code-host/github-setup.d.mts +5 -0
  9. package/dist/code-host/github-setup.mjs +133 -0
  10. package/dist/code-host/github.mjs +4 -0
  11. package/dist/code-host/index.d.mts +1 -1
  12. package/dist/code-host/index.mjs +2 -1
  13. package/dist/code-host/types.d.mts +2 -0
  14. package/dist/config.d.mts +26 -7
  15. package/dist/config.mjs +79 -26
  16. package/dist/doctor.d.mts +6 -14
  17. package/dist/doctor.mjs +52 -64
  18. package/dist/explain.d.mts +2 -0
  19. package/dist/explain.mjs +127 -0
  20. package/dist/init.d.mts +8 -12
  21. package/dist/init.mjs +179 -131
  22. package/dist/lib/has-command.d.mts +5 -0
  23. package/dist/lib/has-command.mjs +8 -0
  24. package/dist/lib/listed.d.mts +2 -0
  25. package/dist/lib/listed.mjs +4 -0
  26. package/dist/lib/work-status.d.mts +12 -2
  27. package/dist/lib/work-status.mjs +14 -3
  28. package/dist/parts.d.mts +18 -15
  29. package/dist/parts.mjs +15 -43
  30. package/dist/poller.d.mts +20 -3
  31. package/dist/poller.mjs +62 -15
  32. package/dist/remove.d.mts +11 -0
  33. package/dist/remove.mjs +156 -0
  34. package/dist/runner/github-actions.d.mts +1 -1
  35. package/dist/runner/github-actions.mjs +12 -0
  36. package/dist/runner/index.d.mts +1 -1
  37. package/dist/runner/index.mjs +2 -1
  38. package/dist/runner/setup.d.mts +2 -0
  39. package/dist/runner/setup.mjs +22 -0
  40. package/dist/runner/types.d.mts +3 -0
  41. package/dist/runner/types.mjs +0 -2
  42. package/dist/setup.d.mts +98 -0
  43. package/dist/setup.mjs +3 -0
  44. package/dist/status.d.mts +4 -4
  45. package/dist/status.mjs +8 -7
  46. package/dist/sync.d.mts +22 -3
  47. package/dist/sync.mjs +144 -11
  48. package/dist/tickets/github-setup.d.mts +2 -0
  49. package/dist/tickets/github-setup.mjs +50 -0
  50. package/dist/tickets/github.mjs +0 -2
  51. package/dist/tickets/index.mjs +2 -1
  52. package/dist/tickets/transport.mjs +1 -3
  53. package/dist/tickets/types.mjs +0 -2
  54. package/dist/tool-names.d.mts +11 -0
  55. package/dist/tool-names.mjs +20 -0
  56. package/dist/tools.d.mts +56 -0
  57. package/dist/tools.mjs +76 -0
  58. package/docs/builds.md +103 -51
  59. package/docs/cli.md +42 -42
  60. package/docs/configuration.md +38 -32
  61. package/docs/design.md +1 -1
  62. package/docs/developing.md +156 -67
  63. package/docs/existing-repo.md +20 -9
  64. package/docs/github/by-hand.md +321 -0
  65. package/docs/github/reference.md +65 -61
  66. package/docs/github/setup.md +83 -267
  67. package/docs/glossary.md +5 -4
  68. package/docs/limitations.md +12 -10
  69. package/docs/plugins.md +12 -17
  70. package/docs/quick-start.md +62 -105
  71. package/docs/removing.md +36 -16
  72. package/docs/skills.md +47 -37
  73. package/docs/updating.md +2 -6
  74. package/docs/workflow.md +13 -12
  75. package/package.json +5 -3
  76. package/poller.Dockerfile +10 -18
  77. package/rules.md +14 -12
  78. package/settings.schema.json +24 -0
  79. package/skills/factory-build/SKILL.md +1 -1
  80. package/skills/factory-trace/SKILL.md +79 -0
  81. package/workflows/factory-build.yml +5 -4
  82. package/workflows/factory-deps-auto-merge.yml +3 -2
  83. package/workflows/factory-poller.yml +46 -0
package/README.md CHANGED
@@ -76,9 +76,7 @@ added without changing the rest. Today each has one choice:
76
76
  [The quick start](docs/quick-start.md) takes you from nothing to a first
77
77
  built pull request. Refining and building a ticket on your machine needs
78
78
  only the package: no board, no secrets, and nothing to host. Everything
79
- else is optional and comes later. _[Planned](docs/developing.md#what-is-built)_,
80
- meaning not built yet: the package is not published yet,
81
- so it cannot be installed outside the repository it is developed in.
79
+ else is optional and comes later.
82
80
 
83
81
  ## What it holds to
84
82
 
@@ -93,12 +91,12 @@ so it cannot be installed outside the repository it is developed in.
93
91
 
94
92
  **Start here**
95
93
 
96
- | Page | For |
97
- | -------------------------------------------- | --------------------------------------------------- |
98
- | [Quick start](docs/quick-start.md) | Your first built ticket, step by step |
99
- | [Setting up on GitHub](docs/github/setup.md) | Every step on GitHub with Claude Code, in one place |
100
- | [Workflow](docs/workflow.md) | How a ticket moves, and which steps are yours |
101
- | [Glossary](docs/glossary.md) | Any word here you do not know |
94
+ | Page | For |
95
+ | -------------------------------------------- | -------------------------------------------------------------- |
96
+ | [Quick start](docs/quick-start.md) | Your first built ticket, step by step |
97
+ | [Setting up on GitHub](docs/github/setup.md) | What `factory init` asks on GitHub, and what it leaves for you |
98
+ | [Workflow](docs/workflow.md) | How a ticket moves, and which steps are yours |
99
+ | [Glossary](docs/glossary.md) | Any word here you do not know |
102
100
 
103
101
  **Guides**
104
102
 
@@ -118,6 +116,7 @@ so it cannot be installed outside the repository it is developed in.
118
116
  | [Skills](docs/skills.md) | What each skill does, and what it never does |
119
117
  | [Configuration](docs/configuration.md) | The settings most change, then every key |
120
118
  | [GitHub and Claude Code reference](docs/github/reference.md) | Where each part lives on GitHub and in Claude Code |
119
+ | [Setting up on GitHub by hand](docs/github/by-hand.md) | Every step `factory init` takes, and every secret |
121
120
 
122
121
  **About**
123
122
 
@@ -0,0 +1,3 @@
1
+ import type { ToolSetup } from "../setup.mts";
2
+ export declare const LABEL = "Claude Code";
3
+ export declare const claudeCodeSetup: ToolSetup;
@@ -0,0 +1,89 @@
1
+ // Claude Code as the factory's coding agent: the token it needs, the
2
+ // configuration `factory sync` writes for it, and how `remove` takes that
3
+ // configuration out.
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { listed } from "../lib/listed.mjs";
7
+ import { AGENT_KEY, AGENT_TOKEN } from "../parts.mjs";
8
+ import { CLAUDE_MD, hasAnyFactoryHook, hasFactoryHooks, hasImport, SETTINGS_JSON, withoutHooks, withoutImport, } from "../sync.mjs";
9
+ export const LABEL = "Claude Code";
10
+ const COMMAND = "claude";
11
+ const SYNC = "Run npx --no-install factory sync";
12
+ const READS = ["review", "cloud"];
13
+ const read = (root, path) => existsSync(join(root, path)) ? readFileSync(join(root, path), "utf8") : null;
14
+ export const claudeCodeSetup = {
15
+ found: (c) => c.hasCommand(COMMAND)
16
+ ? LABEL
17
+ : `${LABEL}, which is not installed: sessions and its token need it`,
18
+ steps: (c) => {
19
+ const parts = READS.filter((p) => c.parts.has(p));
20
+ if (!parts.length)
21
+ return [];
22
+ const installed = c.hasCommand(COMMAND);
23
+ const name = installed ? AGENT_TOKEN : AGENT_KEY;
24
+ return [
25
+ {
26
+ kind: "secret",
27
+ needs: parts.map((part) => ({ part, anyOf: [AGENT_TOKEN, AGENT_KEY] })),
28
+ storeAs: [name],
29
+ intro: installed
30
+ ? ["", `The coding agent's token: running ${COMMAND} setup-token...`]
31
+ : [],
32
+ get: installed ? { command: [COMMAND, "setup-token"] } : undefined,
33
+ prompt: installed
34
+ ? "Paste the token it printed (leave empty to do this later):"
35
+ : "Paste an API key from the Claude Console (leave empty to do this later):",
36
+ skipped: `No ${name} stored.`,
37
+ stored: (names) => `Stored as ${names.join(", ")}.`,
38
+ },
39
+ ];
40
+ },
41
+ checks: async (c) => [
42
+ hasImport(read(c.root, CLAUDE_MD))
43
+ ? {
44
+ state: "pass",
45
+ text: `${LABEL}: ${CLAUDE_MD} imports the factory's rules`,
46
+ }
47
+ : {
48
+ state: "fail",
49
+ text: `${LABEL}: ${CLAUDE_MD} imports the factory's rules`,
50
+ fix: SYNC,
51
+ },
52
+ hasFactoryHooks(read(c.root, SETTINGS_JSON))
53
+ ? {
54
+ state: "pass",
55
+ text: `${LABEL}: ${SETTINGS_JSON} has the factory's hooks`,
56
+ }
57
+ : {
58
+ state: "fail",
59
+ text: `${LABEL}: ${SETTINGS_JSON} has the factory's hooks`,
60
+ fix: SYNC,
61
+ },
62
+ c.hasCommand(COMMAND)
63
+ ? { state: "pass", text: `${LABEL}: the ${COMMAND} command is installed` }
64
+ : {
65
+ state: "fail",
66
+ text: `${LABEL}: the ${COMMAND} command is installed`,
67
+ fix: "Install Claude Code, then sign in",
68
+ },
69
+ ],
70
+ leftovers: (c) => {
71
+ const names = [AGENT_TOKEN, AGENT_KEY].filter((n) => c.secrets === null || c.secrets.includes(n));
72
+ if (!names.length)
73
+ return [];
74
+ const one = names.length === 1;
75
+ return [
76
+ `Delete the secret${one ? "" : "s"} ${listed(names)}${c.secrets === null ? " if set" : ""}, unless another workflow uses ${one ? "it" : "them"}`,
77
+ ];
78
+ },
79
+ unconfigure: (c) => {
80
+ const out = [];
81
+ const settings = read(c.root, SETTINGS_JSON);
82
+ if (settings !== null && hasAnyFactoryHook(settings))
83
+ out.push({ path: SETTINGS_JSON, text: withoutHooks(settings) });
84
+ const instructions = read(c.root, CLAUDE_MD);
85
+ if (instructions !== null && hasImport(instructions))
86
+ out.push({ path: CLAUDE_MD, text: withoutImport(instructions) });
87
+ return out;
88
+ },
89
+ };
@@ -0,0 +1,2 @@
1
+ export { claudeCodeSetup } from "./claude-code.mts";
2
+ export declare const DEFAULT_AGENT: "claude-code";
@@ -0,0 +1,5 @@
1
+ // The coding agent the factory's sessions run in. Claude Code is the only
2
+ // one, so the settings name none: the agent that adds a second adds the
3
+ // setting.
4
+ export { claudeCodeSetup } from "./claude-code.mjs";
5
+ export const DEFAULT_AGENT = "claude-code";
package/dist/board.mjs CHANGED
@@ -169,7 +169,7 @@ export function boardReport(number, board, cfg, settings) {
169
169
  ...found.notes.map((n) => `Note: ${n}`),
170
170
  ...(ready !== null &&
171
171
  ready !== DEFAULT_COLUMNS.Ready &&
172
- settings.builds.trigger !== "manual"
172
+ settings.builds.trigger === "own-server"
173
173
  ? [`Note: The poller needs FACTORY_READY_COLUMN set to "${ready}".`]
174
174
  : []),
175
175
  ...found.problems.map((p) => `Problem: ${p}.`),
package/dist/cli.mjs CHANGED
@@ -134,6 +134,11 @@ export const COMMANDS = [
134
134
  args: "",
135
135
  run: async (argv) => (await import("./doctor.mjs")).run(argv),
136
136
  },
137
+ {
138
+ words: ["remove"],
139
+ args: "",
140
+ run: async (argv) => (await import("./remove.mjs")).run(argv),
141
+ },
137
142
  {
138
143
  words: ["config", "get"],
139
144
  args: "KEY",
@@ -154,6 +159,11 @@ export const COMMANDS = [
154
159
  args: "",
155
160
  run: async () => (await import("./config.mjs")).run(["check"]),
156
161
  },
162
+ {
163
+ words: ["config", "explain"],
164
+ args: "",
165
+ run: async () => (await import("./config.mjs")).run(["explain"]),
166
+ },
157
167
  {
158
168
  words: ["plugins"],
159
169
  args: "[ROLE]",
@@ -174,10 +184,15 @@ export const COMMANDS = [
174
184
  args: "",
175
185
  run: async (argv) => (await import("./board.mjs")).run(["check", ...argv]),
176
186
  },
187
+ {
188
+ words: ["board"],
189
+ args: "--dry-run",
190
+ run: async (argv) => (await import("./board.mjs")).run(argv),
191
+ },
177
192
  {
178
193
  words: ["poller"],
179
- args: "",
180
- run: async () => (await import("./poller.mjs")).run(),
194
+ args: "[--once]",
195
+ run: async (argv) => (await import("./poller.mjs")).run(argv),
181
196
  },
182
197
  {
183
198
  words: ["merge-policy"],
@@ -0,0 +1,5 @@
1
+ import { type ToolSetup } from "../setup.mts";
2
+ /** The repository a remote's address names, or null for one not on
3
+ * GitHub. */
4
+ export declare function githubRepository(url: string): string | null;
5
+ export declare const githubCodeHostSetup: ToolSetup;
@@ -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. */
package/dist/config.d.mts CHANGED
@@ -1,10 +1,14 @@
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
6
  export declare const ROLES: readonly ["mockups", "builder", "reviewer"];
6
7
  export type Role = (typeof ROLES)[number];
7
8
  export declare const TRIGGERS: readonly ["own-server", "github-action", "manual"];
9
+ /** How often the scheduled poller may check the board, in minutes: each
10
+ * divides an hour, so a schedule every N minutes keeps an even beat. */
11
+ export declare const POLL_MINUTES: readonly [5, 10, 15, 30, 60];
8
12
  export declare const SPECS: readonly ["none", "openspec"];
9
13
  declare const FIELD_DEFAULTS: {
10
14
  readonly session: "Session";
@@ -23,7 +27,9 @@ export type Settings = {
23
27
  version: 1;
24
28
  repository: string;
25
29
  tickets: {
26
- type: "github";
30
+ type: string;
31
+ /** The keys the ticket system adds under `tickets`, by name. */
32
+ options: Record<string, string>;
27
33
  board: number | null;
28
34
  /** The board's column for each state, null for none. */
29
35
  columns: Record<StateKey, string | null>;
@@ -32,13 +38,15 @@ export type Settings = {
32
38
  };
33
39
  /** Where pull requests are. */
34
40
  codeHost: {
35
- type: "github";
41
+ type: string;
36
42
  };
37
43
  builds: {
38
44
  /** What notices a card moved to Ready and starts its build. */
39
45
  trigger: (typeof TRIGGERS)[number];
40
46
  /** Where an unattended build runs. */
41
- runner: "github-actions";
47
+ runner: string;
48
+ /** How often the scheduled poller checks the board. */
49
+ pollMinutes: (typeof POLL_MINUTES)[number];
42
50
  };
43
51
  specs: (typeof SPECS)[number];
44
52
  beforeCommit: string[];
@@ -60,6 +68,17 @@ export type Settings = {
60
68
  site: Site | null;
61
69
  /** How long each kind of unattended session may run, in minutes. */
62
70
  sessionMinutes: Record<SessionKind, number>;
71
+ /** The numbers the process rules use, which `factory sync` writes into
72
+ * the copies of the rules and skills that state them. */
73
+ rules: {
74
+ smallChangeLines: number;
75
+ reviewRounds: number;
76
+ };
77
+ };
78
+ /** Each number the rules use, with its default. */
79
+ export declare const RULE_NUMBERS: {
80
+ readonly "small-change-lines": 30;
81
+ readonly "review-rounds": 2;
63
82
  };
64
83
  /** Each kind of unattended session, with how long it may run by default. */
65
84
  export declare const SESSION_MINUTES: {
@@ -104,7 +123,7 @@ export declare const SETTINGS_FILE = ".claude/factory.yaml";
104
123
  /** The settings with every default filled in. Throws a SettingsError naming
105
124
  * the key on anything unsound. `exists` says whether a path from the root
106
125
  * exists, for the plug-ins' files. */
107
- export declare function parseSettings(raw: unknown, exists: (path: string) => boolean): Settings;
126
+ export declare function parseSettings(raw: unknown, exists: (path: string) => boolean, built?: Built): Settings;
108
127
  /** One line for each pattern that matches none of `files`: a stale pattern
109
128
  * is how a policy rots. */
110
129
  export declare function patternWarnings(s: Settings, files: string[]): string[];
@@ -146,8 +165,8 @@ export declare function run(argv: string[]): Promise<number>;
146
165
  export type Target = {
147
166
  repository: string;
148
167
  board: number | null;
149
- /** Whether something starts builds from the board. */
150
- watched: boolean;
168
+ /** What starts builds from the board, and how long it may take. */
169
+ watch: Watch | null;
151
170
  /** The column each state shows in on the board. */
152
171
  columns: Columns;
153
172
  };