@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.
- package/README.md +21 -14
- package/dist/app/board.js +1 -0
- package/dist/app/board.js.map +1 -1
- package/dist/app/prototype.d.ts +15 -0
- package/dist/app/prototype.js +65 -0
- package/dist/app/prototype.js.map +1 -0
- package/dist/app/review.js +3 -2
- package/dist/app/review.js.map +1 -1
- package/dist/app/spec-page.d.ts +24 -0
- package/dist/app/spec-page.js +72 -0
- package/dist/app/spec-page.js.map +1 -0
- package/dist/app/workflows/issue-save.d.ts +4 -1
- package/dist/app/workflows/issue-save.js +83 -9
- package/dist/app/workflows/issue-save.js.map +1 -1
- package/dist/app/workflows/stages/agents.d.ts +5 -0
- package/dist/app/workflows/stages/agents.js +5 -0
- package/dist/app/workflows/stages/agents.js.map +1 -1
- package/dist/app/workflows/stages/deliver.js +11 -3
- package/dist/app/workflows/stages/deliver.js.map +1 -1
- package/dist/app/workflows/stages/implement.js +8 -2
- package/dist/app/workflows/stages/implement.js.map +1 -1
- package/dist/app/workflows/stages/plan.js +2 -0
- package/dist/app/workflows/stages/plan.js.map +1 -1
- package/dist/app/workflows/stages/prepare.js +15 -1
- package/dist/app/workflows/stages/prepare.js.map +1 -1
- package/dist/app/workflows/stages/review.js +9 -2
- package/dist/app/workflows/stages/review.js.map +1 -1
- package/dist/app/workflows/stages/run.d.ts +14 -1
- package/dist/app/workflows/stages/run.js.map +1 -1
- package/dist/cli/ui.d.ts +4 -3
- package/dist/cli/ui.js +12 -4
- package/dist/cli/ui.js.map +1 -1
- package/dist/domain/board.d.ts +4 -0
- package/dist/domain/board.js +1 -0
- package/dist/domain/board.js.map +1 -1
- package/dist/domain/pull-request.d.ts +9 -2
- package/dist/domain/pull-request.js +12 -2
- package/dist/domain/pull-request.js.map +1 -1
- package/dist/domain/spec-page.d.ts +188 -0
- package/dist/domain/spec-page.js +242 -0
- package/dist/domain/spec-page.js.map +1 -0
- package/dist/domain/spec.d.ts +13 -1
- package/dist/domain/spec.js +60 -8
- package/dist/domain/spec.js.map +1 -1
- package/dist/domain/tidy.d.ts +2 -1
- package/dist/domain/tidy.js +5 -1
- package/dist/domain/tidy.js.map +1 -1
- package/dist/system/git.d.ts +4 -0
- package/dist/system/git.js +13 -0
- package/dist/system/git.js.map +1 -1
- package/dist/system/images.d.ts +16 -0
- package/dist/system/images.js +51 -0
- package/dist/system/images.js.map +1 -0
- package/dist/system/issues.d.ts +27 -0
- package/dist/system/issues.js +117 -1
- package/dist/system/issues.js.map +1 -1
- package/dist/system/run-files.d.ts +0 -8
- package/dist/system/run-files.js +1 -28
- package/dist/system/run-files.js.map +1 -1
- package/package.json +2 -2
- package/prompts/implement.md +11 -1
- package/prompts/plan.md +17 -6
- package/prompts/review.md +11 -4
- package/templates/init/gitignore +1 -0
- package/templates/skills/issue/SKILL.md +85 -13
|
@@ -19,18 +19,76 @@ description of the need. Once the operator agrees, save the issue (see Save).
|
|
|
19
19
|
|
|
20
20
|
1. Read the repository's agent instructions (`AGENTS.md` at the root and in the directories concerned) and the
|
|
21
21
|
relevant code. Change nothing.
|
|
22
|
-
2.
|
|
22
|
+
2. When the operator built a prototype for this need (they say so, or the issue names one), it is what they
|
|
23
|
+
validated: write the spec from it, not from what you would design, and ask only about what it leaves open.
|
|
24
|
+
- It must be committed, its notes included (a `PROTOTYPE.md`, say), on a branch named with a slash, such as
|
|
25
|
+
`prototype/<slug>`, and pushed: if it is not, ask the operator to do it, or to let you do it there. The spec
|
|
26
|
+
names that branch and the full id of the commit they validated (see Format).
|
|
27
|
+
- Read it at that commit, before asking anything: its notes, what it changed (`git diff HEAD...<commit>`) and
|
|
28
|
+
its screens. To run it, add a working tree of that commit outside the repository
|
|
29
|
+
(`git worktree add --detach <folder> <commit>`, removed once done) and start it as the repository's
|
|
30
|
+
instructions say, or ask the operator where it already runs; never switch branches in the repository.
|
|
31
|
+
3. Ask the operator questions, a few at a time, until you can fill every section without inventing anything.
|
|
23
32
|
Do not ask what the code or the docs already answer. For each question, give its practical consequence
|
|
24
33
|
and your recommendation.
|
|
25
|
-
|
|
34
|
+
4. Ask whether the issue relies on another issue that must be delivered first: its spec assumes behavior that
|
|
26
35
|
issue brings. List the issues of `.factory/issues/` that look related, with whether each is delivered (its
|
|
27
36
|
`plan.md` is on the main branch), and record the operator's answer in Dependencies.
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
5. Describe what and why, never how: the run that implements the spec plans the technical work itself.
|
|
38
|
+
Where you chose between real alternatives, write the one you recommend: the presentation shows the others.
|
|
39
|
+
6. Propose the complete spec and wait for the operator's agreement, then save it (see Save).
|
|
40
|
+
7. Present it for the operator to validate it on its page (see Present).
|
|
30
41
|
|
|
31
42
|
Other issues in `.factory/issues/` are history, not the current truth: rely on the code and the docs, and read
|
|
32
43
|
them only to find the issues this one depends on.
|
|
33
44
|
|
|
45
|
+
## Present
|
|
46
|
+
|
|
47
|
+
The spec page of `factory ui` (`spec?issue=<slug>`, linked from the issue's card) shows the spec as a deck of
|
|
48
|
+
cards the operator answers one by one. Write its presentation, in the spec's language and in plain words, as a
|
|
49
|
+
JSON draft outside the repository, then save it with `--kind page` (see Save):
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"need": "<the problem and why it matters, for someone who has not read the spec>",
|
|
54
|
+
"changes": [{ "title": "<a few words>", "text": "<what changes, for whom, why>", "mockup": <optional> }],
|
|
55
|
+
"decisions": [{
|
|
56
|
+
"id": "<id>", "title": "<the question>", "why": "<what the answer changes>",
|
|
57
|
+
"options": [{ "id": "<id>", "title": "<a few words>", "text": "<what it does, what it costs>" }],
|
|
58
|
+
"chosen": "<the id of the option the spec takes>"
|
|
59
|
+
}],
|
|
60
|
+
"criteria": [{ "title": "<what they check together>", "criteria": [
|
|
61
|
+
{ "id": "AC1", "plain": "<the criterion in plain words>", "check": "<how it will be checked, on what>" }
|
|
62
|
+
] }],
|
|
63
|
+
"outOfScope": ["<what the spec leaves out, in plain words>"]
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- One change per part of the scope a person would judge on its own; `text` in a few sentences, `**bold**` and
|
|
68
|
+
`` `code` `` allowed.
|
|
69
|
+
- A mockup only for a change that brings or changes an interface. When the spec's prototype shows it, capture it,
|
|
70
|
+
never draw it: the operator validated that screen. Run the prototype at the spec's commit (see Specify), open the
|
|
71
|
+
state the change describes in a browser (`.factory/node_modules/.bin/playwright-cli`, which `factory init`
|
|
72
|
+
installs: run it with `--help` first, or the browser tools you have) and save a screenshot (PNG, JPEG or WebP,
|
|
73
|
+
2 MiB at most) beside the draft, outside the repository; give its absolute path,
|
|
74
|
+
`{ "caption": "…", "image": "<path>" }`, and `issue-save` keeps the image beside the spec. When you cannot run
|
|
75
|
+
the prototype or take the screenshot, ask the operator for it. Capture again whenever the spec names another
|
|
76
|
+
commit. Only an interface the prototype does not show is drawn:
|
|
77
|
+
`{ "caption": "…", "html": "<a whole HTML document>", "width": <320–1600>, "height": <200–4000> }`, shown in a
|
|
78
|
+
frame without script, network or anything but its own HTML and inline styles: no `<script>`, no link to a
|
|
79
|
+
stylesheet, a font or an image (draw them, or use `data:` images); under 256 KiB. Reproduce the application's
|
|
80
|
+
existing pages and components from its code and styles and mark what is new; invent no component, text or state
|
|
81
|
+
that neither the application nor the spec has.
|
|
82
|
+
- A decision for each choice where the spec took one of real alternatives (2 to 5 options), the one it took as
|
|
83
|
+
`chosen`; none when there was nothing to choose. An `<id>` starts with a lowercase letter, then lowercase
|
|
84
|
+
letters, digits or hyphens, 40 characters at most.
|
|
85
|
+
- Every acceptance criterion of the spec exactly once, grouped by what a person checks together.
|
|
86
|
+
|
|
87
|
+
`factory run issue-save` checks the draft against the saved spec and keeps it with the spec it presents: once
|
|
88
|
+
the spec changes, the page says it is stale, so save a new presentation after saving a new spec. When the
|
|
89
|
+
operator brings back the page's message (the cards they sent back, their notes, the options they took instead),
|
|
90
|
+
update the spec with them, save it, then present it again.
|
|
91
|
+
|
|
34
92
|
## Fix a refused spec
|
|
35
93
|
|
|
36
94
|
When `factory run implement` refuses to start because of the spec (a missing section such as Dependencies, a
|
|
@@ -71,29 +129,43 @@ delivered is either delivered first or removed from the spec, as the operator de
|
|
|
71
129
|
|
|
72
130
|
## Dependencies
|
|
73
131
|
- <slug of an issue that must be delivered first>
|
|
132
|
+
|
|
133
|
+
## Prototype
|
|
134
|
+
- Branch: <the prototype's branch>
|
|
135
|
+
- Commit: <the full id of the commit the operator validated>
|
|
74
136
|
```
|
|
75
137
|
|
|
76
|
-
- Exactly these six sections, in this order, with nothing between the title and the first one
|
|
138
|
+
- Exactly these six sections, in this order, with nothing between the title and the first one; then Prototype,
|
|
139
|
+
only when the spec draws on a prototype, and left out otherwise.
|
|
77
140
|
- No section is empty: write `None.` when there is nothing to say.
|
|
78
141
|
- Acceptance criteria contains only `- AC<n>: <criterion>` items, numbered from AC1 without gaps; an indented
|
|
79
142
|
line continues the criterion above it. Each criterion is a fact that a user, an API client or an operator
|
|
80
143
|
can check, not an implementation detail.
|
|
81
144
|
- Dependencies contains only `- <slug>` items, each an issue of `.factory/issues/` other than this one, or
|
|
82
145
|
`None.`: the run refuses to start until each of them is delivered.
|
|
146
|
+
- Prototype contains `- Branch: <branch>` then `- Commit: <full commit id>`: the commit the operator validated,
|
|
147
|
+
as `git rev-parse` prints it, on a branch named with a slash, which no run takes, and which origin holds. The
|
|
148
|
+
runs read the prototype at that commit and refuse to start without it: keep the branch until the issue is
|
|
149
|
+
delivered, and never rewrite it (commits added on top are fine). To draw on another commit, have the operator
|
|
150
|
+
validate it, then save the spec and its presentation again.
|
|
83
151
|
- Headings stay in English; the content may be in any language.
|
|
84
152
|
|
|
85
153
|
## Save
|
|
86
154
|
|
|
87
155
|
1. Write the draft to a new file outside the repository, for example in a directory created by `mktemp -d`.
|
|
88
156
|
2. From the repository, run
|
|
89
|
-
`factory run issue-save --issue <slug> --kind issue --file <absolute path>` for `issue.md`,
|
|
90
|
-
`--kind spec` for `spec.md
|
|
91
|
-
3. `Saved .factory/issues/<slug>/<
|
|
92
|
-
|
|
93
|
-
|
|
157
|
+
`factory run issue-save --issue <slug> --kind issue --file <absolute path>` for `issue.md`,
|
|
158
|
+
`--kind spec` for `spec.md`, or `--kind page` for the spec's presentation (`spec-page.json`).
|
|
159
|
+
3. `Saved .factory/issues/<slug>/<file>` means it is done. Otherwise the command lists every problem: fix the
|
|
160
|
+
draft and run it again. It refuses a spec whose issue does not exist yet, a dependency that is no issue of the
|
|
161
|
+
repository, a prototype origin does not hold, and a presentation that does not present the saved spec or whose
|
|
162
|
+
capture is no image. Each saved file is named, the captures folder included.
|
|
94
163
|
|
|
95
164
|
## Boundaries
|
|
96
165
|
|
|
97
|
-
Never write in `.factory/issues/` directly, never commit
|
|
98
|
-
|
|
99
|
-
`factory
|
|
166
|
+
Never write in `.factory/issues/` directly, never commit in the repository (a prototype is committed on its own
|
|
167
|
+
branch, by the operator or with their leave), and never run `factory run implement`. When the spec and its
|
|
168
|
+
presentation are saved, tell the operator the next steps: validate it on its page in `factory ui` (the Spec link
|
|
169
|
+
of the issue's card), commit the spec, its `spec-page.json` and its captures (`spec-page/`) and push them on the
|
|
170
|
+
main branch, then run `factory run implement --issue <slug>`. A prototype's branch stays until the issue is
|
|
171
|
+
delivered; its pull request then says whether it can be removed.
|