@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
@@ -0,0 +1,321 @@
1
+ # Setting up on GitHub by hand
2
+
3
+ Every step [`factory init`](setup.md) takes, for someone who cannot run it
4
+ or wants to see what it does. If you can run `init`, do that: it does all
5
+ of this for you. Here you do [the basics](#the-basics), then only the
6
+ parts you want, in the order they appear.
7
+
8
+ ## Choose what you want
9
+
10
+ The basics are all the [quick start](../quick-start.md) needs. Everything
11
+ else is optional, and each part stands alone. You need the tools under
12
+ [What you need](setup.md#what-you-need), and the package
13
+ [installed](../quick-start.md#1-install).
14
+
15
+ | Part | What it takes |
16
+ | --------------------------------------------------------------------------- | ------------------------------------------------------------------ |
17
+ | [The basics](#the-basics) | A settings file and one command |
18
+ | [The automated review](#the-automated-review) | The Claude GitHub App, a workflow file, and your Claude token |
19
+ | [A board](#a-board) | A Project, one setting, and a GitHub token |
20
+ | [Builds in the cloud](#builds-in-the-cloud) | Your Claude token and a GitHub token |
21
+ | [Pull requests that merge themselves](#pull-requests-that-merge-themselves) | A list of files, one repository setting, and a second GitHub token |
22
+ | [Signed commits from cloud builds](#signed-commits-from-cloud-builds) | A signing key |
23
+
24
+ [Run `factory init`](setup.md#run-factory-init) says what each part gives
25
+ you. Every part's secrets are gathered in [Secrets](#secrets), so you can
26
+ make them all at once.
27
+
28
+ ## The basics
29
+
30
+ If you followed the quick start, this is done.
31
+
32
+ 1. Write `.claude/factory.yaml`, with your repository's owner and name:
33
+
34
+ ```yaml
35
+ version: 1
36
+ repository: your-name/your-repo
37
+ ```
38
+
39
+ 2. Write the factory's files:
40
+
41
+ ```bash
42
+ factory sync
43
+ ```
44
+
45
+ It writes the skills, agents, and rules Claude Code loads, under
46
+ `.claude/`; adds hook entries to `.claude/settings.json`; adds one line
47
+ to `CLAUDE.md`; and writes the workflows under `.github/workflows/`.
48
+ [What lives where](reference.md) names each.
49
+
50
+ 3. Say in your `CLAUDE.md` how to check a change, such as the commands for
51
+ your tests and linter. A build runs them.
52
+ 4. Optionally, list commands to run before every commit a session makes,
53
+ under [`before-commit`](../configuration.md#before-commit):
54
+
55
+ ```yaml
56
+ before-commit:
57
+ - npm run lint
58
+ ```
59
+
60
+ 5. Check, commit, and merge:
61
+
62
+ ```bash
63
+ factory sync --check
64
+ factory config check
65
+ git switch -c set-up-factory && git add -A
66
+ git commit -m "Set up the software factory"
67
+ git push -u origin set-up-factory
68
+ gh pr create --fill
69
+ ```
70
+
71
+ Merge the pull request on GitHub, then `git switch main && git pull`,
72
+ and start a new Claude Code session.
73
+
74
+ **It worked when** typing `/factory` in the new session offers
75
+ `/factory-refine` and `/factory-build`.
76
+
77
+ Every part below is turned on the same way: add its settings to
78
+ `.claude/factory.yaml`, run `factory sync`, do the steps
79
+ the part lists, and merge what `sync` wrote.
80
+
81
+ ## The automated review
82
+
83
+ Claude reads every pull request once it is marked ready, comments on what
84
+ it finds, and posts a verdict. The session that built the pull request
85
+ answers each comment, fixing it or rejecting it with evidence.
86
+
87
+ It is on while `.claude/factory.yaml` has
88
+ [`ci-review`](../configuration.md#ci-review). Three files have similar
89
+ names, and `sync` writes all three:
90
+
91
+ | File | What it is |
92
+ | ---------------------------------------------- | ---------------------------------------------------------- |
93
+ | `.github/workflows/factory-claude-review.yml` | The workflow that runs the review |
94
+ | `.github/factory-review.md` | The review's instructions |
95
+ | `.github/workflows/factory-review-verdict.yml` | Turns each review's summary into a "Review verdict" status |
96
+
97
+ 1. **Install the Claude GitHub App** on the repository, from
98
+ <https://github.com/apps/claude>. The review posts its comments through
99
+ it. Or run `/install-github-app` in Claude Code, which installs the app
100
+ and also stores the Claude token for you.
101
+ 2. **Store your Claude token** as `CLAUDE_CODE_OAUTH_TOKEN`
102
+ ([Secrets](#secrets)), unless step 1 did.
103
+ 3. **Write `ci-review` in `.claude/factory.yaml`,** and run
104
+ `factory sync`, which writes the three files above:
105
+
106
+ ```yaml
107
+ ci-review:
108
+ commands:
109
+ - npm test
110
+ - npx tsc --noEmit
111
+ ```
112
+
113
+ Each of `commands` is one the reviewer may run to confirm a finding,
114
+ such as your tests. To let it run nothing of yours, write the key
115
+ alone, and it reads the pull request and comments:
116
+
117
+ ```yaml
118
+ ci-review:
119
+ ```
120
+
121
+ The workflow installs your project with `npm ci`, and chooses the
122
+ model from `FACTORY_BUILD_MODEL` ([Variables](reference.md#workflows))
123
+ when it is set.
124
+
125
+ 4. **Optionally, write `.github/review-notes.md`:** what a reviewer must
126
+ know about your project that your `CLAUDE.md` does not say. The
127
+ reviewer reads it when it exists.
128
+ 5. **To make the verdict count,** add "Review verdict" to the required
129
+ status checks of your default branch: Settings, then Rules or Branches.
130
+ Until you do, it is information only.
131
+
132
+ **It worked when** a pull request you mark ready gets Claude's comments
133
+ and a "Review verdict" status in its checks.
134
+
135
+ ## A board
136
+
137
+ A GitHub Project that shows each ticket's state as a column, which session
138
+ has it, and what it has cost. [Workflow](../workflow.md#the-board) says
139
+ what each column means.
140
+
141
+ 1. **Create a Project** under the account or the organization that owns the
142
+ repository: its Projects tab, "New project", Board layout. Link it to
143
+ the repository from the Project's menu, so it shows on the repository's
144
+ Projects tab. Its number is the last part of its address.
145
+ 2. **Give it the factory's columns:** Backlog, In refinement, Ready, In
146
+ progress, In review, and Done, in its Status field. A new Project starts
147
+ with Todo, In Progress, and Done. To keep columns of your own, map them
148
+ under [`tickets.columns`](../configuration.md#ticketscolumns) instead.
149
+ 3. **Give it the three fields the sync writes:** Session, a Text field;
150
+ Runs in, a single select with the options Local and Actions; and Cost, a
151
+ Number. A field the sync does not find, it skips.
152
+ 4. **Point the settings at it,** with the Project's number under
153
+ [`tickets`](../configuration.md#tickets):
154
+
155
+ ```yaml
156
+ tickets:
157
+ board: 7
158
+ ```
159
+
160
+ Then `factory board check` shows how it reads your
161
+ columns.
162
+
163
+ 5. **Store a GitHub token** as `FACTORY_BOARD_TOKEN` ([Secrets](#secrets)).
164
+ 6. **Run `factory sync`.** It writes the board-sync
165
+ workflow, the only thing that writes to the board. It never creates,
166
+ renames, or removes a column or field.
167
+
168
+ ## Builds in the cloud
169
+
170
+ `factory build 12` builds ticket 12 in GitHub Actions and
171
+ prints the run's link, with no session open on your machine.
172
+
173
+ `sync` already wrote the workflows these use, and each does nothing until
174
+ it has work and its secrets:
175
+
176
+ | Workflow | Runs a Claude Code session that |
177
+ | ----------------------- | ------------------------------------------------------------------------------------ |
178
+ | `factory-build.yml` | builds a ticket |
179
+ | `factory-review.yml` | answers a review you submit on a pull request |
180
+ | `factory-conflicts.yml` | resolves a conflict between a pull request and your main branch |
181
+ | `factory-deps.yml` | moves Dependabot's pull requests along, written once `.github/dependabot.yml` exists |
182
+
183
+ 1. **Store your Claude token** as `CLAUDE_CODE_OAUTH_TOKEN`.
184
+ 2. **Store a GitHub token that can push**, as `FACTORY_BUILD_TOKEN`. With
185
+ a board, `FACTORY_BOARD_TOKEN` stands in for it when it has the
186
+ `workflow` scope, so one token does both ([Secrets](#secrets)).
187
+
188
+ **It worked when** `factory build 12`, with the number of a refined
189
+ ticket, prints a run's link, and the run opens a pull request.
190
+
191
+ A build may run for 230 minutes, which
192
+ [`session-minutes`](../configuration.md#session-minutes) changes; GitHub
193
+ stops any job at six hours.
194
+
195
+ ### Starting builds from the board
196
+
197
+ To have a ticket build when you move its card to Ready on
198
+ [a board](#a-board), a small program, the poller, watches the board and
199
+ starts each build. Set
200
+ [`builds.trigger: github-action`](../configuration.md#builds) to run it on
201
+ a schedule in GitHub Actions, with nothing to host, or `own-server` to
202
+ host it yourself.
203
+ [Builds in the cloud](../builds.md) explains each and what it costs.
204
+
205
+ ## Pull requests that merge themselves
206
+
207
+ A pull request that touches only files you listed as safe merges once
208
+ every check passes. Everything else still waits for you. Turn this on
209
+ last: it is only as safe as your tests and the review. Start with a short
210
+ list, such as documentation.
211
+
212
+ 1. **List the files** under
213
+ [`auto-merge.allow`](../configuration.md#auto-merge), with exceptions
214
+ under `deny`:
215
+
216
+ ```yaml
217
+ auto-merge:
218
+ allow:
219
+ - docs/**
220
+ ```
221
+
222
+ Then run `factory sync`, which writes the merge-policy workflow. It
223
+ labels each pull request `merge: automatic` or `merge: manual` and
224
+ says why.
225
+
226
+ 2. **Allow auto-merge** on the repository: Settings, General, "Allow
227
+ auto-merge".
228
+ 3. **Store a GitHub token** as `FACTORY_AUTOMERGE_TOKEN` ([Secrets](#secrets)).
229
+
230
+ **It worked when** a pull request that touches only files you listed gets
231
+ the `merge: automatic` label.
232
+
233
+ ## Signed commits from cloud builds
234
+
235
+ Without a key, a build's commits are unsigned.
236
+
237
+ 1. Make a key for this and nothing else, with no passphrase:
238
+
239
+ ```bash
240
+ ssh-keygen -t ed25519 -N "" -C "factory builds" -f factory-signing-key
241
+ ```
242
+
243
+ 2. Add `factory-signing-key.pub` to the GitHub account whose token the
244
+ builds use: Settings, "SSH and GPG keys", "New SSH key", key type
245
+ "Signing Key".
246
+ 3. Store the private half, then delete both files:
247
+
248
+ ```bash
249
+ gh secret set FACTORY_SIGNING_KEY < factory-signing-key
250
+ rm factory-signing-key factory-signing-key.pub
251
+ ```
252
+
253
+ Anything that can run a workflow in the repository can read the key, as
254
+ it can the build token. Removing the public key from the account ends its
255
+ use.
256
+
257
+ **It worked when** the commits of the next build's pull request show as
258
+ "Verified".
259
+
260
+ ## Secrets
261
+
262
+ Everything here is stored on the repository with `gh secret set NAME`,
263
+ which asks for the value. Nothing the factory runs on your machine needs
264
+ one; each is for something that runs in GitHub Actions.
265
+
266
+ | Secret | Needed for | Make it |
267
+ | ------------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
268
+ | `CLAUDE_CODE_OAUTH_TOKEN` | The automated review, and builds in the cloud | `claude setup-token`, on your machine. It bills your Claude subscription |
269
+ | `FACTORY_BOARD_TOKEN` | A board. Also builds in the cloud, when `FACTORY_BUILD_TOKEN` is not set | [A classic token](https://github.com/settings/tokens/new?scopes=repo,project,workflow&description=factory%20board) with `repo`, `project`, and `workflow` |
270
+ | `FACTORY_BUILD_TOKEN` | Builds in the cloud. Optional with a board token; used instead of it when both are set | [A classic token](https://github.com/settings/tokens/new?scopes=repo,workflow&description=factory%20builds) with `repo` and `workflow` |
271
+ | `FACTORY_AUTOMERGE_TOKEN` | Pull requests that merge themselves | [A classic token](https://github.com/settings/tokens/new?scopes=repo&description=factory%20auto-merge) with `repo` |
272
+ | `FACTORY_SIGNING_KEY` | Signed commits from cloud builds | [The steps above](#signed-commits-from-cloud-builds) |
273
+
274
+ Each token link opens GitHub's page with the scopes checked; choose an
275
+ expiry date and generate it. The account that makes a token is the one
276
+ its work is done as, and must be able to write the repository, and the
277
+ Project for the board token.
278
+
279
+ **One GitHub token is enough for everything.** Make one classic token with
280
+ `repo` and `workflow`, and `project` when you have a board, and store it
281
+ under each name your parts read; `init` does the same. Any workflow a pull
282
+ request from the repository adds can read every secret, so separate tokens
283
+ protect little.
284
+
285
+ Builds and auto-merge also take a fine-grained token instead: read and
286
+ write access to Contents, Pull requests, Issues, and Workflows for builds,
287
+ and to Contents and Pull requests for auto-merge. The board token must be
288
+ classic.
289
+
290
+ To set them in one go, run the lines for your parts and paste each value
291
+ when asked. `claude setup-token` prints the first value, and the other
292
+ three lines can all take the same GitHub token:
293
+
294
+ ```bash
295
+ claude setup-token
296
+ gh secret set CLAUDE_CODE_OAUTH_TOKEN # the review, or builds in the cloud
297
+ gh secret set FACTORY_BOARD_TOKEN # a board
298
+ gh secret set FACTORY_BUILD_TOKEN # builds in the cloud, with no board
299
+ gh secret set FACTORY_AUTOMERGE_TOKEN # pull requests that merge themselves
300
+ ```
301
+
302
+ Two optional settings:
303
+
304
+ - **Paying by the token instead of a subscription:** store an API key from
305
+ the [Claude Console](https://platform.claude.com) as `ANTHROPIC_API_KEY`.
306
+ A workflow uses it when `CLAUDE_CODE_OAUTH_TOKEN` is not set.
307
+ - **The model a cloud session uses:** `gh variable set FACTORY_BUILD_MODEL`.
308
+ This is a variable, not a secret.
309
+
310
+ Everything the factory owns starts with `FACTORY_`. The other two keep the
311
+ names Claude's GitHub Action gives them, since your other workflows may
312
+ use them too.
313
+
314
+ ## Checking it
315
+
316
+ ```bash
317
+ factory doctor
318
+ ```
319
+
320
+ **It worked when** every check shows ✓, or `-` for a part you left off.
321
+ [Changing it later](setup.md#changing-it-later) says what it checks.
@@ -20,33 +20,32 @@ Everything the factory adds, and what
20
20
  | `.claude/factory/`, the rules | Setup | Deletes it |
21
21
  | `.claude/skills/factory-*/` | Setup | Deletes them |
22
22
  | `.claude/agents/factory-*.md` | Setup | Deletes them |
23
- | Five hook entries in `.claude/settings.json` | Setup | Removes those five, keeps the rest |
23
+ | Five hook entries in `.claude/settings.json` | Setup | Removes those five, keeps the rest, and deletes an emptied file |
24
24
  | `attribution` in `.claude/settings.json`, when the file had none | Setup | Leaves it: delete the key to get Claude Code's lines back |
25
- | One line in `CLAUDE.md` | Setup | Removes that line |
25
+ | One line in `CLAUDE.md` | Setup | Removes that line, and deletes an emptied file |
26
26
  | `.github/workflows/factory-check.yml` | Setup | Deletes them |
27
27
  | Other `.github/workflows/factory-*.yml` | Setup, and each part you turned on | Deletes them |
28
- | `.github/factory-review.md` | The automated review | Deletes it |
28
+ | `.github/factory-review.md` | Setup | Deletes it |
29
+ | `.github/actions/factory-*/`, the step the workflows share | Setup | Deletes them |
29
30
  | `.github/review-notes.md` | You, if you wrote one. It is yours | Leaves it |
30
31
  | The `@davidbyoung/software-factory` entry in `package.json`, and `package-lock.json` | `npm install` | Left for `npm uninstall` |
31
- | `package.json` itself, if you had none | Setup | Leaves it. Delete it and its lockfile if nothing else uses them |
32
+ | `package.json` itself, if you had none | You, before installing | Leaves it. Delete it and its lockfile if nothing else uses them |
32
33
  | `node_modules/` in `.gitignore` | Setup, if it was missing | Leaves it. Remove the line if you deleted `package.json` |
33
34
 
34
- The "Removing it" column says what `factory remove`
35
- (_[Planned](../developing.md#what-is-built)_) does with each; until it is
36
- built, do the same by hand.
35
+ The "Removing it" column says what `factory remove` does with each.
37
36
 
38
37
  ### On GitHub
39
38
 
40
- | What | Added when | To undo |
41
- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------- |
42
- | Secrets and variables named `FACTORY_...` | You create them | Delete them |
43
- | `CLAUDE_CODE_OAUTH_TOKEN` | You create it, for the automated review and builds in the cloud | Delete it, unless another workflow uses it |
44
- | Labels: `merge: automatic`, `merge: manual`, `verdict: override`, `follow-up`, `spec` | First use | Delete them. Deleting a label removes it from every ticket |
45
- | A CI check that the factory's files are in step | Setup | Goes with `factory-check.yml` |
46
- | A "Review verdict" required check | You add it to your branch rules | Remove it from the rules **first**, or pull requests wait on it forever |
47
- | Statuses on pull requests: "Who merges", "Review verdict" | Each pull request | They stay in history |
48
- | One open ticket titled "Follow-ups" | The first follow-up | Close it |
49
- | Comments on tickets the factory worked | Each refinement and build | They stay. They hold the ticket's history |
39
+ | What | Added when | To undo |
40
+ | ------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
41
+ | Secrets and variables named `FACTORY_...` | You create them | Delete them |
42
+ | `CLAUDE_CODE_OAUTH_TOKEN` | You create it, for the automated review and builds in the cloud | Delete it, unless another workflow uses it |
43
+ | Labels: `merge: automatic`, `merge: manual`, `verdict: override`, `follow-up`, `spec` | First use | Delete them. Deleting a label removes it from every ticket |
44
+ | A CI check that the factory's files are in step | Setup | Goes with `factory-check.yml` |
45
+ | A "Review verdict" required check, as the ruleset "Software factory" | `init`, when the review is on; or you, in your branch rules | Delete the ruleset, under Settings, Rules, **first**, or pull requests wait on it forever |
46
+ | Statuses on pull requests: "Who merges", "Review verdict" | Each pull request | They stay in history |
47
+ | One open ticket titled "Follow-ups" | The first follow-up | Close it |
48
+ | Comments on tickets the factory worked | Each refinement and build | They stay. They hold the ticket's history |
50
49
 
51
50
  ### On your board
52
51
 
@@ -55,16 +54,16 @@ built, do the same by hand.
55
54
  | Up to six columns, if yours lacked them and `factory init` added them | Delete the ones you do not want |
56
55
  | Three fields, Session, Runs in, and Cost, if yours lacked them and `init` added them. The sync also sets the board's own Status field | Delete the three |
57
56
  | A Project `init` created, linked to the repository | Delete it, or keep it as an ordinary Project |
58
- | The "Software factory" ruleset, requiring "Review verdict" | Delete the ruleset, under Settings, Rules |
59
57
 
60
58
  A board the factory created for you is an ordinary GitHub Project. Keep
61
59
  it or delete it.
62
60
 
63
61
  ### Outside GitHub
64
62
 
65
- Only if you turned on builds that start from the board: **the poller**,
66
- wherever you host it, with the four `FACTORY_` variables you gave it. Stop
67
- and delete it.
63
+ Only if you host the poller
64
+ ([`builds.trigger: own-server`](../configuration.md#builds)): **the
65
+ poller**, wherever you host it, with the four `FACTORY_` variables you
66
+ gave it. Stop and delete it.
68
67
 
69
68
  ## Workflows
70
69
 
@@ -72,18 +71,19 @@ and delete it.
72
71
  Each one that runs a Claude Code session first checks whether there is
73
72
  anything to do, and stops there when there is not.
74
73
 
75
- | Workflow | Starts on | What it does |
76
- | ----------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | `factory-check.yml` | Every pull request | Fails when the factory's files differ from what your settings and version would write |
78
- | `factory-build.yml` | The poller, `factory build N`, or by hand | Runs a session that builds the ticket |
79
- | `factory-review.yml` | A review you submit on a pull request | Runs a session that answers it, when `factory pr review-pending N REVIEW` exits 0 |
80
- | `factory-conflicts.yml` | A push to the default branch, nightly at 09:00 UTC, or by hand | Runs the conflict sweep, when `factory pr conflicts` exits 0 |
81
- | `factory-deps.yml` | 01:00, 13:00, and 19:00 UTC, or by hand | Runs a session that moves Dependabot's pull requests along, when `factory deps --any` exits 0. Written once `.github/dependabot.yml` exists |
82
- | `factory-deps-auto-merge.yml` | Dependabot's pull requests | Lets one merge itself when your `auto-merge` settings allow its files. Written once `.github/dependabot.yml` exists |
83
- | `factory-board-sync.yml` | Ticket and pull request events, and nightly | Sets the board's columns and fields from the tickets' marker comments. Written once `tickets.board` is set |
84
- | `factory-merge-policy.yml` | Every pull request | Labels it `merge: automatic` or `merge: manual`, and turns auto-merge on for the first. Written once `auto-merge.allow` is set |
85
- | `factory-review-verdict.yml` | Each automated review | Posts the "Review verdict" status from the review's summary |
86
- | `factory-claude-review.yml` | Every pull request once it is marked ready, and each push after | Runs the automated review. Written once `ci-review` is set |
74
+ | Workflow | Starts on | What it does |
75
+ | ----------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | `factory-check.yml` | Every pull request | Fails when the factory's files differ from what your settings and version would write |
77
+ | `factory-build.yml` | The poller, `factory build N`, or by hand | Runs a session that builds the ticket |
78
+ | `factory-review.yml` | A review you submit on a pull request | Runs a session that answers it, when `factory pr review-pending N REVIEW` exits 0 |
79
+ | `factory-conflicts.yml` | A push to the default branch, nightly at 09:00 UTC, or by hand | Runs the conflict sweep, when `factory pr conflicts` exits 0 |
80
+ | `factory-deps.yml` | 01:00, 13:00, and 19:00 UTC, or by hand | Runs a session that moves Dependabot's pull requests along, when `factory deps --any` exits 0. Written once `.github/dependabot.yml` exists |
81
+ | `factory-deps-auto-merge.yml` | Dependabot's pull requests | Lets one merge itself when your [`auto-merge`](../configuration.md#auto-merge) settings allow its files. Written once `.github/dependabot.yml` exists |
82
+ | `factory-board-sync.yml` | Ticket and pull request events, and nightly | Sets the board's columns and fields from the tickets' marker comments. Written once [`tickets.board`](../configuration.md#tickets) is set |
83
+ | `factory-merge-policy.yml` | Every pull request | Labels it `merge: automatic` or `merge: manual`, and turns auto-merge on for the first. Written once `auto-merge.allow` is set |
84
+ | `factory-review-verdict.yml` | Each automated review | Posts the "Review verdict" status from the review's summary |
85
+ | `factory-claude-review.yml` | Every pull request once it is marked ready, and each push after | Runs the automated review. Written once [`ci-review`](../configuration.md#ci-review) is set |
86
+ | `factory-poller.yml` | Every `builds.poll-minutes` minutes, or by hand | Runs one pass of the poller, starting a build for each Ready ticket. Written once `builds.trigger` is `github-action` |
87
87
 
88
88
  **Starting a build by hand.** The Actions tab, "Factory build", "Run
89
89
  workflow", and the ticket's number. The board's "Runs in" field then shows
@@ -91,7 +91,8 @@ workflow", and the ticket's number. The board's "Runs in" field then shows
91
91
  tool call the session was denied, with the reason.
92
92
 
93
93
  The poller starts `factory-build.yml` on the repository's default branch,
94
- which it reads once when it starts. The run does no start check of its
94
+ which a poller you host reads once when it starts, and a scheduled pass on
95
+ each run. The run does no start check of its
95
96
  own: only someone with write access can start a workflow.
96
97
 
97
98
  A review on a pull request that conflicts with the default branch starts
@@ -125,7 +126,7 @@ committer are then that account's.
125
126
 
126
127
  When a build cannot start, the poller's comment on the ticket reads "Could
127
128
  not start a build in GitHub Actions ... answered 403": give the token the
128
- scopes [Secrets](setup.md#secrets) names. A failed board sync arrives as
129
+ scopes [Secrets](by-hand.md#secrets) names. A failed board sync arrives as
129
130
  an email from GitHub.
130
131
 
131
132
  ## The board
@@ -147,28 +148,28 @@ number, the last part of its address, is `tickets.board` in your settings.
147
148
 
148
149
  ## Labels and statuses
149
150
 
150
- | Name | Kind | Set by |
151
- | ------------------- | ------------------------ | ------------------------------------------------------------------------------ |
152
- | `merge: automatic` | Label on a pull request | The merge policy, when every file is allowed |
153
- | `merge: manual` | Label on a pull request | The merge policy, otherwise |
154
- | `verdict: override` | Label on a pull request | Only a person: passes the review verdict for one commit. Sessions never add it |
155
- | `follow-up` | Label on a ticket | The first follow-up line, on the one follow-ups ticket |
156
- | `spec` | Label on a ticket | Refinement, for a change your users will see, when `specs: openspec` |
157
- | Who merges | Status on a pull request | The merge policy: which way it goes, and why |
158
- | Review verdict | Status on a pull request | The review-verdict workflow: success only when the review said ready |
151
+ | Name | Kind | Set by |
152
+ | ------------------- | ------------------------ | ------------------------------------------------------------------------------------------------- |
153
+ | `merge: automatic` | Label on a pull request | The merge policy, when every file is allowed |
154
+ | `merge: manual` | Label on a pull request | The merge policy, otherwise |
155
+ | `verdict: override` | Label on a pull request | Only a person: passes the review verdict for one commit. Sessions never add it |
156
+ | `follow-up` | Label on a ticket | The first follow-up line, on the one follow-ups ticket |
157
+ | `spec` | Label on a ticket | Refinement, for a change your users will see, when [`specs: openspec`](../configuration.md#specs) |
158
+ | Who merges | Status on a pull request | The merge policy: which way it goes, and why |
159
+ | Review verdict | Status on a pull request | The review-verdict workflow: success only when the review said ready |
159
160
 
160
161
  ## Hooks
161
162
 
162
163
  `sync` adds five hooks to `.claude/settings.json`. They run inside Claude
163
164
  Code sessions in this repository, not in your own terminal.
164
165
 
165
- | Hook | What it does |
166
- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
167
- | Before a shell command | Blocks a commit on your main branch, a push to it, and a force push. Runs your `before-commit` commands before a commit |
168
- | Before posting ticket text | Refuses text with a bare `<tag>`, which GitHub would silently drop |
169
- | When a reviewer starts or stops | Records the run on the ticket, so its cost is counted |
170
- | Before an unattended build writes a file under `.claude/` | Approves the write, when the run is one the factory started and the file is not `.claude/settings.json` or `.claude/settings.local.json` |
171
- | When a session starts | Shows unfinished branches and where each ticket stands |
166
+ | Hook | What it does |
167
+ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
168
+ | Before a shell command | Blocks a commit on your main branch, a push to it, and a force push. Runs your [`before-commit`](../configuration.md#before-commit) commands before a commit |
169
+ | Before posting ticket text | Refuses text with a bare `<tag>`, which GitHub would silently drop |
170
+ | When a reviewer starts or stops | Records the run on the ticket, so its cost is counted |
171
+ | Before an unattended build writes a file under `.claude/` | Approves the write, when the run is one the factory started and the file is not `.claude/settings.json` or `.claude/settings.local.json` |
172
+ | When a session starts | Shows unfinished branches and where each ticket stands |
172
173
 
173
174
  Claude Code protects `.claude/`, and an unattended run denies a write
174
175
  there that nothing approves. The fourth hook approves, only in a run the
@@ -205,12 +206,14 @@ Typing `/factory` in a session lists them, which is also how to check that
205
206
  a session picked the factory up.
206
207
 
207
208
  **Where the files live.** `sync` writes the factory's skills to
208
- `.claude/skills/factory-*/` and its agents to `.claude/agents/factory-*.md`.
209
- Your own skills go in `.claude/skills/NAME/SKILL.md` and your own agents
210
- in `.claude/agents/NAME.md`, as for any Claude Code project. A plug-in
211
- names one under `plugins` in `.claude/factory.yaml`, with `skill:` for a
212
- folder in `.claude/skills/` and `agent:` for a file in `.claude/agents/`.
213
- An agent's description is the `description` in its file's front matter.
209
+ `.claude/skills/factory-*/` and its agents to
210
+ `.claude/agents/factory-*.md`. Your own skills go in
211
+ `.claude/skills/NAME/SKILL.md` and your own agents in
212
+ `.claude/agents/NAME.md`, as for any Claude Code project. A plug-in names
213
+ one under [`plugins`](../configuration.md#plugins) in
214
+ `.claude/factory.yaml`, with `skill:` for a folder in `.claude/skills/`
215
+ and `agent:` for a file in `.claude/agents/`. An agent's description is
216
+ the `description` in its file's front matter.
214
217
 
215
218
  A colon, as in `/factory:refine`, is something Claude Code adds to a
216
219
  skill that comes from a plugin. Plain skill files get plain names, so the
@@ -256,10 +259,11 @@ These come from GitHub, GitHub Actions, or Claude Code, not from the
256
259
  factory.
257
260
 
258
261
  - **GitHub's own runners stop any job at 6 hours.** A cloud session's job
259
- is given its `session-minutes` plus 10, so the step that releases the
260
- claim still runs; a value above 350 does nothing there. A self-hosted
261
- runner allows longer. `sync` writes each `session-minutes` value into
262
- the session workflows as the session step's timeout.
262
+ is given its [`session-minutes`](../configuration.md#session-minutes)
263
+ plus 10, so the step that releases the claim still runs; a value above
264
+ 350 does nothing there. A self-hosted runner allows longer. `sync`
265
+ writes each `session-minutes` value into the session workflows as the
266
+ session step's timeout.
263
267
  - GitHub's shortest schedule is every five minutes, and scheduled runs can
264
268
  start late.
265
269
  - Public repositories are not billed for Actions minutes.