@clemrig/factory 0.8.0 → 0.9.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.
- package/README.md +24 -8
- package/dist/app/board.js +44 -9
- package/dist/app/board.js.map +1 -1
- package/dist/app/define.d.ts +3 -3
- package/dist/app/define.js +15 -9
- package/dist/app/define.js.map +1 -1
- package/dist/app/run.d.ts +1 -1
- package/dist/app/run.js +4 -3
- package/dist/app/run.js.map +1 -1
- package/dist/app/workflows/implement.d.ts +1 -6
- package/dist/app/workflows/implement.js +40 -592
- package/dist/app/workflows/implement.js.map +1 -1
- package/dist/app/workflows/stages/agents.d.ts +34 -0
- package/dist/app/workflows/stages/agents.js +93 -0
- package/dist/app/workflows/stages/agents.js.map +1 -0
- package/dist/app/workflows/stages/choose.d.ts +13 -0
- package/dist/app/workflows/stages/choose.js +107 -0
- package/dist/app/workflows/stages/choose.js.map +1 -0
- package/dist/app/workflows/stages/deliver.d.ts +18 -0
- package/dist/app/workflows/stages/deliver.js +167 -0
- package/dist/app/workflows/stages/deliver.js.map +1 -0
- package/dist/app/workflows/stages/implement.d.ts +5 -0
- package/dist/app/workflows/stages/implement.js +42 -0
- package/dist/app/workflows/stages/implement.js.map +1 -0
- package/dist/app/workflows/stages/plan.d.ts +7 -0
- package/dist/app/workflows/stages/plan.js +34 -0
- package/dist/app/workflows/stages/plan.js.map +1 -0
- package/dist/app/workflows/stages/prepare.d.ts +14 -0
- package/dist/app/workflows/stages/prepare.js +195 -0
- package/dist/app/workflows/stages/prepare.js.map +1 -0
- package/dist/app/workflows/stages/resume.d.ts +7 -0
- package/dist/app/workflows/stages/resume.js +54 -0
- package/dist/app/workflows/stages/resume.js.map +1 -0
- package/dist/app/workflows/stages/review.d.ts +16 -0
- package/dist/app/workflows/stages/review.js +103 -0
- package/dist/app/workflows/stages/review.js.map +1 -0
- package/dist/app/workflows/stages/run.d.ts +60 -0
- package/dist/app/workflows/stages/run.js +16 -0
- package/dist/app/workflows/stages/run.js.map +1 -0
- package/dist/app/workflows/stages/verify.d.ts +11 -0
- package/dist/app/workflows/stages/verify.js +47 -0
- package/dist/app/workflows/stages/verify.js.map +1 -0
- package/dist/app/workflows/tidy.d.ts +7 -0
- package/dist/app/workflows/tidy.js +79 -0
- package/dist/app/workflows/tidy.js.map +1 -0
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.js +4 -3
- package/dist/cli/help.js.map +1 -1
- package/dist/domain/board.d.ts +18 -3
- package/dist/domain/board.js +24 -10
- package/dist/domain/board.js.map +1 -1
- package/dist/domain/definition.d.ts +6 -1
- package/dist/domain/definition.js +3 -0
- package/dist/domain/definition.js.map +1 -1
- package/dist/domain/plan.d.ts +1 -1
- package/dist/domain/plan.js +1 -1
- package/dist/domain/spec.d.ts +1 -0
- package/dist/domain/spec.js +3 -0
- package/dist/domain/spec.js.map +1 -1
- package/dist/domain/tidy.d.ts +58 -0
- package/dist/domain/tidy.js +57 -0
- package/dist/domain/tidy.js.map +1 -0
- package/dist/system/factory.js +4 -3
- package/dist/system/factory.js.map +1 -1
- package/dist/system/git.d.ts +16 -2
- package/dist/system/git.js +52 -3
- package/dist/system/git.js.map +1 -1
- package/dist/system/github.d.ts +14 -0
- package/dist/system/github.js +38 -0
- package/dist/system/github.js.map +1 -1
- package/dist/system/lock.js +1 -1
- package/dist/system/lock.js.map +1 -1
- package/package.json +2 -2
- package/prompts/scout.md +53 -0
- /package/prompts/{implement/describe.md → describe.md} +0 -0
- /package/prompts/{implement/implement.md → implement.md} +0 -0
- /package/prompts/{implement/plan.md → plan.md} +0 -0
- /package/prompts/{implement/review.md → review.md} +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Take a repository's issues from spec to pull request with agents, watch them on a local Kanban, and run the repository's own workflows.
|
|
4
4
|
|
|
5
|
-
An idea becomes an issue; the operator specifies it with an agent; one run then plans, implements, checks and reviews it and opens its pull request; the operator approves by merging. Each of these steps is a workflow: an explicit graph of **CODE** stages (code), **AGENT** stages (an agent run by [Claude Code](https://code.claude.com), [Codex](https://developers.openai.com/codex) or [Pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent)) and **GATE** stages that accept a result or send it back for correction, a bounded number of times. The factory's workflows come with this package and are the same in every repository; the repository's `.factory/` folder adapts them (checks, budget, agents) and holds its own workflows, committed with it and run without a build step.
|
|
5
|
+
An idea becomes an issue; the operator specifies it with an agent; one run then plans, implements, checks and reviews it and opens its pull request; the operator approves by merging. Between features, a `tidy` run chooses a cleanup of recent code and takes it the same way to a pull request. Each of these steps is a workflow: an explicit graph of **CODE** stages (code), **AGENT** stages (an agent run by [Claude Code](https://code.claude.com), [Codex](https://developers.openai.com/codex) or [Pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent)) and **GATE** stages that accept a result or send it back for correction, a bounded number of times. The factory's workflows come with this package and are the same in every repository; the repository's `.factory/` folder adapts them (checks, budget, agents) and holds its own workflows, committed with it and run without a build step.
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
8
|
|
|
@@ -107,6 +107,20 @@ No text of the run opens a code block or a comment that would swallow the rest o
|
|
|
107
107
|
|
|
108
108
|
When the review still asks for changes after its last round, the run stops; `factory resume <RUN_ID>` gives it one more round, and `factory resume <RUN_ID> --accept-review` delivers it as the review left it, on your decision: the pull request then opens with a warning and lists, under Needs your judgment, the unmet criteria and blocking findings left open. What comes from the run (the spec, the criteria, the checks, the review, the deviations, the risks) is put together by the factory, never rewritten by an agent; the implementing agent's own summary is not shown. In a public repository, anyone can see the screenshots: the describing agent shows only test or seed data. The screenshots are kept in the run's folder and uploaded once the pull request is open; the body names them by file only, never by a path of the machine. A failed upload leaves the pull request recorded, saying again that its screenshots are coming, and fails the run; `factory resume` only uploads them again.
|
|
109
109
|
|
|
110
|
+
### The `tidy` run
|
|
111
|
+
|
|
112
|
+
Working fast with agents leaves waste in the code. `factory run tidy` removes it a little at a time, between features: it chooses the cleanup of the code that comes first, writes it as an issue with its spec, then delivers it as `implement` delivers an issue. Run it as often as you like, every night for instance: it opens one pull request at most, and none while the previous one waits for you. Scheduling it is up to you.
|
|
113
|
+
|
|
114
|
+
| Stage | What it does |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `prepare` | Refuses to start for the same reasons as `implement`, the spec's aside: the main branch, changes in progress, `origin`, `gh`. Then the repository's checks must pass on the main branch. Then, while a cleanup's pull request (a branch `tidy-…`) is open, ends without calling any agent: one cleanup at a time. Otherwise it creates the run's own branch, `tidy-<run id>`, from the starting commit, as `implement` creates the issue's: no other run starts or resumes on it |
|
|
117
|
+
| `survey` | Reads what the scout needs: recent code, that is the commits of the main branch since the last cleanup merged (the last commit that brought a `.factory/issues/tidy-*/plan.md` to it), or of the last 14 days before the first one, 200 at most, merges aside, with their files and how often each changed; the files of the open pull requests; the cleanups closed without being merged |
|
|
118
|
+
| `scout`, `scouted` | The `scout` agent, with the `plan` profile, explores recent code first, then the rest of the repository, compares candidates and answers with the cleanup that comes first, or none. A cleanup changes nothing observable: it removes the waste that fast changes leave (duplicates, dead code, needless defenses, functions too long to follow, departures from the conventions, stale comments and documentation, weak tests), leaves the files of the open pull requests alone and proposes no cleanup like those the operator closed. It answers with the cleanup's `issue.md` and `spec.md`: the gate reads them as `issue-save` does and refuses a dependency, since a cleanup starts from the main branch alone, otherwise the answer goes back to the scout (2 times at most). When none is worth a pull request, the run goes back to the main branch, deletes its empty branch (`release`) and ends there |
|
|
119
|
+
| `commit-spec` | Commits the cleanup's `issue.md` and `spec.md` on the run's branch (`docs: spec tidy-<run id>`) |
|
|
120
|
+
| `plan` … `attach` | As in `implement`, from that spec; the pull request links the spec at its own commit |
|
|
121
|
+
|
|
122
|
+
The pull request is your approval: merge it, or close it, and the scout does not propose that cleanup again. A defect the scout finds is named in the issue, never fixed by a cleanup. Until it is merged, a cleanup lives on its branch only, so the Kanban does not show it: follow its run under `/runs/`; once merged, it is an issue like the others, in Done. The run needs the repository on its main branch without changes, as `implement` does: run it from a clone kept for it rather than the one you work in. A cleanup is named after its run: its branch and its folder `.factory/issues/tidy-<run id>/` lead to the run under `/runs/`, and its title is that of its pull request and `issue.md`. A failed run stops on its branch and resumes as `implement` does.
|
|
123
|
+
|
|
110
124
|
### Kanban
|
|
111
125
|
|
|
112
126
|
`factory ui` shows the repository's issues in six columns. No status is stored: each column follows from facts.
|
|
@@ -118,9 +132,9 @@ When the review still asks for changes after its last round, the run stops; `fac
|
|
|
118
132
|
| Executing | the last `implement` run is running |
|
|
119
133
|
| Blocked | the last `implement` run failed |
|
|
120
134
|
| To Approve | the last `implement` run completed, and `plan.md` is not on the main branch |
|
|
121
|
-
| Done | `plan.md` is on the main branch |
|
|
135
|
+
| Done | `plan.md` is on the main branch, a merged cleanup's too |
|
|
122
136
|
|
|
123
|
-
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 newest pull request its `implement` runs recorded (a new run updates the same one) and, for each workflow shown on cards, its last run on the issue: its steps (done, current, failed or to come), its duration and its estimated cost. `implement` shows six steps: prepare, plan, implement, verify, review and deliver (the description and the screenshots' upload 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, or a main branch Git cannot read (`origin/HEAD` missing: `git remote set-head origin --auto` sets it).
|
|
137
|
+
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) 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 and the screenshots' upload 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).
|
|
124
138
|
|
|
125
139
|
## Adapt the factory
|
|
126
140
|
|
|
@@ -159,13 +173,14 @@ export default defineFactory({
|
|
|
159
173
|
```
|
|
160
174
|
|
|
161
175
|
- `verify`: the repository's checks, at least one: `{ name, command, timeoutMs }`, the command an executable and its arguments, run without a shell in the repository. They run in order and stop at the first failure: on the main branch before the run's agents, then after each implementation. A check may add `when`, globs of the files whose change makes it run (`when: ["scripts/*deploy*", "caddy/**"]`): it is for a long validation, such as a rehearsal, that only some changes call for; it never runs on the main branch, and after an implementation only if a file changed since the plan matches it.
|
|
162
|
-
- `maxCostUsd`: the budget of an `implement` run, in USD; `factory run implement --issue <slug> --max-cost-usd 40` changes it for one run. Codex announces no cost, so the agents of `implement` (`plan`, `implement`, `review`, `describe`) cannot run with Codex.
|
|
163
|
-
- `
|
|
176
|
+
- `maxCostUsd`: the budget of an `implement` run, in USD; `factory run implement --issue <slug> --max-cost-usd 40` changes it for one run. Codex announces no cost, so the agents of `implement` and `tidy` (`plan`, `implement`, `review`, `describe`) cannot run with Codex.
|
|
177
|
+
- `tidy` (optional): `{ maxCostUsd }`, the budget of a `tidy` run, that of `implement` when absent; `--max-cost-usd` changes it for one run.
|
|
178
|
+
- `profiles`: the agents of `plan`, `implement` and `review`, and optionally `describe`, which writes the pull request (the review's profile without it; see Profiles below); `tidy` runs its scout with the `plan` profile. Each profile decides what its agent may do: here, `plan` only reads the repository, handing areas of a large spec to sub-agents (`Agent`); `implement` also edits it and runs commands, and `permissionMode: "dontAsk"` refuses any other tool instead of waiting for a permission prompt; `review` and `describe` read it and run commands, such as tests, reproductions or the application in a browser (they must not change the repository: the run puts back what they change). `Agent` in the review's tools lets it split the review of a large change between sub-agents. Without a way to start the application and a browser, `describe` takes no screenshot and says why.
|
|
164
179
|
- `workflows` (optional): the repository's own workflows.
|
|
165
180
|
|
|
166
|
-
`defineFactory` lists every problem at once, each agent's profile checked on its own even when other fields are wrong; it also refuses a workflow not made by `defineWorkflow`, or named like another, `issue-save` and `
|
|
181
|
+
`defineFactory` lists every problem at once, each agent's profile checked on its own even when other fields are wrong; it also refuses a workflow not made by `defineWorkflow`, or named like another, `issue-save`, `implement` and `tidy` included. Any other default export of `factory.ts` is refused.
|
|
167
182
|
|
|
168
|
-
The rest is the factory's, the same in every repository: the issue folders and their formats, `issue-save`, the `implement`
|
|
183
|
+
The rest is the factory's, the same in every repository: the issue folders and their formats, `issue-save`, the `implement` and `tidy` runs (their starting conditions, stages, correction maximums, diff limit, branch and pull request), their agents' prompts, shipped with the package (`prompts/`), the Kanban and its columns. None of these can be changed by a repository yet. The `issue` skill is copied once by `factory init`: a later factory version does not update it.
|
|
169
184
|
|
|
170
185
|
## Write a workflow
|
|
171
186
|
|
|
@@ -295,7 +310,7 @@ The run executes in the foreground. The terminal shows each stage's start and en
|
|
|
295
310
|
|
|
296
311
|
**Ctrl-C** stops the run's child processes and ends the run as `failed` with its cause before its next stage, or instead of completing; a second Ctrl-C kills the remaining child processes and quits at once (exit code 130, the run may then stay `running`); commands that Codex runs in their own process groups are stopped by Codex on the first Ctrl-C, not by the second.
|
|
297
312
|
|
|
298
|
-
**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` 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.
|
|
313
|
+
**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.
|
|
299
314
|
|
|
300
315
|
`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 `/` and, under `/runs/`, a read-only dashboard of the repository's runs: the runs with workflow, status, current stage, duration, estimated cost and last update, and for a run its runtimes, its launches (the first one, then each resumption), each with a strip of its stages sized by duration, then its stages beside the selected one's detail (start, duration, outcome, the agent call's model, settings, tools and tokens as they come, a folded Output section with the agent's answer and the correction sent back or not, the journal and the tool calls), the correction counters and the result. 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.
|
|
301
316
|
|
|
@@ -314,6 +329,7 @@ Tokens and costs are the figures each runtime announces: Claude Code announces a
|
|
|
314
329
|
- 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.
|
|
315
330
|
- The rule that a public repository's screenshots show only test or seed data holds only through the describing agent's prompt. The factory does not check the Mermaid syntax: GitHub shows an error in place of an invalid diagram.
|
|
316
331
|
- Screenshots show the new state only, never the previous one; no videos.
|
|
332
|
+
- `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.
|
|
317
333
|
- 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.
|
|
318
334
|
|
|
319
335
|
## License
|
package/dist/app/board.js
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
import { boardOf, } from "../domain/board.js";
|
|
2
2
|
import { issueTitle } from "../domain/issue.js";
|
|
3
|
+
import { parseSpec } from "../domain/spec.js";
|
|
3
4
|
import { branchRef, defaultBranch, filesIn } from "../system/git.js";
|
|
4
|
-
import { artifactPath, issuesPath, listIssueFolders, } from "../system/issues.js";
|
|
5
|
+
import { artifactPath, issuesPath, listIssueFolders, readArtifact, } from "../system/issues.js";
|
|
5
6
|
import { listRuns } from "./runs.js";
|
|
6
7
|
const message = (error) => error instanceof Error ? error.message : String(error);
|
|
7
|
-
/** The workflows that take an issue (`--issue`) and declare their steps. */
|
|
8
|
+
/** The workflows that take an issue (`--issue`) and declare their steps, with where their retry edges go back to. */
|
|
8
9
|
function shownWorkflows(factory) {
|
|
9
|
-
return [...factory.workflows.values()].flatMap(({ name, input, steps }) =>
|
|
10
|
+
return [...factory.workflows.values()].flatMap(({ name, input, steps, nodes }) => {
|
|
11
|
+
if (!steps || !input?.shape.issue)
|
|
12
|
+
return [];
|
|
13
|
+
const corrections = {};
|
|
14
|
+
for (const [stage, { on }] of Object.entries(nodes))
|
|
15
|
+
for (const [outcome, edge] of Object.entries(on))
|
|
16
|
+
if (edge !== null && typeof edge === "object")
|
|
17
|
+
corrections[`${stage}.${outcome}`] = edge.to;
|
|
18
|
+
return [{ name, steps, corrections }];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** The issues `slug`'s spec depends on; a spec that cannot be read or is invalid is a problem, and none are shown. */
|
|
22
|
+
async function dependenciesOf(dir, slug, problems) {
|
|
23
|
+
try {
|
|
24
|
+
const text = await readArtifact(dir, slug, "spec");
|
|
25
|
+
if (text === undefined)
|
|
26
|
+
return [];
|
|
27
|
+
const spec = parseSpec(text, slug);
|
|
28
|
+
if (spec.ok)
|
|
29
|
+
return spec.value.dependencies;
|
|
30
|
+
problems.push(`Issue ${slug}: its dependencies cannot be shown, spec.md is invalid (/issue ${slug} fixes it): ${spec.problems.join("; ")}`);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
problems.push(`Issue ${slug}: spec.md cannot be read: ${message(error)}`);
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
10
36
|
}
|
|
11
37
|
/**
|
|
12
38
|
* The Kanban as the repository is now: its issues, the main branch and its
|
|
@@ -23,7 +49,7 @@ export async function readBoard(factory, loadError) {
|
|
|
23
49
|
}
|
|
24
50
|
catch (error) {
|
|
25
51
|
// A remote added by hand has no origin/HEAD until git sets it.
|
|
26
|
-
problems.push(`Done issues cannot be told apart (the main branch is origin/HEAD; git remote set-head origin --auto sets it): ${message(error)}`);
|
|
52
|
+
problems.push(`Done issues and delivered dependencies cannot be told apart (the main branch is origin/HEAD; git remote set-head origin --auto sets it): ${message(error)}`);
|
|
27
53
|
}
|
|
28
54
|
const runs = [];
|
|
29
55
|
for (const entry of await listRuns(factory))
|
|
@@ -31,17 +57,26 @@ export async function readBoard(factory, loadError) {
|
|
|
31
57
|
runs.push(entry.state);
|
|
32
58
|
else
|
|
33
59
|
problems.push(`Run ${entry.id} cannot be read: ${entry.error}`);
|
|
34
|
-
const issues =
|
|
60
|
+
const issues = [];
|
|
61
|
+
for (const folder of await listIssueFolders(factory.dir)) {
|
|
35
62
|
if (folder.unreadable !== undefined)
|
|
36
63
|
problems.push(`Issue ${folder.slug}: issue.md cannot be read: ${folder.unreadable}`);
|
|
37
|
-
|
|
64
|
+
const isDelivered = delivered.has(artifactPath(folder.slug, "plan"));
|
|
65
|
+
issues.push({
|
|
38
66
|
slug: folder.slug,
|
|
39
67
|
title: (folder.issue && issueTitle(folder.issue)) || folder.slug,
|
|
40
68
|
hasSpec: folder.hasSpec,
|
|
41
|
-
delivered:
|
|
69
|
+
// A delivered issue's spec may predate today's format: it waits for nothing.
|
|
70
|
+
dependencies: folder.hasSpec && !isDelivered
|
|
71
|
+
? (await dependenciesOf(factory.dir, folder.slug, problems)).map((slug) => ({
|
|
72
|
+
slug,
|
|
73
|
+
delivered: delivered.has(artifactPath(slug, "plan")),
|
|
74
|
+
}))
|
|
75
|
+
: [],
|
|
76
|
+
delivered: isDelivered,
|
|
42
77
|
changedAt: folder.changedAt,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
45
80
|
return boardOf(issues, runs, shownWorkflows(factory), problems);
|
|
46
81
|
}
|
|
47
82
|
//# sourceMappingURL=board.js.map
|
package/dist/app/board.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/app/board.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,
|
|
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,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QAC7C,MAAM,WAAW,GAA2B,EAAE,CAAC;QAC/C,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YACjD,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAA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ACV,MAAM,CAAC,OAAO,IAAI,CAAC,WAAW;gBAC5B,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAC5D,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBACT,IAAI;oBACJ,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;iBACrD,CAAC,CACH;gBACH,CAAC,CAAC,EAAE;YACR,SAAS,EAAE,WAAW;YACtB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/app/define.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ export interface FactoryWorkflows {
|
|
|
19
19
|
/** The workflows of a factory returned by `defineFactory`; nothing for any other value. */
|
|
20
20
|
export declare function workflowsOf(value: unknown): FactoryWorkflows | undefined;
|
|
21
21
|
/**
|
|
22
|
-
* A repository's factory: its workflows (`issue-save`, `implement`)
|
|
23
|
-
* the repository's checks,
|
|
24
|
-
* problem is listed at once.
|
|
22
|
+
* A repository's factory: its workflows (`issue-save`, `implement`, `tidy`)
|
|
23
|
+
* adapted to the repository's checks, budgets and agents, then its own
|
|
24
|
+
* workflows. Every problem is listed at once.
|
|
25
25
|
*/
|
|
26
26
|
export declare function defineFactory(definition: FactoryDefinition): DefinedFactory;
|
|
27
27
|
export {};
|
package/dist/app/define.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isWorkflow, profileProblems } from "@clemrig/flow";
|
|
2
2
|
import { definitionProblems, } from "../domain/definition.js";
|
|
3
3
|
import { DELIVERY } from "../domain/delivery.js";
|
|
4
|
+
import { TIDY } from "../domain/tidy.js";
|
|
4
5
|
import { implement } from "./workflows/implement.js";
|
|
5
6
|
import { issueSave } from "./workflows/issue-save.js";
|
|
7
|
+
import { tidy } from "./workflows/tidy.js";
|
|
6
8
|
const defined = new WeakMap();
|
|
7
9
|
/** The workflows of a factory returned by `defineFactory`; nothing for any other value. */
|
|
8
10
|
export function workflowsOf(value) {
|
|
@@ -11,9 +13,9 @@ export function workflowsOf(value) {
|
|
|
11
13
|
: undefined;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
|
-
* A repository's factory: its workflows (`issue-save`, `implement`)
|
|
15
|
-
* the repository's checks,
|
|
16
|
-
* problem is listed at once.
|
|
16
|
+
* A repository's factory: its workflows (`issue-save`, `implement`, `tidy`)
|
|
17
|
+
* adapted to the repository's checks, budgets and agents, then its own
|
|
18
|
+
* workflows. Every problem is listed at once.
|
|
17
19
|
*/
|
|
18
20
|
export function defineFactory(definition) {
|
|
19
21
|
const problems = definitionProblems(definition);
|
|
@@ -21,7 +23,7 @@ export function defineFactory(definition) {
|
|
|
21
23
|
// factory.ts is not type-checked: the definition may be anything.
|
|
22
24
|
const given = typeof definition === "object" && definition !== null ? definition : {};
|
|
23
25
|
const own = Array.isArray(given.workflows) ? given.workflows : [];
|
|
24
|
-
const names = new Set([issueSave.name, DELIVERY]);
|
|
26
|
+
const names = new Set([issueSave.name, DELIVERY, TIDY]);
|
|
25
27
|
for (const [index, workflow] of own.entries())
|
|
26
28
|
if (!isWorkflow(workflow))
|
|
27
29
|
problems.push(`workflows.${index}: expected a defineWorkflow(…) result`);
|
|
@@ -46,13 +48,17 @@ export function defineFactory(definition) {
|
|
|
46
48
|
// (a budget with an agent that announces no cost).
|
|
47
49
|
if (given.profiles && !flagged("profiles"))
|
|
48
50
|
try {
|
|
51
|
+
const settings = { verify: given.verify ?? [], profiles: given.profiles };
|
|
52
|
+
// A refused budget is already listed; the workflow does not repeat it.
|
|
53
|
+
const maxCostUsd = flagged("maxCostUsd") ? undefined : given.maxCostUsd;
|
|
49
54
|
base = [
|
|
50
55
|
issueSave,
|
|
51
|
-
implement({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
implement({ ...settings, maxCostUsd }),
|
|
57
|
+
tidy({
|
|
58
|
+
...settings,
|
|
59
|
+
maxCostUsd: flagged("tidy")
|
|
60
|
+
? undefined
|
|
61
|
+
: (given.tidy?.maxCostUsd ?? maxCostUsd),
|
|
56
62
|
}),
|
|
57
63
|
];
|
|
58
64
|
}
|
package/dist/app/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/app/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/app/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqB3C,MAAM,OAAO,GAAG,IAAI,OAAO,EAA4B,CAAC;AAExD,2FAA2F;AAC3F,MAAM,UAAU,WAAW,CAAC,KAAc;IAC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CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,IAAI,UAAU,CAAC;iBAC3C,CAAC;aACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CACb,CAAC,kBAAkB,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CACrE,IAAI,CACL,CACF,CAAC;IACJ,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAmB,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/app/run.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare function startRun(factory: Factory, name: string, options: Record
|
|
|
10
10
|
* Resumes a failed run of the repository at the stage where it stopped, with
|
|
11
11
|
* its workflow as `factory.ts` defines it now and its prompts read again;
|
|
12
12
|
* `--max-cost-usd` sets its budget, and `--accept-review` delivers an
|
|
13
|
-
* implement run its review stopped by asking for changes.
|
|
13
|
+
* implement or tidy run its review stopped by asking for changes.
|
|
14
14
|
*/
|
|
15
15
|
export declare function resumeRun(factory: Factory, runId: string, options: Record<string, string | boolean>, hooks: RunHooks): Promise<StartedRun>;
|
package/dist/app/run.js
CHANGED
|
@@ -2,6 +2,7 @@ import { exceededEdge, resumeRun as resume, startRun as start, } from "@clemrig/
|
|
|
2
2
|
import { loadPrompts, workflowOf } from "../system/factory.js";
|
|
3
3
|
import { asOptionsError, inputFromOptions, parseBudget } from "./options.js";
|
|
4
4
|
import { DELIVERY } from "../domain/delivery.js";
|
|
5
|
+
import { TIDY } from "../domain/tidy.js";
|
|
5
6
|
import { loadRun } from "./runs.js";
|
|
6
7
|
/**
|
|
7
8
|
* Starts a workflow of the factory from `factory run` options, with its prompts
|
|
@@ -32,7 +33,7 @@ export async function startRun(factory, name, options, hooks) {
|
|
|
32
33
|
* Resumes a failed run of the repository at the stage where it stopped, with
|
|
33
34
|
* its workflow as `factory.ts` defines it now and its prompts read again;
|
|
34
35
|
* `--max-cost-usd` sets its budget, and `--accept-review` delivers an
|
|
35
|
-
* implement run its review stopped by asking for changes.
|
|
36
|
+
* implement or tidy run its review stopped by asking for changes.
|
|
36
37
|
*/
|
|
37
38
|
export async function resumeRun(factory, runId, options, hooks) {
|
|
38
39
|
const { "max-cost-usd": budget, "accept-review": acceptReview, ...others } = options;
|
|
@@ -47,9 +48,9 @@ export async function resumeRun(factory, runId, options, hooks) {
|
|
|
47
48
|
// judges it again, and accepts it.
|
|
48
49
|
if (acceptReview !== undefined &&
|
|
49
50
|
(acceptReview !== true ||
|
|
50
|
-
run.workflow
|
|
51
|
+
![DELIVERY, TIDY].includes(run.workflow) ||
|
|
51
52
|
exceededEdge(workflow, run) !== "reviewed.changes"))
|
|
52
|
-
throw new Error(`--accept-review only resumes a run of ${DELIVERY} stopped by its review asking for changes, and takes no value`);
|
|
53
|
+
throw new Error(`--accept-review only resumes a run of ${DELIVERY} or ${TIDY} stopped by its review asking for changes, and takes no value`);
|
|
53
54
|
return resume({
|
|
54
55
|
workflow,
|
|
55
56
|
runId,
|
package/dist/app/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/app/run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,SAAS,IAAI,MAAM,EAEnB,QAAQ,IAAI,KAAK,GAClB,MAAM,eAAe,CAAC;AACvB,O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K,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnD,0EAA0E;IAC1E,0EAA0E;IAC1E,mCAAmC;IACnC,IACE,YAAY,KAAK,SAAS;QAC1B,CAAC,YAAY,KAAK,IAAI;YACpB,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,kBAAkB,CAAC;QAErD,MAAM,IAAI,KAAK,CACb,yCAAyC,QAAQ,OAAO,IAAI,+DAA+D,CAC5H,CAAC;IACJ,OAAO,MAAM,CACX;QACE,QAAQ;QACR,KAAK;QACL,UAAU;QACV,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC7C,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,SAAS,EAAE,OAAO,CAAC,UAAU;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,EACD,KAAK,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/** What the workflow uses: the factory requires the budget, the workflow also runs without one. */
|
|
3
|
-
type Settings = Pick<FactoryDefinition, "verify" | "profiles"> & {
|
|
4
|
-
maxCostUsd?: number;
|
|
5
|
-
};
|
|
1
|
+
import type { Settings } from "./stages/run.js";
|
|
6
2
|
/** Plans, implements, checks and reviews an approved spec, then describes it in the pull request it opens. */
|
|
7
3
|
export declare function implement(definition: Settings): import("@clemrig/flow").Workflow;
|
|
8
|
-
export {};
|