@clemrig/factory 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +21 -14
  2. package/dist/app/board.js +1 -0
  3. package/dist/app/board.js.map +1 -1
  4. package/dist/app/prototype.d.ts +15 -0
  5. package/dist/app/prototype.js +65 -0
  6. package/dist/app/prototype.js.map +1 -0
  7. package/dist/app/review.js +3 -2
  8. package/dist/app/review.js.map +1 -1
  9. package/dist/app/spec-page.d.ts +24 -0
  10. package/dist/app/spec-page.js +72 -0
  11. package/dist/app/spec-page.js.map +1 -0
  12. package/dist/app/workflows/issue-save.d.ts +4 -1
  13. package/dist/app/workflows/issue-save.js +83 -9
  14. package/dist/app/workflows/issue-save.js.map +1 -1
  15. package/dist/app/workflows/stages/agents.d.ts +5 -0
  16. package/dist/app/workflows/stages/agents.js +5 -0
  17. package/dist/app/workflows/stages/agents.js.map +1 -1
  18. package/dist/app/workflows/stages/deliver.js +11 -3
  19. package/dist/app/workflows/stages/deliver.js.map +1 -1
  20. package/dist/app/workflows/stages/implement.js +8 -2
  21. package/dist/app/workflows/stages/implement.js.map +1 -1
  22. package/dist/app/workflows/stages/plan.js +2 -0
  23. package/dist/app/workflows/stages/plan.js.map +1 -1
  24. package/dist/app/workflows/stages/prepare.js +15 -1
  25. package/dist/app/workflows/stages/prepare.js.map +1 -1
  26. package/dist/app/workflows/stages/review.js +9 -2
  27. package/dist/app/workflows/stages/review.js.map +1 -1
  28. package/dist/app/workflows/stages/run.d.ts +14 -1
  29. package/dist/app/workflows/stages/run.js.map +1 -1
  30. package/dist/cli/ui.d.ts +4 -3
  31. package/dist/cli/ui.js +12 -4
  32. package/dist/cli/ui.js.map +1 -1
  33. package/dist/domain/board.d.ts +4 -0
  34. package/dist/domain/board.js +1 -0
  35. package/dist/domain/board.js.map +1 -1
  36. package/dist/domain/pull-request.d.ts +9 -2
  37. package/dist/domain/pull-request.js +12 -2
  38. package/dist/domain/pull-request.js.map +1 -1
  39. package/dist/domain/spec-page.d.ts +188 -0
  40. package/dist/domain/spec-page.js +242 -0
  41. package/dist/domain/spec-page.js.map +1 -0
  42. package/dist/domain/spec.d.ts +13 -1
  43. package/dist/domain/spec.js +60 -8
  44. package/dist/domain/spec.js.map +1 -1
  45. package/dist/domain/tidy.d.ts +2 -1
  46. package/dist/domain/tidy.js +5 -1
  47. package/dist/domain/tidy.js.map +1 -1
  48. package/dist/system/git.d.ts +4 -0
  49. package/dist/system/git.js +13 -0
  50. package/dist/system/git.js.map +1 -1
  51. package/dist/system/images.d.ts +16 -0
  52. package/dist/system/images.js +51 -0
  53. package/dist/system/images.js.map +1 -0
  54. package/dist/system/issues.d.ts +27 -0
  55. package/dist/system/issues.js +117 -1
  56. package/dist/system/issues.js.map +1 -1
  57. package/dist/system/run-files.d.ts +0 -8
  58. package/dist/system/run-files.js +1 -28
  59. package/dist/system/run-files.js.map +1 -1
  60. package/package.json +2 -2
  61. package/prompts/implement.md +11 -1
  62. package/prompts/plan.md +17 -6
  63. package/prompts/review.md +11 -4
  64. package/templates/init/gitignore +1 -0
  65. package/templates/skills/issue/SKILL.md +85 -13
package/README.md CHANGED
@@ -33,8 +33,8 @@ factory doctor
33
33
  index.ts an example workflow of the repository
34
34
  prompts/answer.md the prompt of its answer stage
35
35
  tsconfig.json editor settings only
36
- .gitignore node_modules/, runs/, .env
37
- issues/<slug>/ issue.md, spec.md, plan.md (committed)
36
+ .gitignore node_modules/, runs/, .env, issues/*/spec-answers.json*
37
+ issues/<slug>/ issue.md, spec.md, spec-page.json and spec-page/, plan.md (committed)
38
38
  runs/ one folder per run (ignored)
39
39
  .env optional secrets (ignored)
40
40
  .agents/skills/issue/ the issue skill, read by Codex and Pi
@@ -46,34 +46,36 @@ The global `factory` command uses the nearest `.factory/` holding a `package.jso
46
46
  ## From an idea to a pull request
47
47
 
48
48
  1. **Backlog.** In Claude Code, Codex or Pi, `/issue` asks for a title and a description, writes a draft outside the repository and saves it with `factory run issue-save --issue <slug> --kind issue --file <draft>`. The command checks the draft and writes `.factory/issues/<slug>/issue.md` itself: the agent chooses neither the path nor the format.
49
- 2. **Specifying.** `/issue` again: the agent reads the code, asks questions until it can fill every section without inventing anything, including the issues this one depends on, and proposes the spec; once the operator agrees, `--kind spec` writes `spec.md`. When a run refuses to start because of the spec, `/issue` fixes it from the problems the run listed.
50
- 3. Review the spec, commit it and push it on the main branch.
49
+ 2. **Specifying.** `/issue` again: the agent reads the code, and the prototype you validated when the need comes from one, asks questions until it can fill every section without inventing anything, including the issues this one depends on, and proposes the spec; once the operator agrees, `--kind spec` writes `spec.md`. The agent then presents it, with a mockup for each change that brings an interface, a capture of the prototype's screen when the prototype shows it, and `--kind page` keeps the presentation as `spec-page.json` (see The spec page). When a run refuses to start because of the spec, `/issue` fixes it from the problems the run listed.
50
+ 3. Validate the spec on its page in `factory ui` (the Spec link of its card): the message of the cards you send back goes to `/issue`, which updates the spec and presents it again. Then commit the spec and its presentation and push them on the main branch.
51
51
  4. **Executing.** `factory run implement --issue <slug>`: starting the run approves the spec. It runs without the operator; follow it in `factory ui`.
52
52
  5. **To Approve → Done.** Review and merge the pull request. After `git pull`, `plan.md` is on the main branch: the issue is done. Its folder stays.
53
53
 
54
54
  A failed run stops; past `prepare`, it leaves the repository on the branch `<slug>`, with the agent's changes, for inspection. When the cause has passed (a timeout, the budget, the network, a Git hook), or when the checks or the review stopped it at their maximum of corrections and you grant one more round, `factory resume <RUN_ID>` starts the stopped stage again (each resumption allows that loop one more correction), its agent in the same conversation: the repository must still be on `<slug>` at the commit where the run stopped (the plan's commit, or the starting commit before it), with its changes in progress and none in `.factory/`; a delivery that stopped after its commit resumes once `git reset --soft <plan commit>` puts the changes back in progress, as the refusal says, a run whose pull request is recorded in its state, stopped once its delivery was done, does not resume, and neither does, past `prepare`, a run started with an earlier version of the factory. Otherwise, clean up, fix what is needed (often the spec, committed and pushed again) and start a new run: it starts again from the main branch, recreates the branch and replaces the pull request's content. Requested changes on a pull request are fixed the same way, or by hand on the branch. An issue is abandoned by deleting its folder (and closing its pull request, if any).
55
55
 
56
- `issue-save` lists every problem of a draft's format at once, then, for a valid spec, its dependencies that are no issue, refuses a spec for an issue that has no `issue.md`, replaces the file if it exists and commits nothing; each save is a run. The skill tells the agent never to write in `.factory/issues/` directly, commit or run `implement`. Pi reads a project's skills once the project is trusted; Codex ignores a `SKILL.md` that is itself a link, hence the folder link.
56
+ `issue-save` lists every problem of a draft's format at once, then, for a valid spec, its dependencies that are no issue and a prototype `origin` does not hold, and for a presentation, what does not present the saved spec and the captures that are no image; it refuses a spec for an issue that has no `issue.md` and a presentation for an issue whose `spec.md` is missing or invalid, replaces the file if it exists and commits nothing; each save is a run. The skill tells the agent never to write in `.factory/issues/` directly, commit or run `implement`. Pi reads a project's skills once the project is trusted; Codex ignores a `SKILL.md` that is itself a link, hence the folder link.
57
57
 
58
58
  ### Issues
59
59
 
60
60
  An issue is a folder `.factory/issues/<slug>/` holding at least one of the files below (any other folder there is ignored), identified by its slug alone: lowercase letters and digits in words separated by hyphens, which also names its branch and its `--issue` input.
61
61
 
62
62
  - `issue.md`: a `# ` title, then a description.
63
- - `spec.md`: a `# ` title, then exactly `## Objective`, `## Scope`, `## Out of scope`, `## Acceptance criteria`, `## Constraints` and `## Dependencies`, in this order, with nothing before the first and none empty (`None.`). Acceptance criteria holds only `- AC<n>: <criterion>` items numbered from AC1 without gaps; an indented line continues an item. Dependencies holds only `- <slug>` items, each another issue of the repository that must be delivered first, or `None.`. The spec says what and why, not how; headings stay in English, the content may be in any language. `issue-save` and `implement` read it the same way; `issue-save` also refuses a dependency that is no issue of the repository.
63
+ - `spec.md`: a `# ` title, then exactly `## Objective`, `## Scope`, `## Out of scope`, `## Acceptance criteria`, `## Constraints` and `## Dependencies`, in this order, with nothing before the first and none empty (`None.`). Acceptance criteria holds only `- AC<n>: <criterion>` items numbered from AC1 without gaps; an indented line continues an item. Dependencies holds only `- <slug>` items, each another issue of the repository that must be delivered first, or `None.`. A spec that draws on a prototype ends with `## Prototype`: `- Branch: <branch>` then `- Commit: <full commit id>`, the commit you validated, as `git rev-parse` prints it, with the prototype's notes, on a branch named with a slash such as `prototype/<slug>` (no run takes such a branch), which `origin` must hold, never rewritten (commits on top are fine), until the issue is delivered; a commit the main branch already has is refused; a spec without a prototype leaves the section out. The spec says what and why, not how; headings stay in English, the content may be in any language. `issue-save` and `implement` read it the same way; `issue-save` also refuses a dependency that is no issue of the repository, and a prototype whose branch `origin` does not have with that commit (it reads the local copy of `origin`'s branch, and fetches it only when the commit is missing).
64
64
  - `plan.md`: written by the run, in the language of the spec's content: the approach, what the code already does that the change must keep (Existing), steps that each name the criteria they serve, their files, the cases they must handle besides their main path and their tests, how it read the spec where the spec reads more than one way, and the risks.
65
65
 
66
+ Beside `spec.md`, `spec-page.json` keeps the presentation of the spec for its page, as `issue-save` checked it, with the spec it presents word for word (see The spec page), `spec-page/` the images of its captures, replaced with each presentation, and `spec-answers.json` where the operator is on that page, forgotten when a new presentation is saved; Git ignores the latter. A repository initialized before factory 0.20.0 adds `issues/*/spec-answers.json*` to its `.factory/.gitignore`: otherwise the answers are changes in progress, and `implement` refuses to start.
67
+
66
68
  ### The `implement` run
67
69
 
68
70
  | Stage | What it does |
69
71
  |---|---|
70
- | `prepare` | Refuses to start, listing every reason, unless the repository is on the main branch without any change in progress, the main branch matches `origin` after `git fetch`, `spec.md` is valid (otherwise it says to fix it with `/issue <slug>`), each of its dependencies is delivered (its `plan.md` is on the main branch), the issue has no `plan.md` (an issue already delivered is never restarted), its slug does not name the main branch (its branch would replace it), `FACTORY_UI_URL`, when set, is an http or https address, and `gh` is logged in and finds the repository on GitHub; then the repository's checks must pass on the main branch, before any agent; then, under a lock of the working tree (`factory-implement.lock` in its Git directory, held for that step only) and unless the repository moved meanwhile (another run is using it: the run stops), creates (or recreates) the branch `<slug>` from the approved start commit. Branches are read and pushed by their full reference: a tag of the same name never stands in for them |
71
- | `plan`, `planned` | The `plan` agent receives the slug and the spec. It first explores the code where the spec changes it (mechanisms, invariants, conventions, test tools), handing each area of a spec that touches several to a sub-agent when its profile allows it, then answers with a plan: what the code already does that the change must keep, and steps with their criteria, the files expected, the situations to handle besides the main path and their tests. Where the spec reads more than one way, or its letter would give a behavior its objective would not want, the plan records the reading it chose, apart from its risks: the pull request asks you to confirm it. The plan says what must be true, not how to write it; the implementing agent may take a better way and records it as a deviation; every criterion must be served by a step, otherwise the plan goes back to it (2 times at most) |
72
+ | `prepare` | Refuses to start, listing every reason, unless the repository is on the main branch without any change in progress, the main branch matches `origin` after `git fetch`, `spec.md` is valid (otherwise it says to fix it with `/issue <slug>`), each of its dependencies is delivered (its `plan.md` is on the main branch), `origin` holds its prototype, when it names one (fetched when missing: the agents that plan, implement and review, and their sub-agents, read the prototype at its commit, with the captures of its screens you validated on the spec page unless that page presents another text of the spec, and the instruction that the spec decides and its code is not to be copied), the issue has no `plan.md` (an issue already delivered is never restarted), its slug does not name the main branch (its branch would replace it), `FACTORY_UI_URL`, when set, is an http or https address, and `gh` is logged in and finds the repository on GitHub; then the repository's checks must pass on the main branch, before any agent; then, under a lock of the working tree (`factory-implement.lock` in its Git directory, held for that step only) and unless the repository moved meanwhile (another run is using it: the run stops), creates (or recreates) the branch `<slug>` from the approved start commit. Branches are read and pushed by their full reference: a tag of the same name never stands in for them |
73
+ | `plan`, `planned` | The `plan` agent receives the slug, the spec and its prototype, when it names one. It first explores the code where the spec changes it (mechanisms, invariants, conventions, test tools), handing each area of a spec that touches several to a sub-agent when its profile allows it, then answers with a plan: what the code already does that the change must keep, and steps with their criteria, the files expected, the situations to handle besides the main path and their tests. Where the spec reads more than one way, or its letter would give a behavior its objective would not want, the plan records the reading it chose, apart from its risks: the pull request asks you to confirm it. The plan says what must be true, not how to write it; the implementing agent may take a better way and records it as a deviation; every criterion must be served by a step, otherwise the plan goes back to it (2 times at most) |
72
74
  | `commit-plan` | Writes `plan.md` and commits it alone (`docs: plan <slug>`): the run's reference commit |
73
- | `implement`, `implemented` | The `implement` agent receives the spec, the plan and the run's browser, in one conversation for the run, and answers with evidence for each criterion and its deviations from the plan. It fixes what the review asks for test first: a test that reproduces the trigger and fails, the fix, then a test for each situation around it that the fix changes; what no test can show, it checks in the browser before and after; the run stops if it committed, switched branches or changed `.factory/`, whatever it answered |
75
+ | `implement`, `implemented` | The `implement` agent receives the spec, its prototype, the plan and the run's browser, in one conversation for the run, and answers with evidence for each criterion and its deviations from the plan. It fixes what the review asks for test first: a test that reproduces the trigger and fails, the fix, then a test for each situation around it that the fix changes; what no test can show, it checks in the browser before and after; the run stops if it committed, switched branches or changed `.factory/`, whatever it answered |
74
76
  | `verify` | The repository's checks, in order, a check with `when` only if a file changed since the reference commit matches it; a failure, a timeout or a command that cannot start goes back to `implement` with the command, the cause and the end of its output (3 times at most). What each check wrote is kept in the run's folder, for the review, and a failed check's whole output in `checks/failed-<n>-<name>.log`, the run's `n`th failure, resumptions included, whose path the run journals (over 2 MiB per stream, its end, marked as truncated) |
75
77
  | `diff` | Every change since the reference commit, new files included, with each file's added and removed lines; the run stops if it is over 2 MiB. Over 1,500 lines of diff, the change is large: its diff is kept in the run's folder instead of being sent in the review's request. |
76
- | `review`, `reviewed` | The `review` agent, in a new conversation for each review, receives the spec, the changes (the diff, or for a large change where to read it), the checks and where their output is, and the run's browser, never the implementing agent's answer. It judges each criterion `met` or `not_met`, with its decisive evidence, and gives each finding a nature, only on what it established: a test it ran, the application it tried or a code path it followed to its end; a risk it could not establish is at most a `weak_test`. From the second round on, once it has answered on its own with a review the run can judge (an answer it cannot, such as a note sent while its sub-agents still run, goes back to it as an invalid review), it receives in the same conversation the previous review's unmet criteria and findings and checks them itself, without sub-agents: it reads and runs the tests of each fix and answers on them alone, with each criterion judged again, the findings a faithful test proves fixed (one that reproduces the trigger, would fail without the fix and covers the situations around it), those its first answer reports again, and what the fixes broke (a fix that breaks what worked is a `regression`). The run keeps its first answer whole and adds that check to it: a previous finding stays as it was until its fix is proven, unless the first answer reports it again with a nature that blocks as much, and a criterion is met only when both answers say so. Every review judged is kept in the run. An unmet criterion or a blocking finding goes back to `implement` (4 times at most) with the other findings, to fix as well when that is safe, and the implementing agent fixes the mechanism that let a defect happen, wherever the change has it, rather than adding a guard per case |
78
+ | `review`, `reviewed` | The `review` agent, in a new conversation for each review, receives the spec, its prototype, the changes (the diff, or for a large change where to read it), the checks and where their output is, and the run's browser, never the implementing agent's answer. It judges each criterion `met` or `not_met`, with its decisive evidence, and gives each finding a nature, only on what it established: a test it ran, the application it tried or a code path it followed to its end; a risk it could not establish is at most a `weak_test`. From the second round on, once it has answered on its own with a review the run can judge (an answer it cannot, such as a note sent while its sub-agents still run, goes back to it as an invalid review), it receives in the same conversation the previous review's unmet criteria and findings and checks them itself, without sub-agents: it reads and runs the tests of each fix and answers on them alone, with each criterion judged again, the findings a faithful test proves fixed (one that reproduces the trigger, would fail without the fix and covers the situations around it), those its first answer reports again, and what the fixes broke (a fix that breaks what worked is a `regression`). The run keeps its first answer whole and adds that check to it: a previous finding stays as it was until its fix is proven, unless the first answer reports it again with a nature that blocks as much, and a criterion is met only when both answers say so. Every review judged is kept in the run. An unmet criterion or a blocking finding goes back to `implement` (4 times at most) with the other findings, to fix as well when that is safe, and the implementing agent fixes the mechanism that let a defect happen, wherever the change has it, rather than adding a guard per case |
77
79
  | `describe`, `described` | Once the change is approved, the `describe` agent explains it for the review page (see below), takes its screenshots, and writes the decisions and the checks only a person can do. It receives the spec, the plan, its interpretations numbered `I1`…, the changes, the checks, the approved review, the deviations from the plan numbered `D1`…, the screenshots folder and the run's browser, never the implementing agent's summary. Its guide must name changed files only, each once, its screenshots must be distinct images of the folder, 10 MB at most, and each decision must name what exists: a criterion of the spec, an interpretation or a deviation, a changed file, lines the diff changes (60 at most), screenshots of the description; otherwise its answer goes back to it (2 times at most) |
78
80
  | `deliver` | Commits the changes with the plan's conventional commit subject, force-pushes `<slug>` to `origin`, updates the branch's open pull request or opens one with `gh`, then returns to the main branch |
79
81
 
@@ -107,7 +109,11 @@ The `implement`, `review` and `describe` agents check a change that shows in a w
107
109
 
108
110
  #### The pull request
109
111
 
110
- Its title is the commit subject. Its body is short: a warning first when the operator delivered the change despite its review (see below), a caution when merging is a one-way door (reverting does not walk it back: a migration that transforms data, a published contract, an external effect), then the link to the change's review page with what there is to decide, and a table at a glance: the files changed with their lines, links to the spec at the starting commit and to `plan.md`, the run's ID; the door and the blast radius; the criteria met, the checks and the screenshots; how the review ended and what it left. The link is `FACTORY_UI_URL` followed by `review?run=<RUN_ID>`; without it, the body says to open `/review?run=<RUN_ID>` in `factory ui` where the run ran.
112
+ Its title is the commit subject. Its body is short: a warning first when the operator delivered the change despite its review (see below), a caution when merging is a one-way door (reverting does not walk it back: a migration that transforms data, a published contract, an external effect), then the link to the change's review page with what there is to decide, and a table at a glance: the files changed with their lines, links to the spec at the starting commit and to `plan.md`, the run's ID; the door and the blast radius; the criteria met, the checks and the screenshots; how the review ended and what it left; last, when the spec drew on a prototype, what to do with it once merged: remove its branch (the command is given) and, where it was made, its working tree, or keep it while the spec of another issue still to deliver draws on it, as the main branch has the specs. The link is `FACTORY_UI_URL` followed by `review?run=<RUN_ID>`; without it, the body says to open `/review?run=<RUN_ID>` in `factory ui` where the run ran.
113
+
114
+ #### The spec page
115
+
116
+ `factory ui` serves, for each issue whose spec is presented, a page to validate it before any run, linked from the issue's card: a deck of cards, with the same piles, drags and keys as the review page below. The agent of `/issue` writes the presentation in plain words, in the spec's language: the need; a card per change, with a mockup when it brings an interface, shown at the card's width and at full size on a click: a capture of the screen in the spec's prototype (a PNG, JPEG or WebP image of 2 MiB at most, not a link, which the draft gives by its absolute path and `issue-save` keeps in `spec-page/`, each refusal with its reason), or else a whole HTML document drawn at a given size, in a frame without script, network or anything but its own HTML and inline styles; a card per choice the spec made, with the options it weighed and the one it took, where taking another sends the card back; a card per group of acceptance criteria, each in plain words with how it will be checked; and what the spec leaves out. `issue-save` checks that it presents every criterion of the saved spec once and that each choice's options hold, and keeps the spec it presents: once the spec changes, the page says it is stale. The need card says which prototype and commit the spec draws on, when it names one. The verdict is spec validated, with the command to run next, or changes requested, with a message made of the cards you sent back, your notes and the options you took instead, to give to the agent. Each card but the choices and the verdict opens the spec's own words. Your answers are kept in `.factory/issues/<slug>/spec-answers.json`, so that another device resumes them. Validating gates nothing yet: `implement` starts on any valid spec.
111
117
 
112
118
  #### The review page
113
119
 
@@ -144,7 +150,7 @@ The pull request is your approval: merge it, or close it, and the scout does not
144
150
  | To Approve | the last `implement` run completed, and `plan.md` is not on the main branch |
145
151
  | Done | `plan.md` is on the main branch, a merged cleanup's too |
146
152
 
147
- The files are read in the working tree, the main branch is the local branch `origin/HEAD` names, and runs are those of `.factory/runs/`. A card shows the issue's title (the `# ` line of `issue.md`; its slug without one), its slug, the dependencies of its spec not delivered yet (none once the issue is delivered), the newest pull request its `implement` runs recorded (a new run updates the same one), with a Review link to its review page when the run described it and, for each workflow shown on cards, its last run on the issue: its steps (done, current, failed or to come, each with the corrections that sent the run back into it), its duration and its estimated cost. `implement` shows six steps: prepare, plan, implement, verify, review and deliver (the description included). The title opens the newest of these runs in the runs dashboard. The most recently active issue comes first in its column; the page refreshes every 2 seconds. What may leave the board incomplete is listed above it: a `factory.ts` that does not load (`factory ui` loads it when it starts: restart it once fixed), an unreadable `issue.md` or run, an undelivered issue's `spec.md` that cannot be read or is invalid (its dependencies are then not shown), or a main branch Git cannot read (`origin/HEAD` missing: `git remote set-head origin --auto` sets it).
153
+ The files are read in the working tree, the main branch is the local branch `origin/HEAD` names, and runs are those of `.factory/runs/`. A card shows the issue's title (the `# ` line of `issue.md`; its slug without one), its slug, the dependencies of its spec not delivered yet (none once the issue is delivered), the newest pull request its `implement` runs recorded (a new run updates the same one), with a Review link to its review page when the run described it, a Spec link to its spec page when its spec is presented, and, for each workflow shown on cards, its last run on the issue: its steps (done, current, failed or to come, each with the corrections that sent the run back into it), its duration and its estimated cost. `implement` shows six steps: prepare, plan, implement, verify, review and deliver (the description included). The title opens the newest of these runs in the runs dashboard. The most recently active issue comes first in its column; the page refreshes every 2 seconds. What may leave the board incomplete is listed above it: a `factory.ts` that does not load (`factory ui` loads it when it starts: restart it once fixed), an unreadable `issue.md` or run, an undelivered issue's `spec.md` that cannot be read or is invalid (its dependencies are then not shown), or a main branch Git cannot read (`origin/HEAD` missing: `git remote set-head origin --auto` sets it).
148
154
 
149
155
  ## Adapt the factory
150
156
 
@@ -323,7 +329,7 @@ The run executes in the foreground. The terminal first shows the launch (flow's
323
329
 
324
330
  **Resume.** `factory resume RUN_ID` runs a failed run again in the foreground, under the same ID, at the stage where it stopped (with `--accept-review`, an `implement` or `tidy` run its review stopped by asking for changes is delivered as the review left it: see The pull request): its input, data, corrections, cost and agents' conversations are kept, the stage's journal starts with why the run had stopped (`Resumed after: …`), and its agent is told so and asked to continue rather than start over. The workflow is the one `factory.ts` defines now, its prompts are read again, and its runtimes are checked as for `factory run`. The budget is the one given with `--max-cost-usd`, else the run's own, else the workflow's; a run that already spent it does not resume without a higher one. The run's budget still counts its whole cost, but calls that announced no cost before the resumption, such as a call stopped by its timeout, no longer fail it; their cost counts only if the runtime includes it in the total it later announces for the resumed session, and the run's cost stays marked partial. The run's duration leaves out the time it spent stopped. Only a failed run resumes, and by one command at a time: a run left `running` after a second Ctrl-C does not, and a workflow may refuse to resume from the state of the repository, as `implement` does. A resumed stage starts over: what it did before it failed must be safe to do again. A run stopped by a correction maximum resumes at the stage that asked for it, which may then take one more correction: the checks may pass after a fix by hand, and a gate judging the same answer sends it back once more.
325
331
 
326
- `factory status` lists the repository's runs or shows one; while `factory.ts` cannot load, `status` and `ui` say so and still show the runs with the default rendering. `factory ui` serves on `127.0.0.1` (port chosen by the system unless `--port` sets it, URL printed; Ctrl-C stops it) the Kanban on `/`, each delivered run's review page at `/review?run=<RUN_ID>` (see The review page; it also answers the host of `FACTORY_UI_URL`), and, under `/runs/`, a read-only dashboard of the repository's runs, with a Board link back to the Kanban: the runs in a rail grouped by day, named by their issue, filtered and searched; for a run its figures and links above three tabs: Timeline with its launches on one bar with the pauses between them and why each stopped, each opening what it ran with and what changed since the one before, its stage executions in lanes over its active time with its rounds and corrections, then the selected execution's panel (Overview with the session each call ran in as its runtime confirmed it, Input with the correction it received and what flow sent each agent call, loaded on demand: the workflow's prompt, the instructions, the context and the output schema, the whole request and the command, Output with the agent's answer, the correction sent back or not and each call's answer when it made several, Activity with its calls, tool calls, journal and warnings in one timeline), Cost with its cost by session and over time, Result with its result, its links and its data as a tree. The address keeps the run, its tab, the execution chosen and the execution's tab. It follows a running run as it goes. To watch on another machine, forward the same port through SSH: `ssh -L 4321:127.0.0.1:4321 machine`, run `factory ui --port 4321` there, and open `http://localhost:4321/`. `factory doctor` checks Node, loads the workflows, reads their prompts, lists each workflow's options and checks each runtime's executable, version and connection, without any provider request.
332
+ `factory status` lists the repository's runs or shows one; while `factory.ts` cannot load, `status` and `ui` say so and still show the runs with the default rendering. `factory ui` serves on `127.0.0.1` (port chosen by the system unless `--port` sets it, URL printed; Ctrl-C stops it) the Kanban on `/`, each presented spec's page at `/spec?issue=<slug>` (see The spec page), each delivered run's review page at `/review?run=<RUN_ID>` (see The review page; it also answers the host of `FACTORY_UI_URL`), and, under `/runs/`, a read-only dashboard of the repository's runs, with a Board link back to the Kanban: the runs in a rail grouped by day, named by their issue, filtered and searched; for a run its figures and links above three tabs: Timeline with its launches on one bar with the pauses between them and why each stopped, each opening what it ran with and what changed since the one before, its stage executions in lanes over its active time with its rounds and corrections, then the selected execution's panel (Overview with the session each call ran in as its runtime confirmed it, Input with the correction it received and what flow sent each agent call, loaded on demand: the workflow's prompt, the instructions, the context and the output schema, the whole request and the command, Output with the agent's answer, the correction sent back or not and each call's answer when it made several, Activity with its calls, tool calls, journal and warnings in one timeline), Cost with its cost by session and over time, Result with its result, its links and its data as a tree. The address keeps the run, its tab, the execution chosen and the execution's tab. It follows a running run as it goes. To watch on another machine, forward the same port through SSH: `ssh -L 4321:127.0.0.1:4321 machine`, run `factory ui --port 4321` there, and open `http://localhost:4321/`. `factory doctor` checks Node, loads the workflows, reads their prompts, lists each workflow's options and checks each runtime's executable, version and connection, without any provider request.
327
333
 
328
334
  ## Data
329
335
 
@@ -338,7 +344,8 @@ Tokens and costs are the figures each runtime announces: Claude Code announces a
338
344
  - The repository is used in place: one `implement` run at a time, since it needs a clean tree and stops if another run moved the repository during its starting checks; after a failure, the operator cleans up, or leaves the branch as it is to resume the run. The repository's Git hooks run on the run's commits, and a failing hook fails the run.
339
345
  - The factory's own agents (`plan`, `implement`, `review`, `describe`) cannot run on Codex, since `maxCostUsd` is required and Codex announces no cost; the repository's own workflows and the `issue` skill can use Codex.
340
346
  - Runtimes are not sandboxes: the implementing agent's tools can run any command its profile allows, bounded only by its prompt, the repository's agent instructions and the run's checks.
341
- - The review page lives on the machine of the run: elsewhere, the pull request shows only its header. It is served without sign-in: anyone who reaches `factory ui`, on that machine or through `FACTORY_UI_URL`, can read it and change its answers. The factory does not check the Mermaid syntax: the page shows the text of a diagram it cannot draw. Mermaid, built into the page, brings `@clemrig/factory-ui` to about 5.5 MB.
347
+ - A prototype's branch is pushed to `origin` like any branch: the repository's CI or preview deployments may run on it.
348
+ - The review page lives on the machine of the run: elsewhere, the pull request shows only its header. A spec page shows the working tree of the machine that serves it: a spec written elsewhere is validated there once pulled. Both are served without sign-in: anyone who reaches `factory ui`, on that machine or through `FACTORY_UI_URL`, can read them and change their answers. Validating a spec does not gate `implement` yet. The factory does not check the Mermaid syntax: the page shows the text of a diagram it cannot draw. Mermaid, built into the page, brings `@clemrig/factory-ui` to about 5.5 MB.
342
349
  - Screenshots show the new state only, never the previous one; no videos.
343
350
  - `tidy` has no scheduler of its own: cron, launchd or a CI runner starts it. Its scout reads at most 200 recent commits and the latest 100 open and 100 closed pull requests, with the first 100 files of each open one, as `gh` lists them, and a defect it finds is only named in the cleanup's issue.
344
351
  - Not in this version: changing the factory's prompts, correction maximums, pull request format or columns from a repository; columns added by a workflow; backlog priority; actions or drag-and-drop on the board; resuming a run left `running` after its process was killed, detached runs, logs `--follow` and stop; local settings or profile overrides; graph drawing in the dashboard; runs or issues of several repositories; `factory new`; a shared stage library; a test harness for workflows; CI, cron or Git hook triggers; notifications; Windows.
package/dist/app/board.js CHANGED
@@ -66,6 +66,7 @@ export async function readBoard(factory, loadError) {
66
66
  slug: folder.slug,
67
67
  title: (folder.issue && issueTitle(folder.issue)) || folder.slug,
68
68
  hasSpec: folder.hasSpec,
69
+ hasSpecPage: folder.hasSpecPage,
69
70
  // A delivered issue's spec may predate today's format: it waits for nothing.
70
71
  dependencies: folder.hasSpec && !isDelivered
71
72
  ? (await dependenciesOf(factory.dir, folder.slug, problems)).map((slug) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/app/board.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,GAIR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACjC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEzD,qHAAqH;AACrH,SAAS,cAAc,CAAC,OAAgB;IACtC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAC5C,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;QAChC,IAA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M,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type Prototype } from "../domain/spec.js";
2
+ /**
3
+ * Why origin does not hold the prototype a spec draws on, for every run and
4
+ * every machine: on a branch Git accepts, other than the main one `base`,
5
+ * with the commit the spec names. Origin's copy is read as the repository
6
+ * has it, and fetched only when it lacks that commit: a spec whose prototype
7
+ * was pushed from here saves without reaching origin, and a run's machine
8
+ * gets the commit its agents read.
9
+ */
10
+ export declare function prototypeProblems(dir: string, { branch, commit }: Prototype, base: string): Promise<string[]>;
11
+ /**
12
+ * The other issues to deliver, as the working tree has them, whose spec
13
+ * draws on prototype branch `branch`: until they are delivered, it stays.
14
+ */
15
+ export declare function issuesDrawingOn(dir: string, branch: string, except: string): Promise<string[]>;
@@ -0,0 +1,65 @@
1
+ import { parseSpec } from "../domain/spec.js";
2
+ import * as git from "../system/git.js";
3
+ import { hasArtifact, listIssueFolders, readArtifact, } from "../system/issues.js";
4
+ const message = (error) => error instanceof Error ? error.message : String(error);
5
+ /** Whether origin's copy of `branch`, as the repository has it, holds `commit`, named exactly: no tree, no abbreviation. */
6
+ async function isOnOrigin(dir, branch, commit) {
7
+ const ref = git.remoteRef(branch);
8
+ if ((await git.commitOf(dir, ref).catch(() => undefined)) === undefined)
9
+ return false;
10
+ const found = await git
11
+ .commitOf(dir, `${commit}^{commit}`)
12
+ .catch(() => undefined);
13
+ return found === commit && git.isAncestor(dir, commit, ref);
14
+ }
15
+ /**
16
+ * Why origin does not hold the prototype a spec draws on, for every run and
17
+ * every machine: on a branch Git accepts, other than the main one `base`,
18
+ * with the commit the spec names. Origin's copy is read as the repository
19
+ * has it, and fetched only when it lacks that commit: a spec whose prototype
20
+ * was pushed from here saves without reaching origin, and a run's machine
21
+ * gets the commit its agents read.
22
+ */
23
+ export async function prototypeProblems(dir, { branch, commit }, base) {
24
+ if (!(await git.isBranchName(dir, branch)))
25
+ return [`Prototype: "${branch}" is not a branch name`];
26
+ if (branch === base)
27
+ return [
28
+ `Prototype: ${branch} is the main branch: keep the prototype on a branch of its own`,
29
+ ];
30
+ if (!(await isOnOrigin(dir, branch, commit)))
31
+ try {
32
+ await git.fetchBranch(dir, branch);
33
+ }
34
+ catch (error) {
35
+ return [
36
+ `Prototype: origin/${branch} cannot be fetched: push the prototype's branch, and check that origin can be reached (${message(error)})`,
37
+ ];
38
+ }
39
+ if (!(await isOnOrigin(dir, branch, commit)))
40
+ return [
41
+ `Prototype: commit ${commit.slice(0, 7)} is not on origin/${branch}. The spec names the commit the operator validated: push it, and never rewrite the branch before the issue is delivered; to draw on another commit, have the operator validate it, then save the spec again`,
42
+ ];
43
+ // A commit the main branch already has holds nothing of the prototype.
44
+ if (await git.isAncestor(dir, commit, git.remoteRef(base)))
45
+ return [
46
+ `Prototype: commit ${commit.slice(0, 7)} is on ${base}, which holds nothing of the prototype: name the prototype's own commit, the one the operator validated`,
47
+ ];
48
+ return [];
49
+ }
50
+ /**
51
+ * The other issues to deliver, as the working tree has them, whose spec
52
+ * draws on prototype branch `branch`: until they are delivered, it stays.
53
+ */
54
+ export async function issuesDrawingOn(dir, branch, except) {
55
+ const drawing = [];
56
+ for (const { slug, hasSpec } of await listIssueFolders(dir)) {
57
+ if (slug === except || !hasSpec || (await hasArtifact(dir, slug, "plan")))
58
+ continue;
59
+ const spec = parseSpec((await readArtifact(dir, slug, "spec")) ?? "", slug);
60
+ if (spec.ok && spec.value.prototype?.branch === branch)
61
+ drawing.push(slug);
62
+ }
63
+ return drawing.sort();
64
+ }
65
+ //# sourceMappingURL=prototype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prototype.js","sourceRoot":"","sources":["../../src/app/prototype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,EACL,WAAW,EACX,gBA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AAC,IAAI,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -3,7 +3,8 @@ import { maxScreenshotBytes } from "../domain/description.js";
3
3
  import { reviewAnswers, reviewPage, } from "../domain/review-page.js";
4
4
  import { runDir } from "../system/factory.js";
5
5
  import { fileAnchor } from "../system/github.js";
6
- import { keepAnswers, readAnswers, readScreenshot, } from "../system/run-files.js";
6
+ import { readImageIn } from "../system/images.js";
7
+ import { keepAnswers, readAnswers } from "../system/run-files.js";
7
8
  import { loadRun } from "./runs.js";
8
9
  import { diffOf } from "./workflows/stages/deliver.js";
9
10
  import { facts, specCommitOf } from "./workflows/stages/run.js";
@@ -65,7 +66,7 @@ export async function readReviewScreenshot(factory, id, file) {
65
66
  const { description, screenshotsDir } = facts(state);
66
67
  if (!description.screenshots.some((shot) => shot.file === file))
67
68
  return undefined;
68
- return readScreenshot(screenshotsDir, file, maxScreenshotBytes);
69
+ return readImageIn(screenshotsDir, file, maxScreenshotBytes);
69
70
  }
70
71
  /** Where a person is in the run's review; `undefined` before the first answer, or when what is kept no longer reads. */
71
72
  export async function readReviewAnswers(factory, id) {
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/app/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAGL,aAAa,EACb,UAAU,GACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAgB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OA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AC;IAC9D,MAAM,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type SpecAnswers, type SpecPage } from "../domain/spec-page.js";
2
+ import type { Factory } from "../system/factory.js";
3
+ import type { Image } from "../system/images.js";
4
+ /**
5
+ * The page of issue `slug`'s spec, from its presentation; `undefined` when
6
+ * its spec is not presented, an unknown issue included. `captureUrl` says
7
+ * where the page loads a capture.
8
+ */
9
+ export declare function readSpecPage(factory: Factory, slug: string, captureUrl: (file: string) => string): Promise<SpecPage | undefined>;
10
+ /** One of the captures issue `slug`'s presented spec shows; `undefined` for any other file. */
11
+ export declare function readSpecCapture(factory: Factory, slug: string, file: string): Promise<Image | undefined>;
12
+ /** Where the operator is in issue `slug`'s spec validation; `undefined` before the first answer, or when what is kept no longer reads. */
13
+ export declare function readSpecAnswers(factory: Factory, slug: string): Promise<SpecAnswers | undefined>;
14
+ /** Keeps the answers the page sent for issue `slug`'s spec; returns why they are refused, if they are. */
15
+ export declare function saveSpecAnswers(factory: Factory, slug: string, answers: unknown): Promise<string | undefined>;
16
+ /**
17
+ * The captures of the screens the operator validated on the page of issue
18
+ * `slug`'s spec, `spec`, with their absolute paths: none when its
19
+ * presentation shows another text of it, or no longer reads.
20
+ */
21
+ export declare function readValidatedCaptures(dir: string, slug: string, spec: string): Promise<{
22
+ caption: string;
23
+ file: string;
24
+ }[]>;
@@ -0,0 +1,72 @@
1
+ import { z } from "@clemrig/flow";
2
+ import { isSlug } from "../domain/issue.js";
3
+ import { parseSpec } from "../domain/spec.js";
4
+ import { capturesOf, maxCaptureBytes, validatedCaptures, presentedSpec, specAnswers, specPage, } from "../domain/spec-page.js";
5
+ import { keepSpecAnswers, readArtifact, readSpecAnswers as readKeptAnswers, readSpecCapture as readKeptCapture, readSpecPage as readPresented, specCapturePath, } from "../system/issues.js";
6
+ /** Issue `slug`'s presented spec, as kept; `undefined` when its spec is not presented, an unknown issue included. */
7
+ async function presented(factory, slug) {
8
+ if (!isSlug(slug))
9
+ return undefined;
10
+ const kept = await readPresented(factory.dir, slug);
11
+ if (kept === undefined)
12
+ return undefined;
13
+ const parsed = presentedSpec.safeParse(kept);
14
+ if (!parsed.success)
15
+ throw new Error(`The presentation of ${slug}'s spec no longer reads:\n${z.prettifyError(parsed.error)}`);
16
+ return parsed.data;
17
+ }
18
+ /**
19
+ * The page of issue `slug`'s spec, from its presentation; `undefined` when
20
+ * its spec is not presented, an unknown issue included. `captureUrl` says
21
+ * where the page loads a capture.
22
+ */
23
+ export async function readSpecPage(factory, slug, captureUrl) {
24
+ const kept = await presented(factory, slug);
25
+ return (kept &&
26
+ specPage(slug, kept, await readArtifact(factory.dir, slug, "spec"), captureUrl));
27
+ }
28
+ /** Whether issue `slug`'s spec has a page, its presentation of a spec that reads: only then are answers kept. */
29
+ async function hasPage(factory, slug) {
30
+ const kept = await presented(factory, slug);
31
+ return kept !== undefined && parseSpec(kept.spec, slug).ok;
32
+ }
33
+ /** One of the captures issue `slug`'s presented spec shows; `undefined` for any other file. */
34
+ export async function readSpecCapture(factory, slug, file) {
35
+ const kept = await presented(factory, slug);
36
+ if (!kept ||
37
+ !capturesOf(kept.presentation).some(({ image }) => image === file))
38
+ return undefined;
39
+ return readKeptCapture(factory.dir, slug, file, maxCaptureBytes);
40
+ }
41
+ /** Where the operator is in issue `slug`'s spec validation; `undefined` before the first answer, or when what is kept no longer reads. */
42
+ export async function readSpecAnswers(factory, slug) {
43
+ if (!(await hasPage(factory, slug)))
44
+ return undefined;
45
+ const kept = specAnswers.safeParse(await readKeptAnswers(factory.dir, slug));
46
+ return kept.success ? kept.data : undefined;
47
+ }
48
+ /** Keeps the answers the page sent for issue `slug`'s spec; returns why they are refused, if they are. */
49
+ export async function saveSpecAnswers(factory, slug, answers) {
50
+ if (!(await hasPage(factory, slug)))
51
+ return `Issue ${slug} has no presented spec`;
52
+ const parsed = specAnswers.safeParse(answers);
53
+ if (!parsed.success)
54
+ return `Invalid answers:\n${z.prettifyError(parsed.error)}`;
55
+ await keepSpecAnswers(factory.dir, slug, parsed.data);
56
+ return undefined;
57
+ }
58
+ /**
59
+ * The captures of the screens the operator validated on the page of issue
60
+ * `slug`'s spec, `spec`, with their absolute paths: none when its
61
+ * presentation shows another text of it, or no longer reads.
62
+ */
63
+ export async function readValidatedCaptures(dir, slug, spec) {
64
+ const kept = presentedSpec.safeParse(await readPresented(dir, slug));
65
+ if (!kept.success)
66
+ return [];
67
+ return validatedCaptures(kept.data, spec).map(({ caption, image }) => ({
68
+ caption,
69
+ file: specCapturePath(dir, slug, image),
70
+ }));
71
+ }
72
+ //# sourceMappingURL=spec-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-page.js","sourceRoot":"","sources":["../../src/app/spec-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,eAAe,EACf,iBAAiB,EAEjB,aAAa,EAGb,WAAW,EACX,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,IAAI,eAAe,EAClC,eAAe,IAAI,eAAe,EAClC,YAAY,IAAI,aAAa,EAC7B,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,qHAAqH;AACrH,KAAK,UAAU,SAAS,CACtB,OAAgB,EAChB,IAAY;IAEZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO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AE,CAAC;IAC7B,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACrE,OAAO;QACP,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;KACxC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1,2 +1,5 @@
1
- /** Checks a draft written by an agent, then writes it as the issue's issue.md or spec.md. */
1
+ /**
2
+ * Checks a draft written by an agent, then writes it as the issue's
3
+ * issue.md or spec.md, or as the presentation of its spec (`page`).
4
+ */
2
5
  export declare const issueSave: import("@clemrig/flow").Workflow;
@@ -1,15 +1,23 @@
1
1
  import { defineWorkflow, END, node, step, z } from "@clemrig/flow";
2
2
  import { isSlug, parseIssue } from "../../domain/issue.js";
3
3
  import { parseSpec } from "../../domain/spec.js";
4
- import { hasArtifact, isIssue, readDraft, writeArtifact, } from "../../system/issues.js";
4
+ import { captureName, capturesOf, maxCaptureBytes, namingCaptures, parsePresentation, } from "../../domain/spec-page.js";
5
+ import { defaultBranch } from "../../system/git.js";
6
+ import { readDraftImage } from "../../system/images.js";
7
+ import { forgetSpecAnswers, hasArtifact, isIssue, readArtifact, readDraft, writeArtifact, writeSpecPage, } from "../../system/issues.js";
8
+ import { prototypeProblems } from "../prototype.js";
5
9
  const input = z.object({
6
10
  issue: z
7
11
  .string()
8
12
  .refine(isSlug, "Expected lowercase words separated by hyphens"),
9
- kind: z.enum(["issue", "spec"]),
13
+ kind: z.enum(["issue", "spec", "page"]),
10
14
  file: z.string().min(1),
11
15
  });
12
- /** What is wrong with a draft: its format, and for a spec, dependencies that are no issue of the repository. */
16
+ /**
17
+ * What is wrong with a draft of issue.md or spec.md: its format, and for a
18
+ * spec, dependencies that are no issue of the repository and a prototype
19
+ * origin does not hold.
20
+ */
13
21
  async function draftProblems(dir, { issue, kind }, text) {
14
22
  if (kind === "issue") {
15
23
  const parsed = parseIssue(text);
@@ -22,9 +30,69 @@ async function draftProblems(dir, { issue, kind }, text) {
22
30
  for (const dependency of parsed.value.dependencies)
23
31
  if (!(await isIssue(dir, dependency)))
24
32
  problems.push(`Dependencies: there is no issue ${dependency} in .factory/issues/`);
33
+ if (parsed.value.prototype) {
34
+ let base;
35
+ try {
36
+ base = await defaultBranch(dir);
37
+ }
38
+ catch (error) {
39
+ return [
40
+ ...problems,
41
+ `Prototype: the main branch cannot be read, to tell it from the prototype's (origin/HEAD names it: git remote set-head origin --auto sets it): ${error instanceof Error ? error.message : String(error)}`,
42
+ ];
43
+ }
44
+ problems.push(...(await prototypeProblems(dir, parsed.value.prototype, base)));
45
+ }
25
46
  return problems;
26
47
  }
27
- /** Checks a draft written by an agent, then writes it as the issue's issue.md or spec.md. */
48
+ function invalidDraft(file, kind, problems) {
49
+ return new Error([
50
+ `Invalid ${kind} draft ${file}:`,
51
+ ...problems.map((problem) => `- ${problem}`),
52
+ ].join("\n"));
53
+ }
54
+ /**
55
+ * Checks the presentation of issue `issue`'s spec an agent drafted, then
56
+ * keeps it with the spec it presents, word for word, as `spec-page.json`,
57
+ * and the images of its captures beside it; the operator's answers on the
58
+ * previous one are forgotten.
59
+ */
60
+ async function savePresentation(dir, issue, file) {
61
+ const spec = await readArtifact(dir, issue, "spec");
62
+ if (spec === undefined)
63
+ throw new Error(`Issue ${issue} has no spec.md: save it first`);
64
+ const parsedSpec = parseSpec(spec, issue);
65
+ if (!parsedSpec.ok)
66
+ throw new Error(`Issue ${issue}'s spec.md is invalid: save a valid spec first`);
67
+ const parsed = parsePresentation(await readDraft(file), parsedSpec.value);
68
+ if (!parsed.ok)
69
+ throw invalidDraft(file, "presentation", parsed.problems);
70
+ const problems = [];
71
+ const captures = [];
72
+ for (const { change, image } of capturesOf(parsed.value)) {
73
+ const where = `changes[${change}].mockup.image: ${image}`;
74
+ const read = await readDraftImage(image, maxCaptureBytes);
75
+ if (typeof read === "string")
76
+ problems.push(`${where} ${read}`);
77
+ else {
78
+ const name = captureName(change, read.type);
79
+ if (name)
80
+ captures.push({ change, name, body: read.body });
81
+ else
82
+ problems.push(`${where} is a GIF: a capture is a PNG, JPEG or WebP image`);
83
+ }
84
+ }
85
+ if (problems.length > 0)
86
+ throw invalidDraft(file, "presentation", problems);
87
+ const presentation = namingCaptures(parsed.value, new Map(captures.map(({ change, name }) => [change, name])));
88
+ const saved = await writeSpecPage(dir, issue, { spec, presentation }, captures);
89
+ await forgetSpecAnswers(dir, issue);
90
+ return saved;
91
+ }
92
+ /**
93
+ * Checks a draft written by an agent, then writes it as the issue's
94
+ * issue.md or spec.md, or as the presentation of its spec (`page`).
95
+ */
28
96
  export const issueSave = defineWorkflow({
29
97
  name: "issue-save",
30
98
  input,
@@ -32,19 +100,25 @@ export const issueSave = defineWorkflow({
32
100
  nodes: {
33
101
  save: node(step(async ({ dir, state }) => {
34
102
  const { issue, kind, file } = state.input;
103
+ if (kind === "page") {
104
+ const { page, captures } = await savePresentation(dir, issue, file);
105
+ return { path: page, ...(captures ? { captures } : {}) };
106
+ }
35
107
  if (kind === "spec" && !(await hasArtifact(dir, issue, "issue")))
36
108
  throw new Error(`Issue ${issue} does not exist: save its issue.md first`);
37
109
  const text = await readDraft(file);
38
110
  const problems = await draftProblems(dir, { issue, kind }, text);
39
111
  if (problems.length > 0)
40
- throw new Error([
41
- `Invalid ${kind}.md draft ${file}:`,
42
- ...problems.map((problem) => `- ${problem}`),
43
- ].join("\n"));
112
+ throw invalidDraft(file, `${kind}.md`, problems);
44
113
  return { path: await writeArtifact(dir, issue, kind, text) };
45
114
  }), { ok: END }),
46
115
  },
47
116
  // Also called for a failed run, which saved nothing.
48
- presentResult: ({ data }) => typeof data.path === "string" ? [`Saved ${data.path}`] : [],
117
+ presentResult: ({ data }) => [
118
+ ...(typeof data.path === "string" ? [`Saved ${data.path}`] : []),
119
+ ...(typeof data.captures === "string"
120
+ ? [`Saved its captures in ${data.captures}`]
121
+ : []),
122
+ ],
49
123
  });
50
124
  //# sourceMappingURL=issue-save.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"issue-save.js","sourceRoot":"","sources":["../../../src/app/workflows/issue-save.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IACrB,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,MAAM,CAAC,MAAM,EAAE,+CAA+C,CAAC;IAClE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAGH,gHAAgH;AAChH,KAAK,UAAU,aAAa,CAC1B,GAAW,EACX,EAAE,KAAK,EAAE,IAAI,EAAiC,EAC9C,IAAY;IAEZ,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;IACvC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,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E,GAAG,CAAC,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;YACnC,CAAC,CAAC,CAAC,yBAAyB,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5C,CAAC,CAAC,EAAE,CAAC;KACR;CACF,CAAC,CAAC"}
@@ -1,9 +1,14 @@
1
1
  import type { RunState, Stage, StageContext } from "@clemrig/flow";
2
2
  import type { AppDeclaration } from "../../../domain/app.js";
3
+ import { type RunPrototype } from "./run.js";
3
4
  /** The agents' browser, in the request of the agents that may use it. */
4
5
  export declare function browserContext(state: Readonly<RunState>): {
5
6
  browser?: string;
6
7
  };
8
+ /** The prototype the spec draws on, in the request of the agents that plan, implement and review the change. */
9
+ export declare function prototypeContext(state: Readonly<RunState>): {
10
+ prototype?: RunPrototype;
11
+ };
7
12
  /**
8
13
  * Closes the agents' browser once an agent's call is over, failed or not:
9
14
  * Playwright CLI keeps it open after the agent that opened it. Every session
@@ -7,6 +7,11 @@ export function browserContext(state) {
7
7
  const { browser } = facts(state);
8
8
  return browser ? { browser } : {};
9
9
  }
10
+ /** The prototype the spec draws on, in the request of the agents that plan, implement and review the change. */
11
+ export function prototypeContext(state) {
12
+ const { prototype } = facts(state);
13
+ return prototype ? { prototype } : {};
14
+ }
10
15
  /**
11
16
  * Closes the agents' browser once an agent's call is over, failed or not:
12
17
  * Playwright CLI keeps it open after the agent that opened it. Every session